Skip to content

Commit

Permalink
Merge pull request #1540 from MatthijsBlom/correct-functor-law-hint
Browse files Browse the repository at this point in the history
Correct Functor law hint
  • Loading branch information
ndmitchell authored Jan 14, 2024
2 parents 551fe9a + a30f516 commit a7df70f
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 @@ -7199,7 +7199,7 @@ fmap (f . g) x
<td>
LHS:
<code>
f <$> g <$> x
f <$> (g <$> x)
</code>
<br>
RHS:
Expand Down Expand Up @@ -7275,6 +7275,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 a7df70f

Please sign in to comment.