Skip to content

Commit

Permalink
chore: make hlint happy
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc Planard committed Mar 18, 2024
1 parent fb24a9c commit 5ea082a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Output.hs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ outputVague :: [Issue] -> String
outputVague i = (++ "\n") . intercalate "\n" $ uncurry showVague <$>
removeNoOccurences (count <$> occurenceList)
where
removeNoOccurences l = filter (\(_, y) -> y /= 0) l
removeNoOccurences = filter ((/=0) . snd)
count (x, _, _) = (x, length $ filter (== x) i)
occurenceList = [(x, y, 0 :: Int)| (x, y) <- issues]

Expand Down
2 changes: 1 addition & 1 deletion src/Parser.hs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ inspectMatch _ _ = mempty
inspectDecl :: Monoid a => (Node -> a) -> Decl SrcSpanInfo -> a
inspectDecl f d@(PatBind _ (PVar _ _) a _) = f (NDec d) <> inspectRhs f a
inspectDecl f d@(FunBind _ lst) = f (NDec d) <> foldMap (inspectMatch f) lst
inspectDecl f d = f (NDec d) <> mempty
inspectDecl f d = f (NDec d)

explore :: Monoid a => (Node -> a) -> [Decl SrcSpanInfo] -> [a]
explore f = map (inspectDecl f)
Expand Down
4 changes: 2 additions & 2 deletions src/rules/BadGuard.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ check presult = join $ explore checkGuard (decls presult)
where checkGuard (NDec (FunBind _ m)) =
fold $ zipWith toWarns (vars m) (matchs m)
checkGuard _ = []
vars match = map (inspectMatch collectVar) match
matchs match = map (inspectMatch collectGuards) match
vars = map (inspectMatch collectVar)
matchs = map (inspectMatch collectGuards)
collectVar (NPat (PVar _ idt)) = [getIdent idt]
collectVar _ = []
collectGuards (NSmt (Qualifier _ expr)) = [expr]
Expand Down
3 changes: 2 additions & 1 deletion src/rules/NoSig.hs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ check presult = join $ map genWarn binds
where sigsAndBinds = explore collectSigs (decls presult)
sigs = foldMap fst sigsAndBinds
binds = foldMap getBind sigsAndBinds
getBind (_,l) = if null l then [] else [head l]
getBind (_, []) = []
getBind (_, x:_) = [x]
genWarn (fct, ssi) | fct `notElem` sigs =
[makeWarn NoSig (getLoc ssi) $ StringArg fct]
genWarn _ = []
Expand Down

0 comments on commit 5ea082a

Please sign in to comment.