[Haskell-cafe] Alternative name for return
J. Stutterheim
j.stutterheim at me.com
Tue Aug 6 11:28:40 CEST 2013
That argument makes sense, although I find it a bit counter-intuitive still. If I saw the function `pure` for the first time, my first impression (however wrong it may be) would be that it takes a pure value (regardless of context) and does something with it. Applying `pure` to an IO operation goes against that intuition.
Looking at the type of `return :: a -> m a", there are several slightly more intuitive (to me) options in this discussion already:
lift: the value `a` is lifted into the monad `m`
pack: the value `a` is packed into the monad `m`
wrap: the value `a` is wrapped in the monad `m`
inject: the value `a` is injected into the monad `m`
promote: the value `a` is promoted to a monad `m a`
On 6 Aug 2013, at 10:16, Tobias Dammers <tdammers at gmail.com> wrote:
> It is a pure value in the context of the outer monad (the one you wrap it in). I'd say pure is still appropriate.
>
> On Aug 6, 2013 10:14 AM, "Tom Ellis" <tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk> wrote:
> On Tue, Aug 06, 2013 at 10:03:04AM +0200, J. Stutterheim wrote:
> > `putStrLn "Hi"` is not a pure value...
>
> Why not?
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 495 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130806/324bb540/attachment.pgp>
More information about the Haskell-Cafe
mailing list