[Haskell-beginners] can I use "pure" all the time instead of "return" now?
Silent Leaf
silent.leaf0 at gmail.com
Sat May 14 21:39:36 UTC 2016
All in the title; Since the change in GHC, 7.10 i think, where all Monad
instances had to have Applicative instances too, in theory all monads must
have a pure method that should be identical to return, right?
My subjectively superficial reason for preferring pure (and caring about
the issue in the first place) is twofold: shorter (i know, i know, still
the shorter, the quicker to read and then understand in the code) and,
mostly, less semantically-awkward --honestly the name "stains" the
functional semantics in Monadic code, in my opinion, but that's just
personal. (For those who know, it feels like the "new" operator in JS (OO
class-instanciation semantical imitation))
Of course now I'm perfectly used to, have no trouble seeing it for what it
is all the time, not mixing it up with some imperative-like "return"
concept.
Yet i don't really like it much at all, so I wanted to know to which extent
it is safe to always use pure even in explicitly Monadic contexts.
Thankx in advance!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20160514/811a8f29/attachment.html>
More information about the Beginners
mailing list