hlint 1.9.31 → 1.9.32
raw patch · 11 files changed
+37/−9 lines, 11 filesdep ~cpphsPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: cpphs
API changes (from Hackage documentation)
Files
- CHANGES.txt +5/−0
- README.md +1/−1
- data/Default.hs +9/−0
- hlint.cabal +2/−2
- src/HSE/Bracket.hs +4/−1
- src/HSE/Match.hs +5/−1
- src/HSE/Util.hs +1/−1
- src/Hint/Bracket.hs +4/−0
- src/Hint/Match.hs +4/−1
- src/Main.hs +1/−1
- src/Refact.hs +1/−1
CHANGES.txt view
@@ -1,5 +1,10 @@ Changelog for HLint +1.9.32+ #53, require cpphs-1.20.1, has important fixes+ #224, treat select $ specially, as per esqueleto conventions+ #231, don't modify qualification on substitutions+ #229, add void/mapM_/forM_ hints 1.9.31 #222, don't suggest removing ~ if the Strict extension is on 1.9.30
README.md view
@@ -209,7 +209,7 @@ warn = concat (map f x) ==> concatMap f x -The line can be read as replace `concat (map f x)` with `concatMap f x`. All single-letter variables are treated as substitution parameters. For examples of more complex hints see the supplied hints file. In general, hints should not be given in point free style, as this reduces the power of the matching. Hints may start with `error`, `warn` or `suggest` to denote how severe they are by default. In addition, `hint` is a synonym for `suggest`. If you come up with interesting hints, please submit them for inclusion.+This line can be read as replace `concat (map f x)` with `concatMap f x`. All single-letter variables are treated as substitution parameters. For examples of more complex hints see the supplied hints file. This hint will automatically match `concat . map f` and `concat $ map f x`, so there is no need to give eta-reduced variants of the hints. Hints may start with `error`, `warn` or `suggest` to denote how severe they are by default. In addition, `hint` is a synonym for `suggest`. If you come up with interesting hints, please submit them for inclusion. You can search for possible hints to add from a source file with the `--find` flag, for example:
data/Default.hs view
@@ -328,6 +328,12 @@ warn = a >> forever a ==> forever a where _ = noQuickCheck hint = liftM2 id ==> ap where _ = noQuickCheck warn = mapM (uncurry f) (zip l m) ==> zipWithM f l m where _ = noQuickCheck+warn = mapM_ (void . f) ==> mapM_ f+warn = mapM_ (void f) ==> mapM_ f+warn = forM_ x (void . f) ==> forM_ x f+warn = forM_ x (void f) ==> forM_ x f+warn = void (mapM f x) ==> mapM_ f x+warn = void (forM x f) ==> forM_ x f -- STATE MONAD @@ -724,5 +730,8 @@ main = DTL.concat $ map (`DTL.snoc` '-') [DTL.pack "one", DTL.pack "two", DTL.pack "three"] import Text.Blaze.Html5.Attributes as A \ main = A.id (stringValue id')+import Prelude((==)) \+import qualified Prelude as P \+main = P.length xs == 0 -- P.null xs </TEST> -}
hlint.cabal view
@@ -1,7 +1,7 @@ cabal-version: >= 1.8 build-type: Simple name: hlint-version: 1.9.31+version: 1.9.32 license: BSD3 license-file: LICENSE category: Development@@ -47,7 +47,7 @@ build-depends: base == 4.*, process, filepath, directory, containers, transformers,- cpphs >= 1.18.1,+ cpphs >= 1.20.1, cmdargs >= 0.10, haskell-src-exts >= 1.17 && < 1.18, uniplate >= 1.5,
src/HSE/Bracket.hs view
@@ -1,6 +1,9 @@ {-# LANGUAGE PatternGuards, TypeSynonymInstances, FlexibleInstances #-} -module HSE.Bracket where+module HSE.Bracket(+ Brackets(..),+ paren, transformBracket, rebracket1, appsBracket+ ) where import HSE.Type import HSE.Util
src/HSE/Match.hs view
@@ -1,6 +1,10 @@ {-# LANGUAGE ViewPatterns, MultiParamTypeClasses, FlexibleInstances, TypeSynonymInstances #-} -module HSE.Match where+module HSE.Match(+ View(..), Named(..),+ (~=), isSym,+ App2(..), PVar_(..), Var_(..), PApp_(..)+ ) where import Data.Char import HSE.Type
src/HSE/Util.hs view
@@ -1,6 +1,6 @@ {-# LANGUAGE FlexibleContexts #-} -module HSE.Util where+module HSE.Util(module HSE.Util) where import Control.Monad import Data.List
src/Hint/Bracket.hs view
@@ -56,6 +56,9 @@ -- annotations main = 1; {-# ANN module ("HLint: ignore Use camelCase" :: String) #-} main = 1; {-# ANN module (1 + (2)) #-} -- 2++-- special cases (from esqueleto, see #224)+main = operate <$> (select $ from $ \user -> return $ user ^. UserEmail) </TEST> -} @@ -134,6 +137,7 @@ ++ [suggest "Move brackets to avoid $" x (t y) [r] |(t, e@(Paren _ (InfixApp _ a1 op1 a2))) <- splitInfix x ,opExp op1 ~= "$", isVar a1 || isApp a1 || isParen a1, not $ isAtom a2+ ,not $ a1 ~= "select" -- special case for esqueleto, see #224 , let y = App an a1 (Paren an a2) , let r = Replace Expr (toSS e) [("a", toSS a1), ("b", toSS a2)] "a (b)" ]
src/Hint/Match.hs view
@@ -104,9 +104,11 @@ let nm a b = scopeMatch (hintRuleScope,a) (s,b) u <- unifyExp nm True hintRuleLHS x u <- check u+ -- need to check free vars before unqualification, but after subst (with e)+ -- need to unqualify before substitution (with res) let e = subst u hintRuleRHS template = substT u hintRuleRHS- let res = addBracket parent $ unqualify hintRuleScope s u $ performEval e+ res = addBracket parent $ performEval $ subst u $ unqualify hintRuleScope s u hintRuleRHS guard $ (freeVars e Set.\\ Set.filter (not . isUnifyVar) (freeVars hintRuleRHS)) `Set.isSubsetOf` freeVars x -- check no unexpected new free variables@@ -301,6 +303,7 @@ where f (Qual _ (ModuleName _ [m]) x) | Just y <- fromNamed <$> lookup [m] subs = if null y then UnQual an x else Qual an (ModuleName an y) x+ f x@(UnQual _ (Ident _ s)) | isUnifyVar s = x f x = scopeMove (from,x) to
src/Main.hs view
@@ -1,5 +1,5 @@ -module Main where+module Main(main) where import Language.Haskell.HLint3 import Control.Monad
src/Refact.hs view
@@ -1,4 +1,4 @@-module Refact where+module Refact(toRefactSrcSpan, toSS) where import qualified Refact.Types as R import HSE.All