Copyright | (C) 2017 Tim McGilchrist |
---|---|
License | BSD-style (see the file LICENSE) |
Maintainer | timmcgil@gmail.com |
Stability | experimental |
Portability | portable |
Safe Haskell | Safe |
Language | Haskell98 |
This monad transformer extends Control.Monad.Trans.Except with a more familar Either naming.
- type EitherT = ExceptT
- newEitherT :: m (Either x a) -> EitherT x m a
- pattern EitherT :: forall m x a. m (Either x a) -> ExceptT x m a
- runEitherT :: EitherT x m a -> m (Either x a)
- eitherT :: Monad m => (x -> m b) -> (a -> m b) -> EitherT x m a -> m b
- left :: Monad m => x -> EitherT x m a
- right :: Monad m => a -> EitherT x m a
- mapEitherT :: (m (Either x a) -> n (Either y b)) -> EitherT x m a -> EitherT y n b
- hoistEither :: Monad m => Either x a -> EitherT x m a
- bimapEitherT :: Functor m => (x -> y) -> (a -> b) -> EitherT x m a -> EitherT y m b
- firstEitherT :: Functor m => (x -> y) -> EitherT x m a -> EitherT y m a
- secondEitherT :: Functor m => (a -> b) -> EitherT x m a -> EitherT x m b
- hoistMaybe :: Monad m => x -> Maybe a -> EitherT x m a
- hoistEitherT :: (forall b. m b -> n b) -> EitherT x m a -> EitherT x n a
Control.Monad.Trans.Either
newEitherT :: m (Either x a) -> EitherT x m a Source #
Constructor for computations in the either monad.
(The inverse of runEitherT
).
runEitherT :: EitherT x m a -> m (Either x a) Source #
Extractor for computations in the either monad.
(The inverse of newEitherT
).
bimapEitherT :: Functor m => (x -> y) -> (a -> b) -> EitherT x m a -> EitherT y m b Source #
Map the unwrapped computation using the given function.
Extensions
firstEitherT :: Functor m => (x -> y) -> EitherT x m a -> EitherT y m a Source #
Map the Left
unwrapped computation using the given function.
secondEitherT :: Functor m => (a -> b) -> EitherT x m a -> EitherT x m b Source #
Map the Right
unwrapped computation using the given function.
hoistEitherT :: (forall b. m b -> n b) -> EitherT x m a -> EitherT x n a Source #
Hoist