Skip to content

Commit

Permalink
Correct Functor law hint
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthijsBlom committed Sep 14, 2023
1 parent 2cb667e commit a30f516
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
3 changes: 2 additions & 1 deletion data/hlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -472,11 +472,12 @@
# FUNCTOR

- warn: {lhs: fmap f (fmap g x), rhs: fmap (f . g) x, name: Functor law}
- warn: {lhs: f <$> g <$> x, rhs: f . g <$> x, name: Functor law}
- warn: {lhs: f <$> (g <$> x), rhs: f . g <$> x, name: Functor law}
- warn: {lhs: x <&> g <&> f, rhs: x <&> f . g, name: Functor law}
- warn: {lhs: fmap id, rhs: id, name: Functor law}
- warn: {lhs: id <$> x, rhs: x, name: Functor law}
- warn: {lhs: x <&> id, rhs: x, name: Functor law}
- warn: {lhs: f <$> g <$> x, rhs: f . g <$> x}
- hint: {lhs: fmap f $ x, rhs: f <$> x, side: isApp x || isAtom x}
- hint: {lhs: \x -> a <$> b x, rhs: fmap a . b}
- hint: {lhs: \x -> b x <&> a, rhs: fmap a . b}
Expand Down
18 changes: 17 additions & 1 deletion hints.md
Original file line number Diff line number Diff line change
Expand Up @@ -7226,7 +7226,7 @@ fmap (f . g) x
<td>
LHS:
<code>
f <$> g <$> x
f <$> (g <$> x)
</code>
<br>
RHS:
Expand Down Expand Up @@ -7302,6 +7302,22 @@ x
<td>Warning</td>
</tr>
<tr>
<td>Redundant <$></td>
<td>
LHS:
<code>
f <$> g <$> x
</code>
<br>
RHS:
<code>
f . g <$> x
</code>
<br>
</td>
<td>Warning</td>
</tr>
<tr>
<td>Use <$></td>
<td>
LHS:
Expand Down

0 comments on commit a30f516

Please sign in to comment.