proposal #4095: add Applicative instance for Either

Ashley Yakeley ashley at
Wed May 26 06:42:18 EDT 2010

On 2010-05-25 05:41, 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.
> Deadline: 15th June 2010

I currently have my own implementations for these:

     instance Foldable Identity
     instance Traversable Identity
     instance Applicative Identity

     instance Foldable (Either p)
     instance Traversable (Either p)
     instance Applicative (Either p)

     instance Foldable ((,) p)
     instance Traversable ((,) p)

Do any of these others already exist?

Ashley Yakeley

More information about the Libraries mailing list