packages feed

hlint 1.8.13 → 1.8.14

raw patch · 3 files changed

+50/−17 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

data/Default.hs view
@@ -56,16 +56,13 @@  error = concat (map f x) ==> concatMap f x warn = concat [a,b] ==> a ++ b--- these hints pick up way too much---warn = a++b++c++d++e++f++g ==> concat [a, b, c, d, e, f, g]---warn = a++b++c++d++e++f ==> concat [a, b, c, d, e, f]---warn = a++b++c++d++e ==> concat [a, b, c, d, e]-error "Use map once" = map f (map g x) ==> map (f . g) x+warn "Use map once" = map f (map g x) ==> map (f . g) x warn  = x !! 0 ==> head x error = take n (repeat x) ==> replicate n x error = head (reverse x) ==> last x error = head (drop n x) ==> x !! n error = reverse (tail (reverse x)) ==> init x+error = take (length x - 1) x ==> init x error = isPrefixOf (reverse x) (reverse y) ==> isSuffixOf x y error = foldr (++) [] ==> concat error = span (not . p) ==> break p@@ -79,6 +76,7 @@ warn  "Use null" = length x /= 0 ==> not (null x) error "Use :" = (\x -> [x]) ==> (:[]) error = map (uncurry f) (zip x y) ==> zipWith f x y+warn  = map f (zip x y) ==> zipWith (curry f) x y where _ = isVar f error = not (elem x y) ==> notElem x y warn  = foldr f z (map g x) ==> foldr (f . g) z x error = x ++ concatMap (' ':) y ==> unwords (x:y)@@ -91,17 +89,32 @@  -- FOLDS -error = foldr (&&) True ==> and-error = foldl (&&) True ==> and-error = foldr (||) False ==> or-error = foldl (||) False ==> or-error = foldr (>>) (return ()) ==> sequence_-error = foldl (+) 0 ==> sum-error = foldl (*) 1 ==> product+error = foldr  (>>) (return ()) ==> sequence_+error = foldr  (&&) True ==> and+error = foldl  (&&) True ==> and+error = foldr1 (&&)  ==> and+error = foldl1 (&&)  ==> and+error = foldr  (||) False ==> or+error = foldl  (||) False ==> or+error = foldr1 (||)  ==> or+error = foldl1 (||)  ==> or+error = foldl  (+) 0 ==> sum+error = foldr  (+) 0 ==> sum+error = foldl1 (+)   ==> sum+error = foldr1 (+)   ==> sum+error = foldl  (*) 1 ==> product+error = foldr  (*) 1 ==> product+error = foldl1 (*)   ==> product+error = foldr1 (*)   ==> product+error = foldl1 max   ==> maximum+error = foldr1 max   ==> maximum+error = foldl1 min   ==> minimum+error = foldr1 min   ==> minimum  -- FUNCTION  error = (\x -> x) ==> id+error = (\x y -> x) ==> const error = (\(_,y) -> y) ==> snd error = (\(x,_) -> x) ==> fst warn "Use curry" = (\x y-> f (x,y)) ==> curry f where _ = notIn [x,y] f@@ -110,13 +123,13 @@ error "Redundant $" = (f $) ==> f warn  = (\x -> y) ==> const y where _ = isAtom y && notIn x y error "Redundant flip" = flip f x y ==> f y x where _ = isApp original-error "Redundant id" = id x ==> x-error "Redundant const" = const x y ==> x+warn  = (\a b -> o (f a) (f b)) ==> o `Data.Function.on` f  -- BOOL  error "Redundant ==" = a == True ==> a warn  "Redundant ==" = a == False ==> not a+error "Redundant if" = (if a then x else x) ==> x where note = "reduces strictness" error "Redundant if" = (if a then True else False) ==> a error "Redundant if" = (if a then False else True) ==> not a error "Redundant if" = (if a then t else (if b then t else f)) ==> if a || b then t else f@@ -127,6 +140,12 @@ warn  "Use if" = case a of {False -> f; True -> t} ==> if a then t else f warn  "Use if" = case a of {True -> t; _ -> f} ==> if a then t else f warn  "Use if" = case a of {False -> f; _ -> t} ==> if a then t else f+warn  "Redundant if" = (if c then (True, x) else (False, x)) ==> (c, x) where note = "reduces strictness"+warn  "Redundant if" = (if c then (False, x) else (True, x)) ==> (not c, x) where note = "reduces strictness"+warn = or [x,y]  ==> x || y+warn = or [x,y,z]  ==> x || y || z+warn = and [x,y]  ==> x && y+warn = and [x,y,z]  ==> x && y && z  -- ARROW @@ -137,6 +156,8 @@ warn  = (\x -> (f x, g x)) ==> f Control.Arrow.&&& g where _ = notIn x [f,g] warn  = (\(x,y) -> (f x,y)) ==> Control.Arrow.first f where _ = notIn [x,y] f warn  = (\(x,y) -> (x,f y)) ==> Control.Arrow.second f where _ = notIn [x,y] f+warn  = (f (fst x), g (snd x)) ==> (f Control.Arrow.*** g) x+warn "Redundant pair" = (fst x, snd x) ==>  x  -- FUNCTOR @@ -189,10 +210,18 @@ error = not (isJust x) ==> isNothing x error = maybe [] (:[]) ==> maybeToList error = catMaybes (map f x) ==> mapMaybe f x+warn  = (case x of Nothing -> y; Just a -> a)  ==> fromMaybe y x+error = (if isNothing x then y else f (fromJust x)) ==> maybe y f x+error = (if isJust x then f (fromJust x) else y) ==> maybe y f x+error = maybe Nothing (Just . f) ==> fmap f+warn  = map fromJust . filter isJust  ==>  Data.Maybe.catMaybes+error  = x == Nothing  ==>  isNothing x+error  = Nothing == x  ==>  isNothing x+error  = x /= Nothing  ==>  Data.Maybe.isJust x+error  = Nothing /= x  ==>  Data.Maybe.isJust x error = concatMap (maybeToList . f) ==> Data.Maybe.mapMaybe f error = concatMap maybeToList ==> catMaybes error = maybe n Just x ==> Control.Monad.mplus x n-warn  = (case x of Nothing -> y; Just a -> a)  ==> fromMaybe y x warn  = (case x of Just a -> a; Nothing -> y)  ==> fromMaybe y x error = (if isNothing x then y else fromJust x) ==> fromMaybe y x error = (if isJust x then fromJust x else y) ==> fromMaybe y x@@ -226,6 +255,7 @@ 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  -- EXCEPTION @@ -273,6 +303,9 @@ error "Evaluate" = x / 1 ==> x error "Evaluate" = concat [a] ==> a error "Evaluate" = concat [] ==> []+error "Evaluate" = zip [] [] ==> []+error "Evaluate" = id x ==> x+error "Evaluate" = const x y ==> x  -- COMPLEX 
hlint.cabal view
@@ -1,7 +1,7 @@ cabal-version:      >= 1.6 build-type:         Simple name:               hlint-version:            1.8.13+version:            1.8.14 -- license is GPL v2 only license:            GPL license-file:       LICENSE
src/HSE/Bracket.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE PatternGuards, TypeSynonymInstances #-}+{-# LANGUAGE PatternGuards, TypeSynonymInstances, FlexibleInstances #-}  module HSE.Bracket where