hlint 1.6.8 → 1.6.9
raw patch · 3 files changed
+14/−7 lines, 3 files
Files
- hlint.cabal +1/−1
- src/Hint/Extensions.hs +8/−4
- src/Hint/Lambda.hs +5/−2
hlint.cabal view
@@ -1,7 +1,7 @@ cabal-version: >= 1.6 build-type: Simple name: hlint-version: 1.6.8+version: 1.6.9 license: GPL license-file: LICENSE category: Development
src/Hint/Extensions.hs view
@@ -12,6 +12,8 @@ $(deriveNewtypes typeInfo) {-# LANGUAGE TemplateHaskell #-} \ main = foo ''Bar+{-# LANGUAGE PatternGuards #-} \+test = case x of _ | y <- z -> w </TEST> -} @@ -50,10 +52,12 @@ f _ = False used ForeignFunctionInterface = hasT (un :: CallConv) used Generics = has isPExplTypeArg-used PatternGuards = has f- where f (GuardedRhs _ [] _) = False- f (GuardedRhs _ [Qualifier _] _) = False- f _ = True+used PatternGuards = has f1 & has f2+ where f1 (GuardedRhs _ xs _) = g xs+ f2 (GuardedAlt _ xs _) = g xs+ g [] = False+ g [Qualifier _] = False+ g _ = True used StandaloneDeriving = has isDerivDecl used PatternSignatures = has isPatTypeSig used RecordWildCards = has isPFieldWildcard
src/Hint/Lambda.hs view
@@ -31,6 +31,8 @@ test = foo (\x -> y == x) -- (y ==) test = foo (\x -> x == g y) -- (== g y) test = foo (\x -> g x == x)+cp i = show (i - 1)+cp i = show (i + 1) </TEST> -} @@ -96,8 +98,9 @@ etaReduce :: Name -> Exp -> Maybe Exp etaReduce x (App y (Var (UnQual z))) | x == z && x `notElem` universeBi y = Just y-etaReduce x (InfixApp y op z) | var x == y && x `notElem` universeBi z = Just $ RightSection op z- | var x == z && x `notElem` universeBi y = Just $ LeftSection y op+etaReduce x (InfixApp y op z) | goodOp && var x == y && x `notElem` universeBi z = Just $ RightSection op z+ | goodOp && var x == z && x `notElem` universeBi y = Just $ LeftSection y op+ where goodOp = op `notElem` map (QVarOp . UnQual . Symbol . return) "+-" etaReduce x (App y z) | not (uglyEta y z) && x `notElem` universeBi y = do z2 <- etaReduce x z return $ InfixApp y (QVarOp $ UnQual $ Symbol ".") z2