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

Bertram Felgenhauer bertram.felgenhauer at googlemail.com
Fri Sep 25 11:22:09 UTC 2015


David Feuer wrote:
> +1 on both the goal and the means of reaching it. That said, I suspect
> the claim that "This has a comparable impact to the AMP" may be overly
> optimistic.

I want to echo this concern. In fact, the most common way of fixing code
after the AMP proposal seems to have been to mechanically add instances

  instance Functor Foo where
    fmap = liftM

  instance Applicative Foo where
    pure = return
    (<*>) = ap

whenever the compiler complained about a missing Applicative instance for
a monad Foo. All those Applicative instances would have to be rewritten
under the MRP proposal, and that task is not purely mechanical, since it
involves moving existing code, so I'd say that the burden would be higher
than after the AMP proposal.

How many of those Applicative instances are there in hackage?

Cheers,

Bertram


More information about the Libraries mailing list