proposal #4095: add Applicative instance for Either

Henning Thielemann lemming at
Tue May 25 13:19:00 EDT 2010

On Tue, 25 May 2010, Bas van Dijk wrote:

> +1 for this Applicative instance.
> I assume that when this instance is added to Control.Applicative, the
> one in Control.Monad.Trans.Error from transformers will be removed.
> On Tue, May 25, 2010 at 6:22 PM, Yitzchak Gale <gale at> wrote:
>> -1 for the orphan Monad instance with the silly
>> superclass constraint that this Applicative instance
>> is meant to extend
> I assume you are referring to:
> instance (Error e) => Monad (Either e) where
>    return        = Right
>    Left  l >>= _ = Left l
>    Right r >>= k = k r
>    fail msg      = Left (strMsg msg)
> defined in Control.Monad.Trans.Error from transformers or
> Control.Monad.Error from mtl.

I think the problem with this instance is that it is orphan. You get a 
conflict if you import both mtl and transformers. But I assume that it is 
not possible to add this instance to Prelude, since this may break Haskell 
98 programs. Maybe MTL could import that instance from Transformers in 
order to avoid duplicate definition.

More information about the Libraries mailing list