packages feed

hlint 1.9.35 → 1.9.36

raw patch · 10 files changed

+22/−31 lines, 10 filesdep ~haskell-src-extsPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: haskell-src-exts

API changes (from Hackage documentation)

Files

CHANGES.txt view
@@ -1,5 +1,8 @@ Changelog for HLint +1.9.36+    Require haskell-src-exts-1.18+    #249, suggest avoiding elem on singletons 1.9.35     #245, fix parse error reports     #243, update hlint.ghci to work with modern GHC
data/Default.hs view
@@ -162,6 +162,8 @@ warn = findIndices (a ==) ==> elemIndices a warn = findIndices (== a) ==> elemIndices a warn = lookup b (zip l [0..]) ==> elemIndex b l+hint = elem x [y] ==> x == y where note = ValidInstance "Eq" a+hint = notElem x [y] ==> x /= y where note = ValidInstance "Eq" a hint "Length always non-negative" = length x >= 0 ==> True hint "Use null" = length x > 0 ==> not (null x) where note = IncreasesLaziness hint "Use null" = length x >= 1 ==> not (null x) where note = IncreasesLaziness
hlint.cabal view
@@ -1,7 +1,7 @@ cabal-version:      >= 1.8 build-type:         Simple name:               hlint-version:            1.9.35+version:            1.9.36 license:            BSD3 license-file:       LICENSE category:           Development@@ -49,7 +49,7 @@         transformers,         cpphs >= 1.20.1,         cmdargs >= 0.10,-        haskell-src-exts >= 1.17 && < 1.18,+        haskell-src-exts >= 1.18 && < 1.19,         uniplate >= 1.5,         ansi-terminal >= 0.6.2,         extra >= 1.4.9,
src/HSE/All.hs view
@@ -42,6 +42,7 @@ parseFlagsNoLocations x = x{cppFlags = case cppFlags x of Cpphs y -> Cpphs $ f y; y -> y}     where f x = x{boolopts = (boolopts x){locations=False}} +-- | Given some fixities, add them to the existing fixities in 'ParseFlags'. parseFlagsAddFixities :: [Fixity] -> ParseFlags -> ParseFlags parseFlagsAddFixities fx x = x{hseFlags=hse{fixities = Just $ fx ++ fromMaybe [] (fixities hse)}}     where hse = hseFlags x@@ -127,8 +128,8 @@         ask = askFixity fixs          f o@(InfixApp s1 (InfixApp s2 x op1 y) op2 z)-                | p1 == p2 && (a1 /= a2 || a1 == AssocNone) = o -- Ambiguous infix expression!-                | p1 > p2 || p1 == p2 && (a1 == AssocLeft || a2 == AssocNone) = o+                | p1 == p2 && (a1 /= a2 || isAssocNone a1) = o -- Ambiguous infix expression!+                | p1 > p2 || p1 == p2 && (isAssocLeft a1 || isAssocNone a2) = o                 | otherwise = InfixApp s1 x op1 (f $ InfixApp s1 y op2 z)             where                 (a1,p1) = ask op1@@ -136,7 +137,7 @@         f x = x  -askFixity :: [Fixity] -> QOp S -> (Assoc, Int)-askFixity xs = \k -> Map.findWithDefault (AssocLeft, 9) (fromNamed k) mp+askFixity :: [Fixity] -> QOp S -> (Assoc (), Int)+askFixity xs = \k -> Map.findWithDefault (AssocLeft (), 9) (fromNamed k) mp     where-        mp = Map.fromList [(s,(a,p)) | Fixity a p x <- xs, let s = fromNamed x, s /= ""]+        mp = Map.fromList [(s,(a,p)) | Fixity a p x <- xs, let s = fromNamed $ fmap (const an) x, s /= ""]
src/HSE/Match.hs view
@@ -9,7 +9,6 @@ import Data.Char import HSE.Type import HSE.Util-import qualified Language.Haskell.Exts as HSE_   class View a b where@@ -87,15 +86,6 @@     toNamed ":" = Special an $ Cons an     toNamed x = UnQual an $ toNamed x -instance Named HSE_.QName where-    fromNamed (HSE_.Special HSE_.Cons) = ":"-    fromNamed (HSE_.Special HSE_.UnitCon) = "()"-    fromNamed (HSE_.UnQual x) = fromNamed x-    fromNamed _ = ""--    toNamed ":" = HSE_.Special HSE_.Cons-    toNamed x = HSE_.UnQual $ toNamed x- instance Named (Name S) where     fromNamed (Ident _ x) = x     fromNamed (Symbol _ x) = x@@ -103,13 +93,6 @@     toNamed x | isSym x = Symbol an x               | otherwise = Ident an x -instance Named HSE_.Name where-    fromNamed (HSE_.Ident x) = x-    fromNamed (HSE_.Symbol x) = x--    toNamed x | isSym x = HSE_.Symbol x-              | otherwise = HSE_.Ident x- instance Named (ModuleName S) where     fromNamed (ModuleName _ x) = x     toNamed = ModuleName an@@ -153,7 +136,7 @@     fromNamed (TypeDecl _ name _) = fromNamed name     fromNamed (DataDecl _ _ _ name _ _) = fromNamed name     fromNamed (GDataDecl _ _ _ name _ _ _) = fromNamed name-    fromNamed (TypeFamDecl _ name _) = fromNamed name+    fromNamed (TypeFamDecl _ name _ _) = fromNamed name     fromNamed (DataFamDecl _ _ name _) = fromNamed name     fromNamed (ClassDecl _ _ name _ _) = fromNamed name     fromNamed (PatBind _ (PVar _ name) _ _) = fromNamed name
src/HSE/Type.hs view
@@ -3,8 +3,7 @@  -- Almost all from the Annotated module, but the fixity resolution from Annotated -- uses the unannotated Assoc enumeration, so export that instead-import Language.Haskell.Exts.Annotated as Export hiding (parse, loc, paren, Assoc(..))-import Language.Haskell.Exts as Export(Assoc(..))+import Language.Haskell.Exts as Export hiding (parse, loc, paren) import Data.Generics.Uniplate.Data as Export  type S = SrcSpanInfo
src/HSE/Util.hs view
@@ -7,7 +7,6 @@ import Data.Maybe import System.FilePath import HSE.Type-import Language.Haskell.Exts.Annotated.Simplify(sQName, sAssoc) import Prelude  @@ -150,6 +149,8 @@ isLexeme Lit{} = True isLexeme _ = False +isAssocLeft AssocLeft{} = True; isAssocLeft _ = False+isAssocNone AssocNone{} = True; isAssocNone _ = False  isWHNF :: Exp_ -> Bool isWHNF Con{} = True@@ -312,7 +313,7 @@ -- FIXITIES  getFixity :: Decl a -> [Fixity]-getFixity (InfixDecl sl a mp ops) = [Fixity (sAssoc a) (fromMaybe 9 mp) (sQName $ UnQual sl $ f op) | op <- ops]+getFixity (InfixDecl sl a mp ops) = [Fixity (void a) (fromMaybe 9 mp) (UnQual () $ void $ f op) | op <- ops]     where f (VarOp _ x) = x           f (ConOp _ x) = x getFixity _ = []
src/Hint/All.hs view
@@ -62,10 +62,11 @@ builtinHints :: [(String, Hint)] builtinHints = [(drop 4 $ show h, resolveHints [Left h]) | h <- [minBound .. maxBound]] --- | Transform a list of 'HintRule' into a 'Hint'.+-- | Transform a list of 'HintBuiltin' or 'HintRule' into a 'Hint'. resolveHints :: [Either HintBuiltin HintRule] -> Hint resolveHints xs = mconcat $ mempty{hintDecl=readMatch rights} : map builtin (nub lefts)     where (lefts,rights) = partitionEithers xs +-- | Transform a list of 'HintRule' into a 'Hint'. hintRules :: [HintRule] -> Hint hintRules = resolveHints . map Right
src/Hint/Pattern.hs view
@@ -5,7 +5,7 @@  <TEST> yes x y = if a then b else if c then d else e -- yes x y ; | a = b ; | c = d ; | otherwise = e-x `yes` y = if a then b else if c then d else e -- yes x y ; | a = b ; | c = d ; | otherwise = e+x `yes` y = if a then b else if c then d else e -- x `yes` y ; | a = b ; | c = d ; | otherwise = e no x y = if a then b else c -- foo b | c <- f b = c -- foo (f -> c) = c -- foo x y b z | c:cs <- f g b = c -- foo x y (f g -> c:cs) z = c
src/Language/Haskell/HLint2.hs view
@@ -69,6 +69,7 @@ autoSettings :: IO (ParseFlags, [Classify], Hint) autoSettings = getHLintDataDir >>= autoSettings' +-- | Like 'autoSettings' but with a custom data directory. autoSettings' :: FilePath -> IO (ParseFlags, [Classify], Hint) autoSettings' dataDir = do     (builtin, matches) <- first resolveBuiltin <$> findSettings dataDir (dataDir </> "HLint.hs") Nothing