Data.Neither
Description
This module provides three different datatypes: AEither is the
applicative version of Either. It does not provide a monad instance, and
mappends together error values. MEither is the monadic version, which
only holds onto the first error value. MEitherT is a monad transformer.
Also, *Either datatypes and utility functions from Data.Either
are generalized with Neither type class.
- data AEither a b
- aeither :: (a -> c) -> (b -> c) -> AEither a b -> c
- data MEither a b
- meither :: (a -> c) -> (b -> c) -> MEither a b -> c
- newtype MEitherT e m a = MEitherT {
- runMEitherT :: m (MEither e a)
- mapMEitherT :: (m (MEither e a) -> n (MEither e' b)) -> MEitherT e m a -> MEitherT e' n b
- throwMEither :: Monad m => e -> MEitherT e m a
- class Neither e where
- mapLeft :: Neither e => (a -> c) -> e a b -> e c b
- mapRight :: Neither e => (b -> c) -> e a b -> e a c
- mapEither :: Neither e => (a -> c) -> (b -> d) -> e a b -> e c d
- lefts :: (Neither e, MonadPlus m) => m (e a b) -> m a
- rights :: (Neither e, MonadPlus m) => m (e a b) -> m b
- partitionEithers :: (Neither e, MonadPlus m) => m (e a b) -> (m a, m b)
Applicative version
Monadic version
Instances
| Typeable2 MEither | |
| Neither MEither | |
| Failure e (MEither e) | |
| Monad (MEither a) | |
| Functor (MEither a) | |
| Applicative (MEither a) | |
| (Eq a, Eq b) => Eq (MEither a b) | |
| (Data a, Data b) => Data (MEither a b) | |
| (Ord a, Ord b) => Ord (MEither a b) | |
| (Read a, Read b) => Read (MEither a b) | |
| (Show a, Show b) => Show (MEither a b) |
Monad transformer
Constructors
| MEitherT | |
Fields
| |
throwMEither :: Monad m => e -> MEitherT e m aSource
Neither typeclass
Methods
Utility functions
partitionEithers :: (Neither e, MonadPlus m) => m (e a b) -> (m a, m b)Source