Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
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
- type MonadTransError e (t :: (Type -> Type) -> Type -> Type) (m :: Type -> Type) = (Monad m, MonadTrans t, MonadError e (t m))
- type MonadIOTransError e (t :: (Type -> Type) -> Type -> Type) (m :: Type -> Type) = (MonadIO m, MonadIO (t m), MonadCatch m, MonadTrans t, MonadError e (t m))
- liftExceptT :: forall e t (m :: Type -> Type) a. MonadTransError e t m => ExceptT e m a -> t m a
- modifyError :: forall e' t (m :: Type -> Type) e a. MonadTransError e' t m => (e -> e') -> ExceptT e m a -> t m a
- handleIOExceptionsWith :: (MonadError e' m, MonadCatch m, Exception e) => (e -> e') -> m a -> m a
- handleIOExceptionsLiftWith :: (MonadIOTransError e' t m, Exception e) => (e -> e') -> m a -> t m a
- hoistIOEither :: forall e t (m :: Type -> Type) a. MonadIOTransError e t m => IO (Either e a) -> t m a
- liftMaybe :: MonadError e m => e -> Maybe a -> m a
- failEither :: MonadFail m => Either String a -> m a
- failEitherWith :: MonadFail m => (e -> String) -> Either e a -> m a
- class Monad m => MonadError e (m :: Type -> Type) | m -> e where
- throwError :: e -> m a
- catchError :: m a -> (e -> m a) -> m a
- newtype ExceptT e (m :: Type -> Type) a = ExceptT (m (Either e a))
- runExcept :: Except e a -> Either e a
- mapExcept :: (Either e a -> Either e' b) -> Except e a -> Except e' b
- withExcept :: (e -> e') -> Except e a -> Except e' a
- runExceptT :: ExceptT e m a -> m (Either e a)
- mapExceptT :: (m (Either e a) -> n (Either e' b)) -> ExceptT e m a -> ExceptT e' n b
- liftEither :: MonadError e m => Either e a -> m a
- module Control.Monad.IO.Class
- module Control.Monad.Trans.Class
- module Control.Monad.Trans.Except
- 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)
- mapExceptT :: (m (Either e a) -> n (Either e' b)) -> ExceptT e m a -> ExceptT e' n b
- 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
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 #
Lift ExceptT
into MonadTransError
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 |
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
Arguments
:: MonadError e m | |
=> e | Error to throw, if |
-> 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
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 Either
StringMonadError
class.
You can also define your own error type and/or use a monad type constructor
other than
or Either
String
.
In these cases you will have to explicitly define instances of the Either
IOError
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
MonadError IOException IO | |
Defined in Control.Monad.Error.Class Methods throwError :: IOException -> IO a Source # catchError :: IO a -> (IOException -> IO a) -> IO a Source # | |
MonadError BuiltinError BuiltinResult |
|
Defined in PlutusCore.Builtin.Result Methods throwError :: BuiltinError -> BuiltinResult a Source # catchError :: BuiltinResult a -> (BuiltinError -> BuiltinResult a) -> BuiltinResult a Source # | |
MonadError () EvaluationResult | |
Defined in PlutusCore.Evaluation.Result Methods throwError :: () -> EvaluationResult a Source # catchError :: EvaluationResult a -> (() -> EvaluationResult a) -> EvaluationResult a Source # | |
MonadError () Maybe | Since: mtl-2.2.2 |
Defined in Control.Monad.Error.Class Methods throwError :: () -> Maybe a Source # catchError :: Maybe a -> (() -> Maybe a) -> Maybe a Source # | |
MonadError e (Either e) | |
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) | |
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) | |
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) | |
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) | |
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) | |
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) | |
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) | |
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) | |
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) | |
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) | |
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) | |
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) | |
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 |
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 |
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) | |
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) | |
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) | |
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) | |
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 |
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) | |
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) | |
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) | |
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) | |
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 |
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) | |
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) | |
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) | |
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) | |
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.
Instances
MonadRWS r w s m => MonadRWS r w s (ExceptT e m) | Since: mtl-2.2 | ||||
Defined in Control.Monad.RWS.Class | |||||
FunctorT (ExceptT e :: (Type -> Type) -> Type -> Type) | |||||
Defined in Barbies.Internal.FunctorT | |||||
TraversableT (ExceptT e :: (Type -> Type) -> Type -> Type) | |||||
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) | |||||
Defined in Barbies.Internal.DistributiveT | |||||
Functor m => Generic1 (ExceptT e m :: Type -> Type) | |||||
Defined in Control.Monad.Trans.Except Associated Types
| |||||
MonadBaseControl b m => MonadBaseControl b (ExceptT e m) | |||||
Defined in Control.Monad.Trans.Control | |||||
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 | ||||
Monad m => MonadError e (ExceptT e m) | Since: mtl-2.2 | ||||
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 | ||||
MonadSelect r m => MonadSelect r (ExceptT e m) | 'Extends' the possibilities considered by Since: mtl-2.3 | ||||
Defined in Control.Monad.Select | |||||
MonadState s m => MonadState s (ExceptT e m) | Since: mtl-2.2 | ||||
MonadWriter w m => MonadWriter w (ExceptT e m) | Since: mtl-2.2 | ||||
MonadBase b m => MonadBase b (ExceptT e m) | |||||
Defined in Control.Monad.Base | |||||
Monad m => ThrowsLedgerError bm (ExceptT (AnnLedgerError bm l blk) m) l blk | |||||
Defined in Ouroboros.Consensus.Storage.LedgerDB.Forker Methods throwLedgerError :: Forker bm l blk -> RealPoint blk -> LedgerErr l -> ExceptT (AnnLedgerError bm l blk) m a | |||||
MonadTransDistributive (ExceptT x) | |||||
Defined in Hedgehog.Internal.Distributive | |||||
MonadTransControl (ExceptT e) | |||||
MonadTrans (ExceptT e) | |||||
MonadFail m => MonadFail (ExceptT e m) | |||||
MonadFix m => MonadFix (ExceptT e m) | |||||
MonadIO m => MonadIO (ExceptT e m) | |||||
MonadZip m => MonadZip (ExceptT e m) | |||||
Foldable f => Foldable (ExceptT e f) | |||||
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 # | |||||
(Eq e, Eq1 m) => Eq1 (ExceptT e m) | |||||
(Ord e, Ord1 m) => Ord1 (ExceptT e m) | |||||
Defined in Control.Monad.Trans.Except | |||||
(Read e, Read1 m) => Read1 (ExceptT e m) | |||||
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) | |||||
Contravariant m => Contravariant (ExceptT e m) | |||||
Traversable f => Traversable (ExceptT e f) | |||||
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) | |||||
(Functor m, Monad m) => Applicative (ExceptT e m) | |||||
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) | |||||
Monad m => Monad (ExceptT e m) | |||||
(Monad m, Monoid e) => MonadPlus (ExceptT e m) | |||||
MonadCatch m => MonadCatch (ExceptT e m) | |||||
Defined in Control.Monad.Catch | |||||
MonadMask m => MonadMask (ExceptT e m) | |||||
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) | |||||
Defined in Control.Monad.Catch Methods throwM :: (HasCallStack, Exception e0) => e0 -> ExceptT e m a | |||||
MonadGen m => MonadGen (ExceptT x m) | |||||
MonadTest m => MonadTest (ExceptT x m) | |||||
Defined in Hedgehog.Internal.Property | |||||
MonadCont m => MonadCont (ExceptT e m) | Since: mtl-2.2 | ||||
PrimMonad m => PrimMonad (ExceptT e m) | |||||
MonadResource m => MonadResource (ExceptT e m) | |||||
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 | |||||
Defined in Ouroboros.Consensus.Storage.LedgerDB.Forker Methods doResolveBlock :: ResolveBlock (ExceptT e (ReaderT (ResolveBlock m blk) m)) blk | |||||
Zoom m n s t => Zoom (ExceptT e m) (ExceptT e n) s t | |||||
Defined in Control.Lens.Zoom | |||||
Generic (ExceptT e m a) | |||||
Defined in Control.Monad.Trans.Except Associated Types
| |||||
(Read e, Read1 m, Read a) => Read (ExceptT e m a) | |||||
(Show e, Show1 m, Show a) => Show (ExceptT e m a) | |||||
(Eq e, Eq1 m, Eq a) => Eq (ExceptT e m a) | |||||
(Ord e, Ord1 m, Ord a) => Ord (ExceptT e m a) | |||||
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) | |||||
Defined in Control.Lens.Wrapped Associated Types
| |||||
t ~ ExceptT e' m' a' => Rewrapped (ExceptT e m a) t | |||||
Defined in Control.Lens.Wrapped | |||||
type Transformer f (ExceptT x) m | |||||
Defined in Hedgehog.Internal.Distributive | |||||
type Rep1 (ExceptT e m :: Type -> Type) | |||||
Defined in Control.Monad.Trans.Except | |||||
type StT (ExceptT e) a | |||||
Defined in Control.Monad.Trans.Control | |||||
type GenBase (ExceptT x m) | |||||
Defined in Hedgehog.Internal.Gen | |||||
type STM (ExceptT e m) | |||||
Defined in Control.Monad.Class.MonadSTM.Trans | |||||
type TArray (ExceptT e m) | |||||
Defined in Control.Monad.Class.MonadSTM.Trans type TArray (ExceptT e m) = TArray m | |||||
type TBQueue (ExceptT e m) | |||||
Defined in Control.Monad.Class.MonadSTM.Trans | |||||
type TChan (ExceptT e m) | |||||
Defined in Control.Monad.Class.MonadSTM.Trans type TChan (ExceptT e m) = TChan m | |||||
type TMVar (ExceptT e m) | |||||
Defined in Control.Monad.Class.MonadSTM.Trans type TMVar (ExceptT e m) = TMVar m | |||||
type TQueue (ExceptT e m) | |||||
Defined in Control.Monad.Class.MonadSTM.Trans | |||||
type TSem (ExceptT e m) | |||||
Defined in Control.Monad.Class.MonadSTM.Trans type TSem (ExceptT e m) = TSem m | |||||
type TVar (ExceptT e m) | |||||
Defined in Control.Monad.Class.MonadSTM.Trans type TVar (ExceptT e m) = TVar m | |||||
type Zoomed (ExceptT e m) | |||||
Defined in Control.Lens.Zoom type Zoomed (ExceptT e m) = FocusingErr e (Zoomed m) | |||||
type PrimState (ExceptT e m) | |||||
Defined in Control.Monad.Primitive | |||||
type StM (ExceptT e m) a | |||||
Defined in Control.Monad.Trans.Control | |||||
type Rep (ExceptT e m a) | |||||
Defined in Control.Monad.Trans.Except | |||||
type Unwrapped (ExceptT e m a) | |||||
Defined in Control.Lens.Wrapped |
runExcept :: Except e a -> Either e a Source #
Extractor for computations in the exception monad.
(The inverse of except
).
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
).
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.
runExceptT
(mapExceptT
f m) = f (runExceptT
m)
liftEither :: MonadError e m => Either e a -> m a Source #
Lifts an
into any Either
e
.MonadError
e
do { val <- liftEither =<< action1; action2 }
where action1
returns an Either
to represent errors.
Since: mtl-2.2.2
module Control.Monad.IO.Class
module Control.Monad.Trans.Class
module Control.Monad.Trans.Except
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.
runExceptT
(mapExceptT
f m) = f (runExceptT
m)
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 #
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 #
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 #
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 #