diff options
Diffstat (limited to 'libraries/base/Data/Either.hs')
-rw-r--r-- | libraries/base/Data/Either.hs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libraries/base/Data/Either.hs b/libraries/base/Data/Either.hs index 9abb20522c..efa9328f3e 100644 --- a/libraries/base/Data/Either.hs +++ b/libraries/base/Data/Either.hs @@ -56,6 +56,11 @@ instance Functor (Either a) where fmap _ (Left x) = Left x fmap f (Right y) = Right (f y) +instance Applicative (Either e) where + pure = Right + Left e <*> _ = Left e + Right f <*> r = fmap f r + instance Monad (Either e) where return = Right Left l >>= _ = Left l |