summaryrefslogtreecommitdiff
path: root/libraries/base/Data/Either.hs
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/base/Data/Either.hs')
-rw-r--r--libraries/base/Data/Either.hs3
1 files changed, 3 insertions, 0 deletions
diff --git a/libraries/base/Data/Either.hs b/libraries/base/Data/Either.hs
index db340923e1..8bef30be9c 100644
--- a/libraries/base/Data/Either.hs
+++ b/libraries/base/Data/Either.hs
@@ -124,15 +124,18 @@ Left "parse error"
data Either a b = Left a | Right b
deriving (Eq, Ord, Read, Show)
+-- | @since 3.0
instance Functor (Either a) where
fmap _ (Left x) = Left x
fmap f (Right y) = Right (f y)
+-- | @since 3.0
instance Applicative (Either e) where
pure = Right
Left e <*> _ = Left e
Right f <*> r = fmap f r
+-- | @since 4.4.0.0
instance Monad (Either e) where
Left l >>= _ = Left l
Right r >>= k = k r