proposal #4095: add Applicative instance for Either

Yitzchak Gale gale at sefer.org
Tue Jun 1 11:14:05 EDT 2010


Iavor Diatchki wrote:
> Are there any uses of this instance that are not related to error
> handing?

Yes, in fact, exception handling is a minor corner case.

The Either Monad/Applicative provides multi-level exit
from nested complex computations. That effect is
provided in a much more complicated way by callCC
in CPS, but the straightforward way is with Either.

Unfortunately, Either is not commonly used in that
general way in Haskell because it was hijacked early on
by the very unfortunate orphan instance in Control.Monad.Error
which imposes a gratuitous superclass condition.

Regards,
Yitz


More information about the Libraries mailing list