neither-0.0.0: Provide versions of Either with good monad and applicative instances.

Data.Neither

Contents

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.

Synopsis

Applicative version

data AEither a b Source

Constructors

ALeft a 
ARight b 

Instances

Typeable2 AEither 
Functor (AEither a) 
Monoid a => Applicative (AEither a) 
(Eq a, Eq b) => Eq (AEither a b) 
(Data a, Data b) => Data (AEither a b) 
(Ord a, Ord b) => Ord (AEither a b) 
(Read a, Read b) => Read (AEither a b) 
(Show a, Show b) => Show (AEither a b) 

aeither :: (a -> c) -> (b -> c) -> AEither a b -> cSource

Monadic version

data MEither a b Source

Constructors

MLeft a 
MRight b 

Instances

Typeable2 MEither 
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) 

meither :: (a -> c) -> (b -> c) -> MEither a b -> cSource

Monad transformer

newtype MEitherT e m a Source

Constructors

MEitherT 

Fields

runMEitherT :: m (MEither e a)
 

mapMEitherT :: (m (MEither e a) -> n (MEither e' b)) -> MEitherT e m a -> MEitherT e' n bSource

throwMEither :: Monad m => e -> MEitherT e m aSource