transformers-either-0.0.1: An Either monad transformer

Copyright(C) 2017 Tim McGilchrist
LicenseBSD-style (see the file LICENSE)
Maintainertimmcgil@gmail.com
Stabilityexperimental
Portabilityportable
Safe HaskellSafe
LanguageHaskell98

Control.Monad.Trans.Either

Contents

Description

This monad transformer extends Control.Monad.Trans.Except with a more familar Either naming.

Synopsis

Control.Monad.Trans.Either

type EitherT = ExceptT Source #

Type alias for ExceptT

newEitherT :: m (Either x a) -> EitherT x m a Source #

Constructor for computations in the either monad. (The inverse of runEitherT).

pattern EitherT :: forall m x a. m (Either x a) -> ExceptT x m a Source #

runEitherT :: EitherT x m a -> m (Either x a) Source #

Extractor for computations in the either monad. (The inverse of newEitherT).

eitherT :: Monad m => (x -> m b) -> (a -> m b) -> EitherT x m a -> m b Source #

left :: Monad m => x -> EitherT x m a Source #

Constructor for left computations.

right :: Monad m => a -> EitherT x m a Source #

Constructor for right computations.

mapEitherT :: (m (Either x a) -> n (Either y b)) -> EitherT x m a -> EitherT y n b Source #

hoistEither :: Monad m => Either x a -> EitherT x m a Source #

Hoist an Either into an "EitherT m"

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.

hoistMaybe :: Monad m => x -> Maybe a -> EitherT x m a Source #

Hoist a 'Maybe a' into a 'Right a'

hoistEitherT :: (forall b. m b -> n b) -> EitherT x m a -> EitherT x n a Source #

Hoist