X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=Control%2FApplicative.hs;h=154b591288c4e21088e778c48f63ad4e34510254;hb=487b9d4571a847ee0273b4627aaa135c46a51b8d;hp=a2755ebbc3e3dc2eee746182750b223c6e593f0e;hpb=87d1ac62b8114727d8756a4c239992bff6c854ea;p=ghc-base.git diff --git a/Control/Applicative.hs b/Control/Applicative.hs index a2755eb..154b591 100644 --- a/Control/Applicative.hs +++ b/Control/Applicative.hs @@ -167,6 +167,11 @@ instance Monoid a => Applicative ((,) a) where pure x = (mempty, x) (u, f) <*> (v, x) = (u `mappend` v, f x) +instance Applicative (Either e) where + pure = Right + Left e <*> _ = Left e + Right f <*> r = fmap f r + -- new instances newtype Const a b = Const { getConst :: a }