Monad of no `return` Proposal (MRP): Moving `return` out of `Monad`

Bardur Arantsson spam at
Fri Sep 25 05:23:43 UTC 2015

On 09/24/2015 11:43 PM, Herbert Valerio Riedel wrote:
> Hello *,

+1, just a minor... nitpick, I guess:

>     -- | Legacy alias for 'pure' 
>     return :: Applicative f => a -> f a
>     return = pure

I propse to remove the "Legacy" designation (see below for reasoning).
There should probably also be some reference to the Applicative type
class, so I'd propose a wording more like:

    Alias for 'pure' in the 'Applicative' type class.

Reasoning: I happen to rather like "return" for purely pedagogical
purposes since it lets you pretend (as a sufficient-for-beginners
approximation) that code in the do-notation in IO is imperative code and
"return" is the usual name for what it does in that context. I think
that has a certain value, but "Legacy" is quite off-putting.

Presumably we aren't talking about removing "return" itself any time in
the next, say, 5-10 years...? (That _would_ break a hell of a lot of code.)

Anyway, just a (very) minor nitpick to consider.

> However, given that `return` is exported by `Prelude` and the examples
> above are rather artificial, we don't expect this to be a major source
> of breakage in the case of `return`. In fact, a heuristic grep[5] over
> Hackage source-code revealed only 21 packages affected.

How many reverse dependencies do those packages have? (I.e. how many
packages are going to require at least a version bump.)


More information about the Libraries mailing list