Follow HLint suggestion: use <$> - #12015
Conversation
032d9c5 to
c0f2629
Compare
c0f2629 to
d6f48d1
Compare
d6f48d1 to
388296c
Compare
1834ec6 to
91914a5
Compare
e241b16 to
2a34fc8
Compare
Co-Authored-By: ˌbodʲɪˈɡrʲim <andrew.lelechenko@gmail.com>
580079b to
37f6728
Compare
| runShrinker $ | ||
| pure SourceRepositoryPackage | ||
| <*> shrinker srpType | ||
| (SourceRepositoryPackage <$> shrinker srpType) |
There was a problem hiding this comment.
Is the bracket required?
| s <- parsec | ||
| exc <- exception | ||
| return $ ELicense s exc | ||
| ELicense s <$> exception |
There was a problem hiding this comment.
If we are in the business of rewriting monadic parsers in applicative style, let's not stop halfway through. Could we define simple = ELicense <$> parsec <$> exception?
| P.spaces | ||
| t <- term | ||
| return (intersectVersionRanges f t) | ||
| intersectVersionRanges f <$> term |
There was a problem hiding this comment.
Same as above, it feels confusing to switch from monadic parser style to applicative in the middle of do-block. We can rewrite this in its entirety as an applicative expression.
| _ <- P.char '=' | ||
| abi <- parsec | ||
| return (AbiDependency uid abi) | ||
| AbiDependency uid <$> parsec |
There was a problem hiding this comment.
parsec = AbiDependency <$> parsec <* P.char '=' <*> parsec.
| _ <- P.char ':' | ||
| mod_name <- parsec | ||
| return (Module uid mod_name) | ||
| Module uid <$> parsec |
There was a problem hiding this comment.
Same as above, let's rewrite the entire do-block in applicative style.
| a <- getWord64le | ||
| b <- getWord64le | ||
| return (Fingerprint a b) | ||
| Fingerprint a <$> getWord64le |
There was a problem hiding this comment.
Same, binaryGetMD5 = Fingerprint <$> getWord64le <*> getWord64le
| _ <- P.char '-' | ||
| os <- parsec | ||
| return (Platform arch os) | ||
| Platform arch <$> parsec |
See #9110. Discharges and no longer ignores HLint's "use <$>" suggestion so that this will be suggested by our CI linting.
A similar suggestion, "use fmap", was merged earlier, with #11742.
There were some cascading suggestions that I tackled individually. I'll squash commits before applying the merge label if this pull request is approved.