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

David Luposchainsky dluposchainsky at googlemail.com
Thu Oct 1 19:46:44 UTC 2015


On 01.10.2015 19:03, Henning Thielemann wrote:
> Over the past years
> several redundant methods where added to type classes in order to allow for
> optimized implementations.

There's an important difference: *> is redundant, but not superflous. return on
the other hand offers zero new functionality.

> At least, leaving 'return' does not hurt much.

I guess that's a matter of what we want the standard to be. I think it should be
the guideline to "a good Haskell" that compilers should aim to implement. If it
takes GHC a couple of releases to become Report compliant then that's something
I'm OK with.

> My practical concern is that the change will break every current Monad instance
> for no benefit and I would not be able to write code that works for current and
> past GHC versions.

Monad instances written before 7.8. As of 7.10, return is not part of the minimal
definition of Monad anymore, so starting with the current release, you're already
able to write future-proof instances. That said, the issue with GHC < 7.10
remains of course.

> If you are very keen to remove 'return' I would ask you to wait some more release
> cycles of GHC.

Of course! The next release will do nothing but issue (a disable-able) warning
when an instance implements return. Beyond that, who knows, but it surely won't
be breaking half of `cabal build` because of impatience.

Greetings,
David/quchen



More information about the Libraries mailing list