packages feed

hlint 1.8.48 → 1.8.49

raw patch · 9 files changed

+43/−42 lines, 9 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

data/Default.hs view
@@ -376,7 +376,6 @@ warn  = x + negate y ==> x - y warn  = 0 - x ==> negate x warn  = log y / log x ==> logBase x y-warn  = x ** 0.5 ==> sqrt x warn  = sin x / cos x ==> tan x warn  = sinh x / cosh x ==> tanh x warn  = n `rem` 2 == 0 ==> even n@@ -384,7 +383,6 @@ warn  = not (even x) ==> odd x warn  = not (odd x) ==> even x warn  = x ** 0.5 ==> sqrt x-warn  = x ^^ y ==> x ** y where _ = isLitInt y warn  "Use 1" = x ^ 0 ==> 1 warn  = round (x - 0.5) ==> floor x @@ -494,7 +492,6 @@ yes = a >>= return . id -- Control.Monad.liftM id a yes = (x !! 0) + (x !! 2) -- head x yes = if b < 42 then [a] else [] -- [a | b < 42]--- yes = take 5 (foo xs) == "hello" -- "hello" `Data.List.isPrefixOf` foo xs no  = take n (foo xs) == "hello" yes = head (reverse xs) -- last xs yes = reverse xs `isPrefixOf` reverse ys -- isSuffixOf xs ys
hlint.cabal view
@@ -1,7 +1,7 @@ cabal-version:      >= 1.6 build-type:         Simple name:               hlint-version:            1.8.48+version:            1.8.49 license:            BSD3 license-file:       LICENSE category:           Development@@ -28,8 +28,8 @@     hlint.htm  source-repository head-    type:     darcs-    location: http://community.haskell.org/~ndm/darcs/hlint/+    type:     git+    location: git://github.com/ndmitchell/hlint.git  flag threaded     default: True
src/CmdLine.hs view
@@ -166,7 +166,7 @@   versionText :: String-versionText = "HLint v" ++ showVersion version ++ ", (C) Neil Mitchell 2006-2012\n"+versionText = "HLint v" ++ showVersion version ++ ", (C) Neil Mitchell 2006-2013\n"   helpText :: String
src/HLint.hs view
@@ -5,6 +5,7 @@ import Control.Monad import Data.List import Data.Maybe+import System.Exit  import CmdLine import Settings@@ -48,8 +49,10 @@ hlint args = do     cmd@Cmd{..} <- getCmd args     let flags = parseFlags{cppFlags=cmdCpp, encoding=cmdEncoding, language=cmdLanguage}-    if cmdTest then-        test (\x -> hlint x >> return ()) cmdDataDir cmdGivenHints >> return []+    if cmdTest then do+        failed <- test (\x -> hlint x >> return ()) cmdDataDir cmdGivenHints+        when (failed > 0) exitFailure+        return []      else if notNull cmdProof then do         s <- readAllSettings cmd flags         let reps = if cmdReports == ["report.html"] then ["report.txt"] else cmdReports
src/Hint/Bracket.hs view
@@ -69,7 +69,6 @@     concatMap (bracket False) (childrenBi x :: [Type_]) ++     concatMap (bracket False) (childrenBi x :: [Pat_]) ++     concatMap fieldDecl (childrenBi x)-     where         -- Brackets at the roots of annotations are fine, so we strip them         annotations :: Annotation S -> Annotation S
src/Hint/Lambda.hs view
@@ -19,7 +19,6 @@     \x -> \y -> ... ==> \x y -- lambda compression     \x -> (x +) ==> (+) -- operator reduction - <TEST> f a = \x -> x + x -- f a x = x + x f a = \a -> a + a -- f _ a = a + a
src/Main.hs view
@@ -1,20 +1,3 @@-{--HLint, Haskell source code suggestions-Copyright (C) 2006-2012, Neil Mitchell--This program is free software; you can redistribute it and/or modify-it under the terms of the GNU General Public License as published by-the Free Software Foundation; version 2 of the License.--This program is distributed in the hope that it will be useful,-but WITHOUT ANY WARRANTY; without even the implied warranty of-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the-GNU General Public License for more details.--You should have received a copy of the GNU General Public License-along with this program; if not, write to the Free Software-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA--}  module Main where 
src/Test.hs view
@@ -216,19 +216,36 @@         handle (\(e::SomeException) -> print e) $         handle (\(e::ExitCode) -> return ()) $         main flags+    let gotValid = isJust got     want <- fmap lines $ reader "output"+    (want,got) <- return $ matchStarStar want $ fromMaybe [] got -    let eq w g = w == g || ("*" `isSuffixOf` w && init w `isPrefixOf` g)-    case got of-        Nothing -> putStrLn "Warning: failed to capture output (GHC too old?)" >> return pass-        Just got | length got == length want && and (zipWith eq want got) -> return pass-                 | otherwise -> do-            let trail = replicate (max (length got) (length want)) "<EOF>"-            let (i,g,w):_ = [(i,g,w) | (i,g,w) <- zip3 [1..] (got++trail) (want++trail), not $ eq w g]-            putStrLn $ unlines-                ["TEST FAILURE IN tests/" ++ pre-                ,"DIFFER ON LINE: " ++ show i-                ,"GOT : " ++ g-                ,"WANT: " ++ w]-            when (null want) $ putStrLn $ unlines $ "FULL OUTPUT FOR GOT:" : got-            return failure+    if not gotValid then+        putStrLn "Warning: failed to capture output (GHC too old?)" >> return pass+     else if length got == length want && and (zipWith matchStar want got) then+        return pass+     else do+        let trail = replicate (max (length got) (length want)) "<EOF>"+        let (i,g,w):_ = [(i,g,w) | (i,g,w) <- zip3 [1..] (got++trail) (want++trail), not $ matchStar w g]+        putStrLn $ unlines+            ["TEST FAILURE IN tests/" ++ pre+            ,"DIFFER ON LINE: " ++ show i+            ,"GOT : " ++ g+            ,"WANT: " ++ w]+        when (null want) $ putStrLn $ unlines $ "FULL OUTPUT FOR GOT:" : got+        return failure+++-- | First string may have stars in it (the want)+matchStar :: String -> String -> Bool+matchStar ('*':xs) ys = any (matchStar xs) $ tails ys+matchStar (x:xs) (y:ys) = x == y && matchStar xs ys+matchStar [] [] = True+matchStar _ _ = False+++matchStarStar :: [String] -> [String] -> ([String], [String])+matchStarStar want got = case break (== "**") want of+    (_, []) -> (want, got)+    (w1,_:w2) -> (w1++w2, g1 ++ revTake (length w2) g2)+        where (g1,g2) = splitAt (length w1) got
src/Util.hs view
@@ -112,6 +112,9 @@ unsnoc [] = error "Unsnoc on empty list" unsnoc xs = (init xs, last xs) +revTake :: Int -> [a] -> [a]+revTake i = reverse . take i . reverse+  --------------------------------------------------------------------- -- DATA.TUPLE