hlint 1.8.50 → 1.8.51
raw patch · 5 files changed
+25/−20 lines, 5 filesdep ~haskell-src-extsPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: haskell-src-exts
API changes (from Hackage documentation)
Files
- hlint.cabal +2/−2
- src/CmdLine.hs +1/−1
- src/Hint/Extensions.hs +19/−14
- src/Proof.hs +2/−2
- src/Util.hs +1/−1
hlint.cabal view
@@ -1,7 +1,7 @@ cabal-version: >= 1.6 build-type: Simple name: hlint-version: 1.8.50+version: 1.8.51 license: BSD3 license-file: LICENSE category: Development@@ -41,7 +41,7 @@ transformers >= 0.0, hscolour >= 1.17, cpphs >= 1.11,- haskell-src-exts >= 1.11,+ haskell-src-exts >= 1.14 && < 1.15, uniplate >= 1.5 hs-source-dirs: src
src/CmdLine.hs view
@@ -133,7 +133,7 @@ ,defines = [(a,drop 1 b) | Define x <- opt, let (a,b) = break (== '=') x] } let cpp | SimpleCpp `elem` opt = CppSimple -- must be first, so can disable CPP- | CPP `elem` languages = Cpphs cpphs+ | EnableExtension CPP `elem` languages = Cpphs cpphs | otherwise = NoCpp encoding <- newEncoding $ last $ "" : [x | Encoding x <- opt]
src/Hint/Extensions.hs view
@@ -4,6 +4,8 @@ <TEST> {-# LANGUAGE Arrows #-} \ f = id --+{-# LANGUAGE TotallyUnknown #-} \+f = id {-# LANGUAGE Foo, Generics, ParallelListComp, ImplicitParams #-} \ f = [(a,c) | a <- b | c <- d] -- {-# LANGUAGE Foo, ParallelListComp #-} {-# LANGUAGE EmptyDataDecls #-} \@@ -64,29 +66,33 @@ extensionsHint :: ModuHint extensionsHint _ x = [rawIdea Error "Unused LANGUAGE pragma" (toSrcLoc sl)- (prettyPrint o) (if null new then "" else prettyPrint $ LanguagePragma sl $ map (toNamed . showExt) new)+ (prettyPrint o) (if null new then "" else prettyPrint $ LanguagePragma sl $ map (toNamed . prettyExtension) new) (warnings old new) | not $ used TemplateHaskell x -- if TH is on, can use all other extensions programmatically , o@(LanguagePragma sl exts) <- modulePragmas x- , let old = map (classifyExtension . prettyPrint) exts+ , let old = map (parseExtension . prettyPrint) exts , let new = minimalExtensions x old , sort new /= sort old]- where- showExt (UnknownExtension x) = x- showExt x = show x minimalExtensions :: Module_ -> [Extension] -> [Extension] minimalExtensions x es = nub $ concatMap f es- where f e = [e | used e x]+ where f e = [e | usedExt e x] -- RecordWildCards implies DisambiguateRecordFields, but most people probably don't want it-warnings old new | RecordWildCards `elem` old && RecordWildCards `notElem` new = [Note "you may need to add DisambiguateRecordFields"]+warnings old new | wildcards `elem` old && wildcards `notElem` new = [Note "you may need to add DisambiguateRecordFields"]+ where wildcards = EnableExtension RecordWildCards warnings _ _ = [] -used :: Extension -> Module_ -> Bool+usedExt :: Extension -> Module_ -> Bool+usedExt (UnknownExtension "DeriveGeneric") = hasDerive False ["Generic","Generic1"]+usedExt (EnableExtension x) = used x+usedExt _ = const True+++used :: KnownExtension -> Module_ -> Bool used RecursiveDo = hasS isMDo used ParallelListComp = hasS isParComp used FunctionalDependencies = hasT (un :: FunDep S)@@ -118,10 +124,9 @@ used QuasiQuotes = hasS isQuasiQuote used ViewPatterns = hasS isPViewPat used DeriveDataTypeable = hasDerive True ["Data","Typeable"]-used (UnknownExtension "DeriveGeneric") = hasDerive False ["Generic","Generic1"]-used (UnknownExtension "DeriveFunctor") = hasDerive False ["Functor"]-used (UnknownExtension "DeriveFoldable") = hasDerive False ["Foldable"]-used (UnknownExtension "DeriveTraversable") = hasDerive False ["Traversable"]+used DeriveFunctor = hasDerive False ["Functor"]+used DeriveFoldable = hasDerive False ["Foldable"]+used DeriveTraversable = hasDerive False ["Traversable"] used GeneralizedNewtypeDeriving = not . null . filter (`notElem` special) . fst . derives where special = ["Read","Show","Data","Typeable"] -- these classes cannot use generalised deriving used Arrows = hasS f@@ -136,8 +141,8 @@ f _ = True -- for forwards compatibility, if things ever get added to the extension enumeration-used (UnknownExtension _) = const True-used x = used $ UnknownExtension $ show x+used x = usedExt $ UnknownExtension $ show x+ hasDerive :: Bool -> [String] -> Module_ -> Bool
src/Proof.hs view
@@ -161,7 +161,7 @@ exp (Var _ x) | Just x <- funs $ prettyPrint x = x exp (Con _ (Special _ (TupleCon _ _ i))) = "\\<langle>" ++ replicate (i-1) ',' ++ "\\<rangle>" exp (Con _ x) | Just x <- cons $ prettyPrint x = x- exp (Tuple _ xs) = "\\<langle>" ++ intercalate ", " (map exp xs) ++ "\\<rangle>"+ exp (Tuple _ _ xs) = "\\<langle>" ++ intercalate ", " (map exp xs) ++ "\\<rangle>" exp (If _ a b c) = "If " ++ exp a ++ " then " ++ exp b ++ " else " ++ exp c exp (Lambda _ xs y) = "\\<Lambda> " ++ unwords (map pat xs) ++ ". " ++ exp y exp (InfixApp _ x op y) | Just op <- ops $ prettyPrint op =@@ -173,7 +173,7 @@ exp x@(RightSection l op e) = let v = fresh x in exp $ Paren l $ Lambda l [toNamed v] $ InfixApp l (toNamed v) op e -- S3.5 exp x = prettyPrint x - pat (PTuple _ xs) = "\\<langle>" ++ intercalate ", " (map pat xs) ++ "\\<rangle>"+ pat (PTuple _ _ xs) = "\\<langle>" ++ intercalate ", " (map pat xs) ++ "\\<rangle>" pat x = prettyPrint x fresh x = head $ ("z":["v" ++ show i | i <- [1..]]) \\ vars x
src/Util.hs view
@@ -249,7 +249,7 @@ -- LANGUAGE.HASKELL.EXTS.EXTENSION defaultExtensions :: [Extension]-defaultExtensions = knownExtensions \\ badExtensions+defaultExtensions = [e | e@EnableExtension{} <- knownExtensions] \\ map EnableExtension badExtensions badExtensions = [Arrows -- steals proc