proposal #4095: add Applicative instance for Either

Henning Thielemann lemming at
Tue May 25 09:15:57 EDT 2010

On Tue, 25 May 2010, Ross Paterson wrote:

> The proposal is to add this instance to Control.Applicative:
>    instance Applicative (Either e) where
>        pure          = Right
>        Left  e <*> _ = Left e
>        Right f <*> r = fmap f r
> This is not the only possible instance for Either, but this one is
> compatible with the usual Monad instance.

What other sensible instances are there?

Nevertheless I think, since the Monad instance for Either exists, there is 
no choice other than make the Applicative instance compatible to it and it 
is better than no instance at all, in order to prevent orphan instances in 
user modules.

More information about the Libraries mailing list