hlint 1.8.47 → 1.8.48
raw patch · 5 files changed
+21/−3 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- data/Default.hs +1/−1
- hlint.cabal +1/−1
- src/Hint/Bracket.hs +12/−1
- src/Hint/Lambda.hs +4/−0
- src/Hint/Util.hs +3/−0
data/Default.hs view
@@ -494,7 +494,7 @@ 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+-- 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.47+version: 1.8.48 license: BSD3 license-file: LICENSE category: Development
src/Hint/Bracket.hs view
@@ -50,6 +50,10 @@ -- backup fixity resolution main = do a += b . c; return $ a . b++-- annotations+main = 1; {-# ANN module ("HLint: ignore Use camelCase" :: String) #-}+main = 1; {-# ANN module (1 + (2)) #-} -- 2 </TEST> -} @@ -61,10 +65,17 @@ bracketHint :: DeclHint bracketHint _ _ x =- concatMap (\x -> bracket True x ++ dollar x) (childrenBi x :: [Exp_]) +++ concatMap (\x -> bracket True x ++ dollar x) (childrenBi (descendBi annotations x) :: [Exp_]) ++ 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+ annotations = descendBi $ \x -> case (x :: Exp_) of+ Paren _ x -> x+ x -> x bracket :: (Annotated a, Uniplate (a S), ExactP a, Pretty (a S), Brackets (a S)) => Bool -> a S -> [Idea]
src/Hint/Lambda.hs view
@@ -17,7 +17,9 @@ \x -> op x y ==> (`op` y) -- insert section \x -> y + x ==> (y +) -- insert section \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@@ -59,6 +61,8 @@ foo a b c = bar (flux ++ quux) c where flux = a -- foo a b = bar (flux ++ quux) foo a b c = bar (flux ++ quux) c where flux = c yes = foo (\x -> Just x) -- @Error Just+foo = bar (\x -> (x `f`)) -- f+baz = bar (\x -> (x +)) -- (+) </TEST> -}
src/Hint/Util.hs view
@@ -48,6 +48,9 @@ factor (Paren _ y@App{}) = factor y factor _ = Nothing +-- \x -> (x +) ==> (+)+niceLambda [x] (LeftSection _ (view -> Var_ x1) op) | x == x1 = opExp op+ -- base case niceLambda ps x = Lambda an (map toNamed ps) x