Skip to content

Commit

Permalink
Avoid unnecessary zip since it walks the list twice and breaks fusion
Browse files Browse the repository at this point in the history
  • Loading branch information
josephcsible committed Dec 4, 2020
1 parent 8702b19 commit 100de33
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions data/hlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,9 @@
- hint: {lhs: 0 /= length x, rhs: not (null x), note: IncreasesLaziness, name: Use null}
- hint: {lhs: "\\x -> [x]", rhs: "(:[])", name: "Use :"}
- hint: {lhs: map f (zip x y), rhs: zipWith (curry f) x y, side: not (isApp f)}
- warn: {lhs: zip x (map f x), rhs: "map (\\y -> (y, f y)) x", note: IncreasesLaziness}
- warn: {lhs: zip (map f x) x, rhs: "map (\\y -> (f y, y)) x", note: IncreasesLaziness}
- warn: {lhs: zip x <$> traverse f x, rhs: "traverse (\\y -> (,) y <$> f y) x", note: IncreasesLaziness}
- hint: {lhs: "map f (fromMaybe [] x)", rhs: "maybe [] (map f) x"}
- warn: {lhs: not (elem x y), rhs: notElem x y}
- hint: {lhs: foldr f z (map g x), rhs: foldr (f . g) z x, name: Fuse foldr/map}
Expand Down

0 comments on commit 100de33

Please sign in to comment.