-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | An either monad transformer -- -- An either monad transformer @package either @version 3.4 -- | This module provides a minimalist Either monad transformer. module Control.Monad.Trans.Either -- | EitherT is a version of ErrorT that does not require a -- spurious Error instance for the Left case. -- -- Either is a perfectly usable Monad without such a -- constraint. ErrorT is not the generalization of the current -- Either monad, it is something else. -- -- This is necessary for both theoretical and practical reasons. For -- instance an apomorphism is the generalized anamorphism for this Monad, -- but it cannot be written with ErrorT. -- -- In addition to the combinators here, the errors package -- provides a large number of combinators for working with this type. newtype EitherT e m a EitherT :: m (Either e a) -> EitherT e m a runEitherT :: EitherT e m a -> m (Either e a) -- | Given a pair of actions, one to perform in case of failure, and one to -- perform in case of success, run an EitherT and get back a -- monadic result. eitherT :: Monad m => (a -> m c) -> (b -> m c) -> EitherT a m b -> m c -- | Map over both failure and success. bimapEitherT :: Functor m => (e -> f) -> (a -> b) -> EitherT e m a -> EitherT f m b -- | Map the unwrapped computation using the given function. -- --
-- runEitherT (mapEitherT f m) = f (runEitherT m) --mapEitherT :: (m (Either e a) -> n (Either e' b)) -> EitherT e m a -> EitherT e' n b -- | Lift an Either into an EitherT hoistEither :: Monad m => Either e a -> EitherT e m a -- | Analogous to Left. Equivalent to throwError. left :: Monad m => e -> EitherT e m a -- | Analogous to Right. Equivalent to return. right :: Monad m => a -> EitherT e m a instance (Monad f, Traversable f) => Traversable (EitherT e f) instance Foldable m => Foldable (EitherT e m) instance MonadRandom m => MonadRandom (EitherT e m) instance MonadWriter s m => MonadWriter s (EitherT e m) instance MonadState s m => MonadState s (EitherT e m) instance MonadReader r m => MonadReader r (EitherT e m) instance MonadCont m => MonadCont (EitherT e m) instance MonadIO m => MonadIO (EitherT e m) instance MonadTrans (EitherT e) instance MonadFix m => MonadFix (EitherT e m) instance Monad m => MonadError e (EitherT e m) instance Monad m => Monad (EitherT e m) instance Monad m => Bind (EitherT e m) instance (Monad m, Semigroup e) => Alt (EitherT e m) instance Monad m => Semigroup (EitherT e m a) instance (Monad m, Monoid e) => MonadPlus (EitherT e m) instance (Monad m, Monoid e) => Alternative (EitherT e m) instance Monad m => Applicative (EitherT e m) instance Monad m => Apply (EitherT e m) instance Monad m => Functor (EitherT e m) instance Ord (m (Either e a)) => Ord (EitherT e m a) instance Eq (m (Either e a)) => Eq (EitherT e m a) instance Read (m (Either e a)) => Read (EitherT e m a) instance Show (m (Either e a)) => Show (EitherT e m a)