projects
/
ghc-base.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
move Monad and MonadFix instances for Either from mtl (proposal #4159)
[ghc-base.git]
/
Control
/
Monad
/
Instances.hs
diff --git
a/Control/Monad/Instances.hs
b/Control/Monad/Instances.hs
index
6caf060
..
d41be4f
100644
(file)
--- 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