Skip to content

Commit

Permalink
build-depends: ghc-lib-parser-ex >= 9.8.0.1 (#1574)
Browse files Browse the repository at this point in the history
shayne-fletcher authored Feb 26, 2024
1 parent 8bd116c commit 5517216
Showing 5 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion hlint.cabal
Original file line number Diff line number Diff line change
@@ -90,7 +90,7 @@ library
build-depends:
ghc-lib-parser == 9.8.*
build-depends:
ghc-lib-parser-ex >= 9.8.0.0 && < 9.8.1
ghc-lib-parser-ex >= 9.8.0.1 && < 9.8.1

if flag(gpl)
build-depends: hscolour >= 1.21
Binary file added src/.DS_Store
Binary file not shown.
4 changes: 4 additions & 0 deletions src/Hint/Extensions.hs
Original file line number Diff line number Diff line change
@@ -428,6 +428,10 @@ used EmptyCase = hasS f
f _ = False
used KindSignatures = hasT (un :: HsKind GhcPs)
used BangPatterns = hasS isPBangPat ||^ hasS isStrictMatch
where
-- Todo: Fix typing bug in ghc-lib-parser-ex.
isStrictMatch :: HsMatchContext GhcPs -> Bool
isStrictMatch = \case FunRhs{mc_strictness=SrcStrict} -> True; _ -> False
used TemplateHaskell = hasS (not . isQuasiQuoteSplice) ||^ hasS isTypedSplice
used TemplateHaskellQuotes = hasS f
where
4 changes: 1 addition & 3 deletions src/Hint/Lambda.hs
Original file line number Diff line number Diff line change
@@ -123,6 +123,7 @@ import GHC.Types.Name.Occurrence
import GHC.Types.Name.Reader
import GHC.Types.SrcLoc
import Language.Haskell.GhclibParserEx.GHC.Hs.Expr (isTypeApp, isOpApp, isLambda, isQuasiQuoteExpr, isVar, isDol, strToVar)
import Language.Haskell.GhclibParserEx.GHC.Hs.Pat (isWildPat)
import Language.Haskell.GhclibParserEx.GHC.Utils.Outputable
import Language.Haskell.GhclibParserEx.GHC.Types.Name.Reader
import GHC.Util.Brackets (isAtom)
@@ -346,9 +347,6 @@ mkOrigPats funName pats = (zipWith munge vars pats', vars)
in (used, (True, p))
| otherwise = (mempty, (False, p))

isWildPat :: LPat GhcPs -> Bool
isWildPat = \case (L _ (WildPat _)) -> True; _ -> False

-- Replace the pattern with a variable pattern if the pattern doesn't contain wildcards.
munge :: String -> (Bool, LPat GhcPs) -> LPat GhcPs
munge _ (True, p) = p
2 changes: 1 addition & 1 deletion stack.yaml
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ packages:

extra-deps:
- ghc-lib-parser-9.8.1.20231009
- ghc-lib-parser-ex-9.8.0.0
- ghc-lib-parser-ex-9.8.0.1
# To test hlint against experimental builds of ghc-lib-parser-ex,
# modify extra-deps like this:
# - archive: /users/shayne/project/ghc-lib-parser-ex/ghc-lib-parser-ex-8.10.0.18.tar.gz

0 comments on commit 5517216

Please sign in to comment.