X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=Control%2FMonad%2FInstances.hs;h=d41be4f7c28c7815cee4599b6688aa0cd54f804e;hb=0c074a8eef70fd5c9ff19db84eb3564b9e3a89d3;hp=6caf06059a71c958f1bd3941557ba6ef941e4ecc;hpb=205722095450a487f2d5a7133d0802f2cc2ee856;p=ghc-base.git diff --git a/Control/Monad/Instances.hs b/Control/Monad/Instances.hs index 6caf060..d41be4f 100644 --- a/Control/Monad/Instances.hs +++ b/Control/Monad/Instances.hs @@ -31,3 +31,8 @@ instance Functor ((,) a) where instance Functor (Either a) where fmap _ (Left x) = Left x fmap f (Right y) = Right (f y) + +instance Monad (Either e) where + return = Right + Left l >>= _ = Left l + Right r >>= k = k r