Skip to content

Commit

Permalink
HLint: add rule foldr (:) [] --> toList
Browse files Browse the repository at this point in the history
  • Loading branch information
ulidtko authored and tomjaguarpaw committed Sep 2, 2024
1 parent 49f415c commit c4f4a90
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .hlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,10 @@
- warn:
lhs: "getAlt . foldMap (Alt . f)"
rhs: asumMap
- hint:
lhs: "foldr (:) []"
note: "Use 'toList'"
rhs: toList
- hint:
lhs: "foldr (\\x acc -> f x <|> acc) empty"
note: "Use 'asumMap'"
Expand Down
1 change: 1 addition & 0 deletions hlint/hlint.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ in [ Rule.Arguments { arguments =

, warnSimple "getAlt (foldMap (Alt . f) xs)" "asumMap xs"
, warnSimple "getAlt . foldMap (Alt . f)" "asumMap"
, hintNote "foldr (:) []" "toList" "Use 'toList'"
, hintNote "foldr (\\x acc -> f x <|> acc) empty" "asumMap f" "Use 'asumMap'"
, hintNote "asum (map f xs)" "asumMap f xs" "Use 'asumMap'"

Expand Down

0 comments on commit c4f4a90

Please sign in to comment.