[Haskell-cafe] Alternative name for return

Adam Gundry adam.gundry at strath.ac.uk
Tue Aug 6 10:46:48 CEST 2013


Hi,

On 06/08/13 06:14, J. Stutterheim wrote:
> Suppose we now have the opportunity to change the name of the
> `return` function in Monad, what would be a "better"  name for it?
> (for some definition of better)

Rather than proposing a different name, I'm going to challenge the
premise of your question. Perhaps it would be better if `return` had no
name at all. Consider the following:

    return f `ap` s `ap` t

    f <$> s <*> t

    do { sv <- s
       ; tv <- t
       ; return (f sv tv) }

These are all different ways of spelling

    f s t

plus the necessary applicative or monadic bureaucracy. But why couldn't
we write just the plain application, and let the type system deal with
the plumbing of effects?

I realise that this may be too open a research area for your project...


> N.B. I am _not_ proposing that we actually change the name of
> `return`. I do currently have the opportunity to pick names for
> common functions in a non-Haskell related project, so I was wondering
> if there perhaps is a better name for `return`.

I don't think the choice of name matters. I do think it should be short.
Preferably invisible.

Adam




More information about the Haskell-Cafe mailing list