[Haskell-beginners] can I use "pure" all the time instead of "return" now?

Theodore Lief Gannon tanuki at gmail.com
Sat May 14 22:04:21 UTC 2016


If/when Applicative Do drops, would using 'return' force monad semantics on
a do-block that could otherwise be applicative? That's the only thing that
comes to mind. Otherwise yeah, I've been using 'pure' exclusively for a
while.
On May 14, 2016 2:54 PM, "David Thomas" <davidleothomas at gmail.com> wrote:

> As I understand it, that's correct - you can use pure anywhere you'd
> have used return.
>
> On Sat, May 14, 2016 at 2:39 PM, Silent Leaf <silent.leaf0 at gmail.com>
> wrote:
> > 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!
> > _______________________________________________
> > Beginners mailing list
> > Beginners at haskell.org
> > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
> >
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20160514/348e3e25/attachment.html>


More information about the Beginners mailing list