cardano-api:internal
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cardano.Api.Monad.Error

Description

This module serves purpose as a single source of abstractions used in handling MonadError and ExceptT through 'cardano-api'.

Synopsis

Documentation

type MonadTransError e (t :: (Type -> Type) -> Type -> Type) (m :: Type -> Type) = (Monad m, MonadTrans t, MonadError e (t m)) Source #

Convenience alias

type MonadIOTransError e (t :: (Type -> Type) -> Type -> Type) (m :: Type -> Type) = (MonadIO m, MonadIO (t m), MonadCatch m, MonadTrans t, MonadError e (t m)) Source #

Same as MonadTransError, but with also MonadIO constraint

liftExceptT :: forall e t (m :: Type -> Type) a. MonadTransError e t m => ExceptT e m a -> t m a Source #

modifyError Source #

Arguments

:: forall e' t (m :: Type -> Type) e a. MonadTransError e' t m 
=> (e -> e')

mapping function

-> ExceptT e m a

value

-> t m a

result with modified error

Modify an ExceptT error and lift it to MonadError transformer stack.

This implementation avoids nesting problem of modifyError from mtl. The issue with modifyError (from mtl) is that when you use it on a function, you actually end up with ExceptT e1 (ExceptT e2 m a):

modifyError (f :: e2 -> e1) (foo :: ExceptT e2 (ExceptT e1 m) a) :: ExceptT e1 m a

and if you use modifyError (mtl) again, the more nested you get e.g. ExceptT e1 (ExceptT e2 (ExceptT e3 m a)). With a deeper monad stack you pay the overhead with every use of >>=.

This function avoids that, but at the cost of limiting its application to transformers.

handleIOExceptionsWith Source #

Arguments

:: (MonadError e' m, MonadCatch m, Exception e) 
=> (e -> e')

mapping function

-> m a

action that can throw

-> m a

result with caught exception

Wrap an exception and lift it into MonadError.

handleIOExceptionsLiftWith Source #

Arguments

:: (MonadIOTransError e' t m, Exception e) 
=> (e -> e')

mapping function

-> m a

action that can throw

-> t m a

action with caught error lifted into MonadError stack

Wrap an exception and lift it into MonadError stack.

hoistIOEither :: forall e t (m :: Type -> Type) a. MonadIOTransError e t m => IO (Either e a) -> t m a Source #

Lift an IO action that returns Either into MonadIOTransError

liftMaybe Source #

Arguments

:: MonadError e m 
=> e

Error to throw, if Nothing

-> Maybe a 
-> m a 

Lift Maybe into MonadError

class Monad m => MonadError e (m :: Type -> Type) | m -> e where Source #

The strategy of combining computations that can throw exceptions by bypassing bound functions from the point an exception is thrown to the point that it is handled.

Is parameterized over the type of error information and the monad type constructor. It is common to use Either String as the monad type constructor for an error monad in which error descriptions take the form of strings. In that case and many other common cases the resulting monad is already defined as an instance of the MonadError class. You can also define your own error type and/or use a monad type constructor other than Either String or Either IOError. In these cases you will have to explicitly define instances of the MonadError class. (If you are using the deprecated Control.Monad.Error or Control.Monad.Trans.Error, you may also have to define an Error instance.)

Methods

throwError :: e -> m a Source #

Is used within a monadic computation to begin exception processing.

catchError :: m a -> (e -> m a) -> m a Source #

A handler function to handle previous errors and return to normal execution. A common idiom is:

do { action1; action2; action3 } `catchError` handler

where the action functions can call throwError. Note that handler and the do-block must have the same return type.

Instances

Instances details
MonadError IOException IO 
Instance details

Defined in Control.Monad.Error.Class

Methods

throwError :: IOException -> IO a Source #

catchError :: IO a -> (IOException -> IO a) -> IO a Source #

MonadError BuiltinError BuiltinResult

throwError puts every operational unlifting error into the BuiltinFailure logs. This is to compensate for the historical lack of error message content in operational errors (structural ones don't have this problem) in our evaluators (the CK and CEK machines). It would be better to fix the underlying issue and allow operational evaluation errors to carry some form of content, but for now we just fix the symptom in order for the end user to see the error message that they are supposed to see. The fix even makes some sense: what we do here is we emulate logging when the thrown unlifting error is an operational one, i.e. this is similar to what some builtins do manually (like when a crypto builtin fails and puts info about the failure into the logs).

Instance details

Defined in PlutusCore.Builtin.Result

MonadError () EvaluationResult 
Instance details

Defined in PlutusCore.Evaluation.Result

MonadError () Maybe

Since: mtl-2.2.2

Instance details

Defined in Control.Monad.Error.Class

Methods

throwError :: () -> Maybe a Source #

catchError :: Maybe a -> (() -> Maybe a) -> Maybe a Source #

MonadError e (Either e) 
Instance details

Defined in Control.Monad.Error.Class

Methods

throwError :: e -> Either e a Source #

catchError :: Either e a -> (e -> Either e a) -> Either e a Source #

MonadError e m => MonadError e (Free m) 
Instance details

Defined in Control.Monad.Free

Methods

throwError :: e -> Free m a Source #

catchError :: Free m a -> (e -> Free m a) -> Free m a Source #

MonadError e m => MonadError e (GenT m) 
Instance details

Defined in Hedgehog.Internal.Gen

Methods

throwError :: e -> GenT m a Source #

catchError :: GenT m a -> (e -> GenT m a) -> GenT m a Source #

MonadError e m => MonadError e (PropertyT m) 
Instance details

Defined in Hedgehog.Internal.Property

Methods

throwError :: e -> PropertyT m a Source #

catchError :: PropertyT m a -> (e -> PropertyT m a) -> PropertyT m a Source #

MonadError e m => MonadError e (TestT m) 
Instance details

Defined in Hedgehog.Internal.Property

Methods

throwError :: e -> TestT m a Source #

catchError :: TestT m a -> (e -> TestT m a) -> TestT m a Source #

MonadError e m => MonadError e (TreeT m) 
Instance details

Defined in Hedgehog.Internal.Tree

Methods

throwError :: e -> TreeT m a Source #

catchError :: TreeT m a -> (e -> TreeT m a) -> TreeT m a Source #

MonadError e m => MonadError e (ListT m) 
Instance details

Defined in ListT

Methods

throwError :: e -> ListT m a Source #

catchError :: ListT m a -> (e -> ListT m a) -> ListT m a Source #

MonadError e m => MonadError e (ResourceT m) 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

throwError :: e -> ResourceT m a Source #

catchError :: ResourceT m a -> (e -> ResourceT m a) -> ResourceT m a Source #

MonadError e m => MonadError e (MaybeT m) 
Instance details

Defined in Control.Monad.Error.Class

Methods

throwError :: e -> MaybeT m a Source #

catchError :: MaybeT m a -> (e -> MaybeT m a) -> MaybeT m a Source #

MonadError e m => MonadError e (FailT e m) 
Instance details

Defined in Control.Monad.Trans.Fail

Methods

throwError :: e -> FailT e m a Source #

catchError :: FailT e m a -> (e -> FailT e m a) -> FailT e m a Source #

MonadError e m => MonadError e (RandT g m) 
Instance details

Defined in Control.Monad.Trans.Random.Lazy

Methods

throwError :: e -> RandT g m a Source #

catchError :: RandT g m a -> (e -> RandT g m a) -> RandT g m a Source #

MonadError e m => MonadError e (RandT g m) 
Instance details

Defined in Control.Monad.Trans.Random.Strict

Methods

throwError :: e -> RandT g m a Source #

catchError :: RandT g m a -> (e -> RandT g m a) -> RandT g m a Source #

(Functor f, MonadError e m) => MonadError e (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

throwError :: e -> FreeT f m a Source #

catchError :: FreeT f m a -> (e -> FreeT f m a) -> FreeT f m a Source #

(Monoid w, MonadError e m) => MonadError e (AccumT w m)

Since: mtl-2.3

Instance details

Defined in Control.Monad.Error.Class

Methods

throwError :: e -> AccumT w m a Source #

catchError :: AccumT w m a -> (e -> AccumT w m a) -> AccumT w m a Source #

Monad m => MonadError e (ExceptT e m)

Since: mtl-2.2

Instance details

Defined in Control.Monad.Error.Class

Methods

throwError :: e -> ExceptT e m a Source #

catchError :: ExceptT e m a -> (e -> ExceptT e m a) -> ExceptT e m a Source #

MonadError e m => MonadError e (IdentityT m) 
Instance details

Defined in Control.Monad.Error.Class

Methods

throwError :: e -> IdentityT m a Source #

catchError :: IdentityT m a -> (e -> IdentityT m a) -> IdentityT m a Source #

MonadError e m => MonadError e (ReaderT r m) 
Instance details

Defined in Control.Monad.Error.Class

Methods

throwError :: e -> ReaderT r m a Source #

catchError :: ReaderT r m a -> (e -> ReaderT r m a) -> ReaderT r m a Source #

MonadError e m => MonadError e (StateT s m) 
Instance details

Defined in Control.Monad.Error.Class

Methods

throwError :: e -> StateT s m a Source #

catchError :: StateT s m a -> (e -> StateT s m a) -> StateT s m a Source #

MonadError e m => MonadError e (StateT s m) 
Instance details

Defined in Control.Monad.Error.Class

Methods

throwError :: e -> StateT s m a Source #

catchError :: StateT s m a -> (e -> StateT s m a) -> StateT s m a Source #

(Monoid w, MonadError e m) => MonadError e (WriterT w m)

Since: mtl-2.3

Instance details

Defined in Control.Monad.Error.Class

Methods

throwError :: e -> WriterT w m a Source #

catchError :: WriterT w m a -> (e -> WriterT w m a) -> WriterT w m a Source #

(Monoid w, MonadError e m) => MonadError e (WriterT w m) 
Instance details

Defined in Control.Monad.Error.Class

Methods

throwError :: e -> WriterT w m a Source #

catchError :: WriterT w m a -> (e -> WriterT w m a) -> WriterT w m a Source #

(Monoid w, MonadError e m) => MonadError e (WriterT w m) 
Instance details

Defined in Control.Monad.Error.Class

Methods

throwError :: e -> WriterT w m a Source #

catchError :: WriterT w m a -> (e -> WriterT w m a) -> WriterT w m a Source #

MonadError e m => MonadError e (ConduitT i o m) 
Instance details

Defined in Data.Conduit.Internal.Conduit

Methods

throwError :: e -> ConduitT i o m a Source #

catchError :: ConduitT i o m a -> (e -> ConduitT i o m a) -> ConduitT i o m a Source #

MonadError e m => MonadError e (ParsecT s u m) 
Instance details

Defined in Text.Parsec.Prim

Methods

throwError :: e -> ParsecT s u m a Source #

catchError :: ParsecT s u m a -> (e -> ParsecT s u m a) -> ParsecT s u m a Source #

(Monoid w, MonadError e m) => MonadError e (RWST r w s m)

Since: mtl-2.3

Instance details

Defined in Control.Monad.Error.Class

Methods

throwError :: e -> RWST r w s m a Source #

catchError :: RWST r w s m a -> (e -> RWST r w s m a) -> RWST r w s m a Source #

(Monoid w, MonadError e m) => MonadError e (RWST r w s m) 
Instance details

Defined in Control.Monad.Error.Class

Methods

throwError :: e -> RWST r w s m a Source #

catchError :: RWST r w s m a -> (e -> RWST r w s m a) -> RWST r w s m a Source #

(Monoid w, MonadError e m) => MonadError e (RWST r w s m) 
Instance details

Defined in Control.Monad.Error.Class

Methods

throwError :: e -> RWST r w s m a Source #

catchError :: RWST r w s m a -> (e -> RWST r w s m a) -> RWST r w s m a Source #

MonadError e m => MonadError e (Pipe l i o u m) 
Instance details

Defined in Data.Conduit.Internal.Pipe

Methods

throwError :: e -> Pipe l i o u m a Source #

catchError :: Pipe l i o u m a -> (e -> Pipe l i o u m a) -> Pipe l i o u m a Source #

ThrowableBuiltins uni fun => MonadError (CekEvaluationException NamedDeBruijn uni fun) (CekM uni fun s) 
Instance details

Defined in UntypedPlutusCore.Evaluation.Machine.Cek.Internal

Methods

throwError :: CekEvaluationException NamedDeBruijn uni fun -> CekM uni fun s a Source #

catchError :: CekM uni fun s a -> (CekEvaluationException NamedDeBruijn uni fun -> CekM uni fun s a) -> CekM uni fun s a Source #

newtype ExceptT e (m :: Type -> Type) a Source #

A monad transformer that adds exceptions to other monads.

ExceptT constructs a monad parameterized over two things:

  • e - The exception type.
  • m - The inner monad.

The return function yields a computation that produces the given value, while >>= sequences two subcomputations, exiting on the first exception.

Constructors

ExceptT (m (Either e a)) 

Instances

Instances details
MonadRWS r w s m => MonadRWS r w s (ExceptT e m)

Since: mtl-2.2

Instance details

Defined in Control.Monad.RWS.Class

FunctorT (ExceptT e :: (Type -> Type) -> Type -> Type) 
Instance details

Defined in Barbies.Internal.FunctorT

Methods

tmap :: (forall a. f a -> g a) -> ExceptT e f x -> ExceptT e g x

TraversableT (ExceptT e :: (Type -> Type) -> Type -> Type) 
Instance details

Defined in Barbies.Internal.TraversableT

Methods

ttraverse :: Applicative e0 => (forall a. f a -> e0 (g a)) -> ExceptT e f x -> e0 (ExceptT e g x)

DistributiveT (ExceptT e :: (Type -> Type) -> Type -> Type) 
Instance details

Defined in Barbies.Internal.DistributiveT

Methods

tdistribute :: forall f (g :: Type -> Type) x. Functor f => f (ExceptT e g x) -> ExceptT e (Compose f g) x

Functor m => Generic1 (ExceptT e m :: Type -> Type) 
Instance details

Defined in Control.Monad.Trans.Except

Associated Types

type Rep1 (ExceptT e m :: Type -> Type) 
Instance details

Defined in Control.Monad.Trans.Except

type Rep1 (ExceptT e m :: Type -> Type) = D1 ('MetaData "ExceptT" "Control.Monad.Trans.Except" "transformers-0.6.1.0-inplace" 'True) (C1 ('MetaCons "ExceptT" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (m :.: Rec1 (Either e))))

Methods

from1 :: ExceptT e m a -> Rep1 (ExceptT e m) a Source #

to1 :: Rep1 (ExceptT e m) a -> ExceptT e m a Source #

MonadBaseControl b m => MonadBaseControl b (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Control

Methods

liftBaseWith :: (RunInBase (ExceptT e m) b -> b a) -> ExceptT e m a

restoreM :: StM (ExceptT e m) a -> ExceptT e m a

MonadAccum w m => MonadAccum w (ExceptT e m)

The accumulated value 'survives' an exception: even if the computation fails to deliver a result, we still have an accumulated value.

Since: mtl-2.3

Instance details

Defined in Control.Monad.Accum

Methods

look :: ExceptT e m w Source #

add :: w -> ExceptT e m () Source #

accum :: (w -> (a, w)) -> ExceptT e m a Source #

Monad m => MonadError e (ExceptT e m)

Since: mtl-2.2

Instance details

Defined in Control.Monad.Error.Class

Methods

throwError :: e -> ExceptT e m a Source #

catchError :: ExceptT e m a -> (e -> ExceptT e m a) -> ExceptT e m a Source #

MonadReader r m => MonadReader r (ExceptT e m)

Since: mtl-2.2

Instance details

Defined in Control.Monad.Reader.Class

Methods

ask :: ExceptT e m r Source #

local :: (r -> r) -> ExceptT e m a -> ExceptT e m a Source #

reader :: (r -> a) -> ExceptT e m a Source #

MonadSelect r m => MonadSelect r (ExceptT e m)

'Extends' the possibilities considered by m to include every value of e; this means that the potential result could be either a Left (making it a choice of type e) or a Right (making it a choice of type a).

Since: mtl-2.3

Instance details

Defined in Control.Monad.Select

Methods

select :: ((a -> r) -> a) -> ExceptT e m a Source #

MonadState s m => MonadState s (ExceptT e m)

Since: mtl-2.2

Instance details

Defined in Control.Monad.State.Class

Methods

get :: ExceptT e m s Source #

put :: s -> ExceptT e m () Source #

state :: (s -> (a, s)) -> ExceptT e m a Source #

MonadWriter w m => MonadWriter w (ExceptT e m)

Since: mtl-2.2

Instance details

Defined in Control.Monad.Writer.Class

Methods

writer :: (a, w) -> ExceptT e m a Source #

tell :: w -> ExceptT e m () Source #

listen :: ExceptT e m a -> ExceptT e m (a, w) Source #

pass :: ExceptT e m (a, w -> w) -> ExceptT e m a Source #

MonadTransDistributive (ExceptT x) 
Instance details

Defined in Hedgehog.Internal.Distributive

Methods

distributeT :: forall f (m :: Type -> Type) a. Transformer f (ExceptT x) m => ExceptT x (f m) a -> f (ExceptT x m) a

MonadTransControl (ExceptT e) 
Instance details

Defined in Control.Monad.Trans.Control

Methods

liftWith :: Monad m => (Run (ExceptT e) -> m a) -> ExceptT e m a

restoreT :: Monad m => m (StT (ExceptT e) a) -> ExceptT e m a

MonadTrans (ExceptT e) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

lift :: Monad m => m a -> ExceptT e m a Source #

MonadFail m => MonadFail (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

fail :: String -> ExceptT e m a Source #

MonadFix m => MonadFix (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

mfix :: (a -> ExceptT e m a) -> ExceptT e m a Source #

MonadIO m => MonadIO (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

liftIO :: IO a -> ExceptT e m a Source #

MonadZip m => MonadZip (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

mzip :: ExceptT e m a -> ExceptT e m b -> ExceptT e m (a, b) Source #

mzipWith :: (a -> b -> c) -> ExceptT e m a -> ExceptT e m b -> ExceptT e m c Source #

munzip :: ExceptT e m (a, b) -> (ExceptT e m a, ExceptT e m b) Source #

Foldable f => Foldable (ExceptT e f) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

fold :: Monoid m => ExceptT e f m -> m Source #

foldMap :: Monoid m => (a -> m) -> ExceptT e f a -> m Source #

foldMap' :: Monoid m => (a -> m) -> ExceptT e f a -> m Source #

foldr :: (a -> b -> b) -> b -> ExceptT e f a -> b Source #

foldr' :: (a -> b -> b) -> b -> ExceptT e f a -> b Source #

foldl :: (b -> a -> b) -> b -> ExceptT e f a -> b Source #

foldl' :: (b -> a -> b) -> b -> ExceptT e f a -> b Source #

foldr1 :: (a -> a -> a) -> ExceptT e f a -> a Source #

foldl1 :: (a -> a -> a) -> ExceptT e f a -> a Source #

toList :: ExceptT e f a -> [a] Source #

null :: ExceptT e f a -> Bool Source #

length :: ExceptT e f a -> Int Source #

elem :: Eq a => a -> ExceptT e f a -> Bool Source #

maximum :: Ord a => ExceptT e f a -> a Source #

minimum :: Ord a => ExceptT e f a -> a Source #

sum :: Num a => ExceptT e f a -> a Source #

product :: Num a => ExceptT e f a -> a Source #

(Eq e, Eq1 m) => Eq1 (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

liftEq :: (a -> b -> Bool) -> ExceptT e m a -> ExceptT e m b -> Bool Source #

(Ord e, Ord1 m) => Ord1 (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

liftCompare :: (a -> b -> Ordering) -> ExceptT e m a -> ExceptT e m b -> Ordering Source #

(Read e, Read1 m) => Read1 (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (ExceptT e m a) Source #

liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [ExceptT e m a] Source #

liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (ExceptT e m a) Source #

liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [ExceptT e m a] Source #

(Show e, Show1 m) => Show1 (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> ExceptT e m a -> ShowS Source #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [ExceptT e m a] -> ShowS Source #

Contravariant m => Contravariant (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

contramap :: (a' -> a) -> ExceptT e m a -> ExceptT e m a' Source #

(>$) :: b -> ExceptT e m b -> ExceptT e m a Source #

Traversable f => Traversable (ExceptT e f) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

traverse :: Applicative f0 => (a -> f0 b) -> ExceptT e f a -> f0 (ExceptT e f b) Source #

sequenceA :: Applicative f0 => ExceptT e f (f0 a) -> f0 (ExceptT e f a) Source #

mapM :: Monad m => (a -> m b) -> ExceptT e f a -> m (ExceptT e f b) Source #

sequence :: Monad m => ExceptT e f (m a) -> m (ExceptT e f a) Source #

(Functor m, Monad m, Monoid e) => Alternative (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

empty :: ExceptT e m a Source #

(<|>) :: ExceptT e m a -> ExceptT e m a -> ExceptT e m a Source #

some :: ExceptT e m a -> ExceptT e m [a] Source #

many :: ExceptT e m a -> ExceptT e m [a] Source #

(Functor m, Monad m) => Applicative (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

pure :: a -> ExceptT e m a Source #

(<*>) :: ExceptT e m (a -> b) -> ExceptT e m a -> ExceptT e m b Source #

liftA2 :: (a -> b -> c) -> ExceptT e m a -> ExceptT e m b -> ExceptT e m c Source #

(*>) :: ExceptT e m a -> ExceptT e m b -> ExceptT e m b Source #

(<*) :: ExceptT e m a -> ExceptT e m b -> ExceptT e m a Source #

Functor m => Functor (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

fmap :: (a -> b) -> ExceptT e m a -> ExceptT e m b Source #

(<$) :: a -> ExceptT e m b -> ExceptT e m a Source #

Monad m => Monad (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

(>>=) :: ExceptT e m a -> (a -> ExceptT e m b) -> ExceptT e m b Source #

(>>) :: ExceptT e m a -> ExceptT e m b -> ExceptT e m b Source #

return :: a -> ExceptT e m a Source #

(Monad m, Monoid e) => MonadPlus (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

mzero :: ExceptT e m a Source #

mplus :: ExceptT e m a -> ExceptT e m a -> ExceptT e m a Source #

MonadCatch m => MonadCatch (ExceptT e m) 
Instance details

Defined in Control.Monad.Catch

Methods

catch :: (HasCallStack, Exception e0) => ExceptT e m a -> (e0 -> ExceptT e m a) -> ExceptT e m a

MonadMask m => MonadMask (ExceptT e m) 
Instance details

Defined in Control.Monad.Catch

Methods

mask :: HasCallStack => ((forall a. ExceptT e m a -> ExceptT e m a) -> ExceptT e m b) -> ExceptT e m b

uninterruptibleMask :: HasCallStack => ((forall a. ExceptT e m a -> ExceptT e m a) -> ExceptT e m b) -> ExceptT e m b

generalBracket :: HasCallStack => ExceptT e m a -> (a -> ExitCase b -> ExceptT e m c) -> (a -> ExceptT e m b) -> ExceptT e m (b, c)

MonadThrow m => MonadThrow (ExceptT e m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: (HasCallStack, Exception e0) => e0 -> ExceptT e m a

MonadGen m => MonadGen (ExceptT x m) 
Instance details

Defined in Hedgehog.Internal.Gen

Associated Types

type GenBase (ExceptT x m) 
Instance details

Defined in Hedgehog.Internal.Gen

type GenBase (ExceptT x m) = ExceptT x (GenBase m)

Methods

toGenT :: ExceptT x m a -> GenT (GenBase (ExceptT x m)) a

fromGenT :: GenT (GenBase (ExceptT x m)) a -> ExceptT x m a

MonadTest m => MonadTest (ExceptT x m) 
Instance details

Defined in Hedgehog.Internal.Property

Methods

liftTest :: Test a -> ExceptT x m a

MonadCont m => MonadCont (ExceptT e m)

Since: mtl-2.2

Instance details

Defined in Control.Monad.Cont.Class

Methods

callCC :: ((a -> ExceptT e m b) -> ExceptT e m a) -> ExceptT e m a Source #

PrimMonad m => PrimMonad (ExceptT e m) 
Instance details

Defined in Control.Monad.Primitive

Associated Types

type PrimState (ExceptT e m) 
Instance details

Defined in Control.Monad.Primitive

type PrimState (ExceptT e m) = PrimState m

Methods

primitive :: (State# (PrimState (ExceptT e m)) -> (# State# (PrimState (ExceptT e m)), a #)) -> ExceptT e m a #

MonadResource m => MonadResource (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Resource.Internal

Methods

liftResourceT :: ResourceT IO a -> ExceptT e m a

Monad m => ResolvesBlocks (ExceptT e (ReaderT (ResolveBlock m blk) m)) blk 
Instance details

Defined in Ouroboros.Consensus.Storage.LedgerDB.Update

Monad m => ThrowsLedgerError (ExceptT (AnnLedgerError l blk) m) l blk 
Instance details

Defined in Ouroboros.Consensus.Storage.LedgerDB.Update

Zoom m n s t => Zoom (ExceptT e m) (ExceptT e n) s t 
Instance details

Defined in Control.Lens.Zoom

Methods

zoom :: LensLike' (Zoomed (ExceptT e m) c) t s -> ExceptT e m c -> ExceptT e n c

Generic (ExceptT e m a) 
Instance details

Defined in Control.Monad.Trans.Except

Associated Types

type Rep (ExceptT e m a) 
Instance details

Defined in Control.Monad.Trans.Except

type Rep (ExceptT e m a) = D1 ('MetaData "ExceptT" "Control.Monad.Trans.Except" "transformers-0.6.1.0-inplace" 'True) (C1 ('MetaCons "ExceptT" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (m (Either e a)))))

Methods

from :: ExceptT e m a -> Rep (ExceptT e m a) x Source #

to :: Rep (ExceptT e m a) x -> ExceptT e m a Source #

(Read e, Read1 m, Read a) => Read (ExceptT e m a) 
Instance details

Defined in Control.Monad.Trans.Except

(Show e, Show1 m, Show a) => Show (ExceptT e m a) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

showsPrec :: Int -> ExceptT e m a -> ShowS Source #

show :: ExceptT e m a -> String Source #

showList :: [ExceptT e m a] -> ShowS Source #

(Eq e, Eq1 m, Eq a) => Eq (ExceptT e m a) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

(==) :: ExceptT e m a -> ExceptT e m a -> Bool Source #

(/=) :: ExceptT e m a -> ExceptT e m a -> Bool Source #

(Ord e, Ord1 m, Ord a) => Ord (ExceptT e m a) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

compare :: ExceptT e m a -> ExceptT e m a -> Ordering Source #

(<) :: ExceptT e m a -> ExceptT e m a -> Bool Source #

(<=) :: ExceptT e m a -> ExceptT e m a -> Bool Source #

(>) :: ExceptT e m a -> ExceptT e m a -> Bool Source #

(>=) :: ExceptT e m a -> ExceptT e m a -> Bool Source #

max :: ExceptT e m a -> ExceptT e m a -> ExceptT e m a Source #

min :: ExceptT e m a -> ExceptT e m a -> ExceptT e m a Source #

Wrapped (ExceptT e m a) 
Instance details

Defined in Control.Lens.Wrapped

Associated Types

type Unwrapped (ExceptT e m a) 
Instance details

Defined in Control.Lens.Wrapped

type Unwrapped (ExceptT e m a) = m (Either e a)

Methods

_Wrapped' :: Iso' (ExceptT e m a) (Unwrapped (ExceptT e m a))

t ~ ExceptT e' m' a' => Rewrapped (ExceptT e m a) t 
Instance details

Defined in Control.Lens.Wrapped

type Transformer f (ExceptT x) m 
Instance details

Defined in Hedgehog.Internal.Distributive

type Transformer f (ExceptT x) m = (Monad m, Monad (f m), Monad (ExceptT x m), Monad (f (ExceptT x m)), MonadTrans f, MFunctor f)
type Rep1 (ExceptT e m :: Type -> Type) 
Instance details

Defined in Control.Monad.Trans.Except

type Rep1 (ExceptT e m :: Type -> Type) = D1 ('MetaData "ExceptT" "Control.Monad.Trans.Except" "transformers-0.6.1.0-inplace" 'True) (C1 ('MetaCons "ExceptT" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (m :.: Rec1 (Either e))))
type StT (ExceptT e) a 
Instance details

Defined in Control.Monad.Trans.Control

type StT (ExceptT e) a = Either e a
type GenBase (ExceptT x m) 
Instance details

Defined in Hedgehog.Internal.Gen

type GenBase (ExceptT x m) = ExceptT x (GenBase m)
type STM (ExceptT e m) 
Instance details

Defined in Control.Monad.Class.MonadSTM.Trans

type STM (ExceptT e m) = ExceptT e (STM m)
type TArray (ExceptT e m) 
Instance details

Defined in Control.Monad.Class.MonadSTM.Trans

type TArray (ExceptT e m) = TArray m
type TBQueue (ExceptT e m) 
Instance details

Defined in Control.Monad.Class.MonadSTM.Trans

type TBQueue (ExceptT e m) = TBQueue m
type TChan (ExceptT e m) 
Instance details

Defined in Control.Monad.Class.MonadSTM.Trans

type TChan (ExceptT e m) = TChan m
type TMVar (ExceptT e m) 
Instance details

Defined in Control.Monad.Class.MonadSTM.Trans

type TMVar (ExceptT e m) = TMVar m
type TQueue (ExceptT e m) 
Instance details

Defined in Control.Monad.Class.MonadSTM.Trans

type TQueue (ExceptT e m) = TQueue m
type TSem (ExceptT e m) 
Instance details

Defined in Control.Monad.Class.MonadSTM.Trans

type TSem (ExceptT e m) = TSem m
type TVar (ExceptT e m) 
Instance details

Defined in Control.Monad.Class.MonadSTM.Trans

type TVar (ExceptT e m) = TVar m
type Zoomed (ExceptT e m) 
Instance details

Defined in Control.Lens.Zoom

type Zoomed (ExceptT e m) = FocusingErr e (Zoomed m)
type PrimState (ExceptT e m) 
Instance details

Defined in Control.Monad.Primitive

type PrimState (ExceptT e m) = PrimState m
type StM (ExceptT e m) a 
Instance details

Defined in Control.Monad.Trans.Control

type StM (ExceptT e m) a = ComposeSt (ExceptT e) m a
type Rep (ExceptT e m a) 
Instance details

Defined in Control.Monad.Trans.Except

type Rep (ExceptT e m a) = D1 ('MetaData "ExceptT" "Control.Monad.Trans.Except" "transformers-0.6.1.0-inplace" 'True) (C1 ('MetaCons "ExceptT" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (m (Either e a)))))
type Unwrapped (ExceptT e m a) 
Instance details

Defined in Control.Lens.Wrapped

type Unwrapped (ExceptT e m a) = m (Either e a)

runExcept :: Except e a -> Either e a Source #

Extractor for computations in the exception monad. (The inverse of except).

mapExcept :: (Either e a -> Either e' b) -> Except e a -> Except e' b Source #

Map the unwrapped computation using the given function.

withExcept :: (e -> e') -> Except e a -> Except e' a Source #

Transform any exceptions thrown by the computation using the given function (a specialization of withExceptT).

runExceptT :: ExceptT e m a -> m (Either e a) Source #

The inverse of ExceptT.

mapExceptT :: (m (Either e a) -> n (Either e' b)) -> ExceptT e m a -> ExceptT e' n b Source #

Map the unwrapped computation using the given function.

liftEither :: MonadError e m => Either e a -> m a Source #

Lifts an Either e into any MonadError e.

do { val <- liftEither =<< action1; action2 }

where action1 returns an Either to represent errors.

Since: mtl-2.2.2

left :: forall (m :: Type -> Type) x a. Monad m => x -> ExceptT x m a #

right :: forall (m :: Type -> Type) a x. Monad m => a -> ExceptT x m a #

runExceptT :: ExceptT e m a -> m (Either e a) Source #

The inverse of ExceptT.

mapExceptT :: (m (Either e a) -> n (Either e' b)) -> ExceptT e m a -> ExceptT e' n b Source #

Map the unwrapped computation using the given function.

hoistMaybe :: forall (m :: Type -> Type) x a. Monad m => x -> Maybe a -> ExceptT x m a #

handleIOExceptT :: forall (m :: Type -> Type) x a. MonadIO m => (IOException -> x) -> IO a -> ExceptT x m a #

firstExceptT :: forall (m :: Type -> Type) x y a. Functor m => (x -> y) -> ExceptT x m a -> ExceptT y m a #

hoistEither :: forall (m :: Type -> Type) x a. Monad m => Either x a -> ExceptT x m a #

newExceptT :: m (Either x a) -> ExceptT x m a #

bimapExceptT :: forall (m :: Type -> Type) x y a b. Functor m => (x -> y) -> (a -> b) -> ExceptT x m a -> ExceptT y m b #

bracketExceptT :: forall (m :: Type -> Type) e a b c. Monad m => ExceptT e m a -> (a -> ExceptT e m b) -> (a -> ExceptT e m c) -> ExceptT e m c #

bracketExceptionT :: forall (m :: Type -> Type) e a c b. MonadMask m => ExceptT e m a -> (a -> ExceptT e m c) -> (a -> ExceptT e m b) -> ExceptT e m b #

catchExceptT :: (MonadCatch m, Exception e) => m a -> (e -> x) -> ExceptT x m a #

catchIOExceptT :: forall (m :: Type -> Type) a x. MonadIO m => IO a -> (IOException -> x) -> ExceptT x m a #

catchLeftT :: forall (m :: Type -> Type) e a. Monad m => ExceptT e m a -> (e -> ExceptT e m a) -> ExceptT e m a #

catchesExceptT :: (Foldable f, MonadCatch m) => m a -> f (Handler m x) -> ExceptT x m a #

exceptT :: Monad m => (x -> m b) -> (a -> m b) -> ExceptT x m a -> m b #

handleExceptT :: (MonadCatch m, Exception e) => (e -> x) -> m a -> ExceptT x m a #

handleLeftT :: forall (m :: Type -> Type) e a. Monad m => (e -> ExceptT e m a) -> ExceptT e m a -> ExceptT e m a #

handlesExceptT :: (Foldable f, MonadCatch m) => f (Handler m x) -> m a -> ExceptT x m a #

hoistExceptT :: (forall b. m b -> n b) -> ExceptT x m a -> ExceptT x n a #

hushM :: Monad m => Either e a -> (e -> m ()) -> m (Maybe a) #

onLeft :: forall e x (m :: Type -> Type) a. Monad m => (e -> ExceptT x m a) -> ExceptT x m (Either e a) -> ExceptT x m a #

onNothing :: forall x (m :: Type -> Type) a. Monad m => ExceptT x m a -> ExceptT x m (Maybe a) -> ExceptT x m a #

secondExceptT :: forall (m :: Type -> Type) a b x. Functor m => (a -> b) -> ExceptT x m a -> ExceptT x m b #