proposal #4095: add Applicative instance for Either
lemming at henning-thielemann.de
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
More information about the Libraries