5 ms·
To be fair, "<$>" is a synonym for "fmap", so "fmap capitalise readStrLn" is the go-to alternative. The "do" example is not only more verbose, but less general
by chriswarbo 10y ago
To be fair, "<$>" is a synonym for "fmap", so "fmap capitalise readStrLn" is the go-to alternative.
The "do" example is not only more verbose, but less general (it only applies to monads rather than all functors), and relies on special syntax (despite its awkwardness, "<$>" is still just a function call).
You could also do "capitalise `fmap` readStrLn", which is kind of intermediate between the two :)
- Iceland_jack 10y ago`ApplicativeDo`[1] do-notation works with Functors [1] https://downloads.haskell.org/~ghc/master/users-guide/glasgow_exts.html#ghc-flag--XApplicativeDo https://downloads.haskell.org/~ghc/master/users-guide/glasgo...