[Haskell-cafe] Alternative name for return
c.sternagel at gmail.com
Tue Aug 6 10:23:04 CEST 2013
On 08/06/2013 04:30 PM, J. Stutterheim wrote:
> Thanks Chris. Yes, I like lift as well, because I find it a rather intuitive name. Unfortunately, as you say, it is already a commonly used name as well, which might make it slightly confusing.
> When I hear `unit` I immediately think about generic programming, not so much about monads. Can you perhaps explain the intuition behind `unit` as an alternative to `return` in the context of monads?
Probably because of the monad laws, where `return` is a "unit" (in the
mathematical sense) for the `bind` operation. - chris
> - Jurriën
> On 6 Aug 2013, at 07:32, Christian Sternagel <c.sternagel at gmail.com> wrote:
>> Dear Jurriën.
>> personally, I like "lift" (which is of course already occupied in Haskell), since an arbitrary value is "lifted" into a monad. (The literature sometimes uses "unit".)
>> On 08/06/2013 02:14 PM, J. Stutterheim wrote:
>>> Dear Cafe,
>>> 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)
>>> 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`.
>>> - Jurriën
>>> Haskell-Cafe mailing list
>>> Haskell-Cafe at haskell.org
>> Haskell-Cafe mailing list
>> Haskell-Cafe at haskell.org
More information about the Haskell-Cafe