exception-transformers-0.4.0.12: Type classes and monads for unchecked extensible exceptions.

Copyright | (c) Harvard University 2008-2011 (c) Geoffrey Mainland 2011-2021
License | BSD-style
Maintainer | mainland@cs.drexel.edu
Safe Haskell | None
Language | Haskell98

Control.Monad.Exception

Description

Synopsis

- class (Typeable e, Show e) => Exception e where
  - toException :: e -> SomeException
  - fromException :: SomeException -> Maybe e
  - displayException :: e -> String
  - backtraceDesired :: e -> Bool
- data SomeException
- class Monad m => MonadException (m :: Type -> Type) where
  - throw :: Exception e => e -> m a
  - catch :: Exception e => m a -> (e -> m a) -> m a
  - finally :: m a -> m b -> m a
- onException :: MonadException m => m a -> m b -> m a
- class (MonadIO m, MonadException m) => MonadAsyncException (m :: Type -> Type) where
  - mask :: ((forall a. m a -> m a) -> m b) -> m b
- bracket :: MonadAsyncException m => m a -> (a -> m b) -> (a -> m c) -> m c
- bracket_ :: MonadAsyncException m => m a -> m b -> m c -> m c
- newtype ExceptionT (m :: Type -> Type) a = ExceptionT {
  - runExceptionT :: m (Either SomeException a)
  }
- mapExceptionT :: (m (Either SomeException a) -> n (Either SomeException b)) -> ExceptionT m a -> ExceptionT n b
- liftException :: MonadException m => Either SomeException a -> m a

# Documentation

class (Typeable e, Show e) => Exception e where Source #

Any type that you wish to throw or catch as an exception must be an instance of the `Exception` class. The simplest case is a new exception type directly below the root:

    data MyException = ThisException | ThatException
        deriving Show

    instance Exception MyException

The default method definitions in the `Exception` class do what we need in this case. You can now throw and catch `ThisException` and `ThatException` as exceptions:

    *Main> throw ThisException `catch` \e -> putStrLn ("Caught " ++ show (e :: MyException))
    Caught ThisException

In more complicated examples, you may wish to define a whole hierarchy of exceptions:

    ---------------------------------------------------------------------
    -- Make the root exception type for all the exceptions in a compiler

    data SomeCompilerException = forall e . Exception e => SomeCompilerException e

    instance Show SomeCompilerException where
        show (SomeCompilerException e) = show e

    instance Exception SomeCompilerException

    compilerExceptionToException :: Exception e => e -> SomeException
    compilerExceptionToException = toException . SomeCompilerException

    compilerExceptionFromException :: Exception e => SomeException -> Maybe e
    compilerExceptionFromException x = do
        SomeCompilerException a <- fromException x
        cast a

    ---------------------------------------------------------------------
    -- Make a subhierarchy for exceptions in the frontend of the compiler

    data SomeFrontendException = forall e . Exception e => SomeFrontendException e

    instance Show SomeFrontendException where
        show (SomeFrontendException e) = show e

    instance Exception SomeFrontendException where
        toException = compilerExceptionToException
        fromException = compilerExceptionFromException

    frontendExceptionToException :: Exception e => e -> SomeException
    frontendExceptionToException = toException . SomeFrontendException

    frontendExceptionFromException :: Exception e => SomeException -> Maybe e
    frontendExceptionFromException x = do
        SomeFrontendException a <- fromException x
        cast a

    ---------------------------------------------------------------------
    -- Make an exception type for a particular frontend compiler exception

    data MismatchedParentheses = MismatchedParentheses
        deriving Show

    instance Exception MismatchedParentheses where
        toException   = frontendExceptionToException
        fromException = frontendExceptionFromException

We can now catch a `MismatchedParentheses` exception as `MismatchedParentheses`, `SomeFrontendException` or `SomeCompilerException`, but not other types, e.g. `IOException`:

    *Main> throw MismatchedParentheses `catch` \e -> putStrLn ("Caught " ++ show (e :: MismatchedParentheses))
    Caught MismatchedParentheses
    *Main> throw MismatchedParentheses `catch` \e -> putStrLn ("Caught " ++ show (e :: SomeFrontendException))
    Caught MismatchedParentheses
    *Main> throw MismatchedParentheses `catch` \e -> putStrLn ("Caught " ++ show (e :: SomeCompilerException))
    Caught MismatchedParentheses
    *Main> throw MismatchedParentheses `catch` \e -> putStrLn ("Caught " ++ show (e :: IOException))
    *** Exception: MismatchedParentheses

Minimal complete definition

Nothing

Methods

toException :: e -> SomeException Source #

`toException` should produce a `SomeException` with no attached `ExceptionContext`.

fromException :: SomeException -> Maybe e Source #

displayException :: e -> String Source #

Render this exception value in a human-friendly manner.

Default implementation: ``show``.

Since: base-4.8.0.0

backtraceDesired :: e -> Bool Source #

#### Instances

Instances details

Exception Timeout | Since: base-4.7.0.0
Instance details Defined in System.Timeout Methods toException :: Timeout -> SomeException Source # fromException :: SomeException -> Maybe Timeout Source # displayException :: Timeout -> String Source # backtraceDesired :: Timeout -> Bool Source #
Exception Void | Since: base-4.8.0.0
Instance details Defined in GHC.Internal.Exception.Type Methods toException :: Void -> SomeException Source # fromException :: SomeException -> Maybe Void Source # displayException :: Void -> String Source # backtraceDesired :: Void -> Bool Source #
Exception NestedAtomically | Since: base-4.0
Instance details Defined in GHC.Internal.Control.Exception.Base Methods toException :: NestedAtomically -> SomeException Source # fromException :: SomeException -> Maybe NestedAtomically Source # displayException :: NestedAtomically -> String Source # backtraceDesired :: NestedAtomically -> Bool Source #
Exception NoMatchingContinuationPrompt | Since: base-4.18
Instance details Defined in GHC.Internal.Control.Exception.Base Methods toException :: NoMatchingContinuationPrompt -> SomeException Source # fromException :: SomeException -> Maybe NoMatchingContinuationPrompt Source # displayException :: NoMatchingContinuationPrompt -> String Source # backtraceDesired :: NoMatchingContinuationPrompt -> Bool Source #
Exception NoMethodError | Since: base-4.0
Instance details Defined in GHC.Internal.Control.Exception.Base Methods toException :: NoMethodError -> SomeException Source # fromException :: SomeException -> Maybe NoMethodError Source # displayException :: NoMethodError -> String Source # backtraceDesired :: NoMethodError -> Bool Source #
Exception NonTermination | Since: base-4.0
Instance details Defined in GHC.Internal.Control.Exception.Base Methods toException :: NonTermination -> SomeException Source # fromException :: SomeException -> Maybe NonTermination Source # displayException :: NonTermination -> String Source # backtraceDesired :: NonTermination -> Bool Source #
Exception PatternMatchFail | Since: base-4.0
Instance details Defined in GHC.Internal.Control.Exception.Base Methods toException :: PatternMatchFail -> SomeException Source # fromException :: SomeException -> Maybe PatternMatchFail Source # displayException :: PatternMatchFail -> String Source # backtraceDesired :: PatternMatchFail -> Bool Source #
Exception RecConError | Since: base-4.0
Instance details Defined in GHC.Internal.Control.Exception.Base Methods toException :: RecConError -> SomeException Source # fromException :: SomeException -> Maybe RecConError Source # displayException :: RecConError -> String Source # backtraceDesired :: RecConError -> Bool Source #
Exception RecSelError | Since: base-4.0
Instance details Defined in GHC.Internal.Control.Exception.Base Methods toException :: RecSelError -> SomeException Source # fromException :: SomeException -> Maybe RecSelError Source # displayException :: RecSelError -> String Source # backtraceDesired :: RecSelError -> Bool Source #
Exception RecUpdError | Since: base-4.0
Instance details Defined in GHC.Internal.Control.Exception.Base Methods toException :: RecUpdError -> SomeException Source # fromException :: SomeException -> Maybe RecUpdError Source # displayException :: RecUpdError -> String Source # backtraceDesired :: RecUpdError -> Bool Source #
Exception TypeError | Since: base-4.9.0.0
Instance details Defined in GHC.Internal.Control.Exception.Base Methods toException :: TypeError -> SomeException Source # fromException :: SomeException -> Maybe TypeError Source # displayException :: TypeError -> String Source # backtraceDesired :: TypeError -> Bool Source #
Exception ErrorCall | Since: base-4.0.0.0
Instance details Defined in GHC.Internal.Exception Methods toException :: ErrorCall -> SomeException Source # fromException :: SomeException -> Maybe ErrorCall Source # displayException :: ErrorCall -> String Source # backtraceDesired :: ErrorCall -> Bool Source #
Exception ArithException | Since: base-4.0.0.0
Instance details Defined in GHC.Internal.Exception.Type Methods toException :: ArithException -> SomeException Source # fromException :: SomeException -> Maybe ArithException Source # displayException :: ArithException -> String Source # backtraceDesired :: ArithException -> Bool Source #
Exception SomeException | This drops any attached `ExceptionContext`. Since: base-3.0
Instance details Defined in GHC.Internal.Exception.Type Methods toException :: SomeException -> SomeException Source # fromException :: SomeException -> Maybe SomeException Source # displayException :: SomeException -> String Source # backtraceDesired :: SomeException -> Bool Source #
Exception AllocationLimitExceeded | Since: base-4.8.0.0
Instance details Defined in GHC.Internal.IO.Exception Methods toException :: AllocationLimitExceeded -> SomeException Source # fromException :: SomeException -> Maybe AllocationLimitExceeded Source # displayException :: AllocationLimitExceeded -> String Source # backtraceDesired :: AllocationLimitExceeded -> Bool Source #
Exception ArrayException | Since: base-4.1.0.0
Instance details Defined in GHC.Internal.IO.Exception Methods toException :: ArrayException -> SomeException Source # fromException :: SomeException -> Maybe ArrayException Source # displayException :: ArrayException -> String Source # backtraceDesired :: ArrayException -> Bool Source #
Exception AssertionFailed | Since: base-4.1.0.0
Instance details Defined in GHC.Internal.IO.Exception Methods toException :: AssertionFailed -> SomeException Source # fromException :: SomeException -> Maybe AssertionFailed Source # displayException :: AssertionFailed -> String Source # backtraceDesired :: AssertionFailed -> Bool Source #
Exception AsyncException | Since: base-4.7.0.0
Instance details Defined in GHC.Internal.IO.Exception Methods toException :: AsyncException -> SomeException Source # fromException :: SomeException -> Maybe AsyncException Source # displayException :: AsyncException -> String Source # backtraceDesired :: AsyncException -> Bool Source #
Exception BlockedIndefinitelyOnMVar | Since: base-4.1.0.0
Instance details Defined in GHC.Internal.IO.Exception Methods toException :: BlockedIndefinitelyOnMVar -> SomeException Source # fromException :: SomeException -> Maybe BlockedIndefinitelyOnMVar Source # displayException :: BlockedIndefinitelyOnMVar -> String Source # backtraceDesired :: BlockedIndefinitelyOnMVar -> Bool Source #
Exception BlockedIndefinitelyOnSTM | Since: base-4.1.0.0
Instance details Defined in GHC.Internal.IO.Exception Methods toException :: BlockedIndefinitelyOnSTM -> SomeException Source # fromException :: SomeException -> Maybe BlockedIndefinitelyOnSTM Source # displayException :: BlockedIndefinitelyOnSTM -> String Source # backtraceDesired :: BlockedIndefinitelyOnSTM -> Bool Source #
Exception CompactionFailed | Since: base-4.10.0.0
Instance details Defined in GHC.Internal.IO.Exception Methods toException :: CompactionFailed -> SomeException Source # fromException :: SomeException -> Maybe CompactionFailed Source # displayException :: CompactionFailed -> String Source # backtraceDesired :: CompactionFailed -> Bool Source #
Exception Deadlock | Since: base-4.1.0.0
Instance details Defined in GHC.Internal.IO.Exception Methods toException :: Deadlock -> SomeException Source # fromException :: SomeException -> Maybe Deadlock Source # displayException :: Deadlock -> String Source # backtraceDesired :: Deadlock -> Bool Source #
Exception ExitCode | Since: base-4.1.0.0
Instance details Defined in GHC.Internal.IO.Exception Methods toException :: ExitCode -> SomeException Source # fromException :: SomeException -> Maybe ExitCode Source # displayException :: ExitCode -> String Source # backtraceDesired :: ExitCode -> Bool Source #
Exception FixIOException | Since: base-4.11.0.0
Instance details Defined in GHC.Internal.IO.Exception Methods toException :: FixIOException -> SomeException Source # fromException :: SomeException -> Maybe FixIOException Source # displayException :: FixIOException -> String Source # backtraceDesired :: FixIOException -> Bool Source #
Exception IOException | Since: base-4.1.0.0
Instance details Defined in GHC.Internal.IO.Exception Methods toException :: IOException -> SomeException Source # fromException :: SomeException -> Maybe IOException Source # displayException :: IOException -> String Source # backtraceDesired :: IOException -> Bool Source #
Exception SomeAsyncException | Since: base-4.7.0.0
Instance details Defined in GHC.Internal.IO.Exception Methods toException :: SomeAsyncException -> SomeException Source # fromException :: SomeException -> Maybe SomeAsyncException Source # displayException :: SomeAsyncException -> String Source # backtraceDesired :: SomeAsyncException -> Bool Source #
Exception a => Exception (ExceptionWithContext a) |
Instance details Defined in GHC.Internal.Exception.Type Methods toException :: ExceptionWithContext a -> SomeException Source # fromException :: SomeException -> Maybe (ExceptionWithContext a) Source # displayException :: ExceptionWithContext a -> String Source # backtraceDesired :: ExceptionWithContext a -> Bool Source #
Exception e => Exception (NoBacktrace e) |
Instance details Defined in GHC.Internal.Exception.Type Methods toException :: NoBacktrace e -> SomeException Source # fromException :: SomeException -> Maybe (NoBacktrace e) Source # displayException :: NoBacktrace e -> String Source # backtraceDesired :: NoBacktrace e -> Bool Source #

data SomeException Source #

The `SomeException` type is the root of the exception type hierarchy. When an exception of type `e` is thrown, behind the scenes it is encapsulated in a `SomeException`.

#### Instances

Instances details

Exception SomeException | This drops any attached `ExceptionContext`. Since: base-3.0
Instance details Defined in GHC.Internal.Exception.Type Methods toException :: SomeException -> SomeException Source # fromException :: SomeException -> Maybe SomeException Source # displayException :: SomeException -> String Source # backtraceDesired :: SomeException -> Bool Source #
Show SomeException | Since: ghc-internal-3.0
Instance details Defined in GHC.Internal.Exception.Type Methods showsPrec :: Int -> SomeException -> ShowS Source # show :: SomeException -> String Source # showList :: [SomeException] -> ShowS Source #

class Monad m => MonadException (m :: Type -> Type) where Source #

Minimal complete definition

throw, catch

Methods

throw :: Exception e => e -> m a Source #

Throw an exception.

catch Source #

Arguments

:: Exception e |
=> m a | The computation to run
-> (e -> m a) | Handler to invoke if an exception is raised
-> m a |

Catch an exception.

finally Source #

Arguments

:: m a | The computation to run
-> m b | Computation to run afterward (even if an exception was raised)
-> m a |

Run a computation and always perform a second, final computation even if an exception is raised. If a short-circuiting monad transformer such as ErrorT or MaybeT is used to transform a MonadException monad, then the implementation of `finally` for the transformed monad must guarantee that the final action is also always performed when any short-circuiting occurs.

#### Instances

Instances details

MonadException STM Source # |
Instance details Defined in Control.Monad.Exception Methods throw :: Exception e => e -> STM a Source # catch :: Exception e => STM a -> (e -> STM a) -> STM a Source # finally :: STM a -> STM b -> STM a Source #
MonadException IO Source # |
Instance details Defined in Control.Monad.Exception Methods throw :: Exception e => e -> IO a Source # catch :: Exception e => IO a -> (e -> IO a) -> IO a Source # finally :: IO a -> IO b -> IO a Source #
Monad m => MonadException (ExceptionT m) Source # |
Instance details Defined in Control.Monad.Exception Methods throw :: Exception e => e -> ExceptionT m a Source # catch :: Exception e => ExceptionT m a -> (e -> ExceptionT m a) -> ExceptionT m a Source # finally :: ExceptionT m a -> ExceptionT m b -> ExceptionT m a Source #
MonadException m => MonadException (MaybeT m) Source # |
Instance details Defined in Control.Monad.Exception Methods throw :: Exception e => e -> MaybeT m a Source # catch :: Exception e => MaybeT m a -> (e -> MaybeT m a) -> MaybeT m a Source # finally :: MaybeT m a -> MaybeT m b -> MaybeT m a Source #
MonadException m => MonadException (ExceptT e' m) Source # |
Instance details Defined in Control.Monad.Exception Methods throw :: Exception e => e -> ExceptT e' m a Source # catch :: Exception e => ExceptT e' m a -> (e -> ExceptT e' m a) -> ExceptT e' m a Source # finally :: ExceptT e' m a -> ExceptT e' m b -> ExceptT e' m a Source #
MonadException m => MonadException (IdentityT m) Source # |
Instance details Defined in Control.Monad.Exception Methods throw :: Exception e => e -> IdentityT m a Source # catch :: Exception e => IdentityT m a -> (e -> IdentityT m a) -> IdentityT m a Source # finally :: IdentityT m a -> IdentityT m b -> IdentityT m a Source #
MonadException m => MonadException (ReaderT r m) Source # |
Instance details Defined in Control.Monad.Exception Methods throw :: Exception e => e -> ReaderT r m a Source # catch :: Exception e => ReaderT r m a -> (e -> ReaderT r m a) -> ReaderT r m a Source # finally :: ReaderT r m a -> ReaderT r m b -> ReaderT r m a Source #
MonadException m => MonadException (StateT s m) Source # |
Instance details Defined in Control.Monad.Exception Methods throw :: Exception e => e -> StateT s m a Source # catch :: Exception e => StateT s m a -> (e -> StateT s m a) -> StateT s m a Source # finally :: StateT s m a -> StateT s m b -> StateT s m a Source #
MonadException m => MonadException (StateT s m) Source # |
Instance details Defined in Control.Monad.Exception Methods throw :: Exception e => e -> StateT s m a Source # catch :: Exception e => StateT s m a -> (e -> StateT s m a) -> StateT s m a Source # finally :: StateT s m a -> StateT s m b -> StateT s m a Source #
(Monoid w, MonadException m) => MonadException (WriterT w m) Source # |
Instance details Defined in Control.Monad.Exception Methods throw :: Exception e => e -> WriterT w m a Source # catch :: Exception e => WriterT w m a -> (e -> WriterT w m a) -> WriterT w m a Source # finally :: WriterT w m a -> WriterT w m b -> WriterT w m a Source #
(Monoid w, MonadException m) => MonadException (WriterT w m) Source # |
Instance details Defined in Control.Monad.Exception Methods throw :: Exception e => e -> WriterT w m a Source # catch :: Exception e => WriterT w m a -> (e -> WriterT w m a) -> WriterT w m a Source # finally :: WriterT w m a -> WriterT w m b -> WriterT w m a Source #
(Monoid w, MonadException m) => MonadException (RWST r w s m) Source # |
Instance details Defined in Control.Monad.Exception Methods throw :: Exception e => e -> RWST r w s m a Source # catch :: Exception e => RWST r w s m a -> (e -> RWST r w s m a) -> RWST r w s m a Source # finally :: RWST r w s m a -> RWST r w s m b -> RWST r w s m a Source #
(Monoid w, MonadException m) => MonadException (RWST r w s m) Source # |
Instance details Defined in Control.Monad.Exception Methods throw :: Exception e => e -> RWST r w s m a Source # catch :: Exception e => RWST r w s m a -> (e -> RWST r w s m a) -> RWST r w s m a Source # finally :: RWST r w s m a -> RWST r w s m b -> RWST r w s m a Source #

onException Source #

Arguments

:: MonadException m |
=> m a | The computation to run
-> m b | Computation to run if an exception is raised
-> m a |

If an exception is raised by the computation, then perform a final action and re-raise the exception.

class (MonadIO m, MonadException m) => MonadAsyncException (m :: Type -> Type) where Source #

Methods

mask :: ((forall a. m a -> m a) -> m b) -> m b Source #

Executes a computation with asynchronous exceptions masked. The argument passed to `mask` is a function that takes as its argument another function, which can be used to restore the prevailing masking state within the context of the masked computation.

#### Instances

Instances details

MonadAsyncException IO Source # |
Instance details Defined in Control.Monad.Exception Methods mask :: ((forall a. IO a -> IO a) -> IO b) -> IO b Source #
MonadAsyncException m => MonadAsyncException (ExceptionT m) Source # |
Instance details Defined in Control.Monad.Exception Methods mask :: ((forall a. ExceptionT m a -> ExceptionT m a) -> ExceptionT m b) -> ExceptionT m b Source #
MonadAsyncException m => MonadAsyncException (MaybeT m) Source # |
Instance details Defined in Control.Monad.Exception Methods mask :: ((forall a. MaybeT m a -> MaybeT m a) -> MaybeT m b) -> MaybeT m b Source #
MonadAsyncException m => MonadAsyncException (ExceptT e' m) Source # |
Instance details Defined in Control.Monad.Exception Methods mask :: ((forall a. ExceptT e' m a -> ExceptT e' m a) -> ExceptT e' m b) -> ExceptT e' m b Source #
MonadAsyncException m => MonadAsyncException (IdentityT m) Source # |
Instance details Defined in Control.Monad.Exception Methods mask :: ((forall a. IdentityT m a -> IdentityT m a) -> IdentityT m b) -> IdentityT m b Source #
MonadAsyncException m => MonadAsyncException (ReaderT r m) Source # |
Instance details Defined in Control.Monad.Exception Methods mask :: ((forall a. ReaderT r m a -> ReaderT r m a) -> ReaderT r m b) -> ReaderT r m b Source #
MonadAsyncException m => MonadAsyncException (StateT s m) Source # |
Instance details Defined in Control.Monad.Exception Methods mask :: ((forall a. StateT s m a -> StateT s m a) -> StateT s m b) -> StateT s m b Source #
MonadAsyncException m => MonadAsyncException (StateT s m) Source # |
Instance details Defined in Control.Monad.Exception Methods mask :: ((forall a. StateT s m a -> StateT s m a) -> StateT s m b) -> StateT s m b Source #
(Monoid w, MonadAsyncException m) => MonadAsyncException (WriterT w m) Source # |
Instance details Defined in Control.Monad.Exception Methods mask :: ((forall a. WriterT w m a -> WriterT w m a) -> WriterT w m b) -> WriterT w m b Source #
(Monoid w, MonadAsyncException m) => MonadAsyncException (WriterT w m) Source # |
Instance details Defined in Control.Monad.Exception Methods mask :: ((forall a. WriterT w m a -> WriterT w m a) -> WriterT w m b) -> WriterT w m b Source #
(Monoid w, MonadAsyncException m) => MonadAsyncException (RWST r w s m) Source # |
Instance details Defined in Control.Monad.Exception Methods mask :: ((forall a. RWST r w s m a -> RWST r w s m a) -> RWST r w s m b) -> RWST r w s m b Source #
(Monoid w, MonadAsyncException m) => MonadAsyncException (RWST r w s m) Source # |
Instance details Defined in Control.Monad.Exception Methods mask :: ((forall a. RWST r w s m a -> RWST r w s m a) -> RWST r w s m b) -> RWST r w s m b Source #

bracket Source #

Arguments

:: MonadAsyncException m |
=> m a | computation to run first ("acquire resource")
-> (a -> m b) | computation to run last ("release resource")
-> (a -> m c) | computation to run in-between
-> m c |

When you want to acquire a resource, do some work with it, and then release the resource, it is a good idea to use `bracket`, because `bracket` will install the necessary exception handler to release the resource in the event that an exception is raised during the computation. If an exception is raised, then `bracket` will re-raise the exception (after performing the release).

bracket_ :: MonadAsyncException m => m a -> m b -> m c -> m c Source #

A variant of `bracket` where the return value from the first computation is not required.

newtype ExceptionT (m :: Type -> Type) a Source #

Constructors

ExceptionT |

Fields

- runExceptionT :: m (Either SomeException a)

#### Instances

Instances details

MonadTrans ExceptionT Source # |
Instance details Defined in Control.Monad.Exception Methods lift :: Monad m => m a -> ExceptionT m a Source #
MonadIO m => MonadIO (ExceptionT m) Source # |
Instance details Defined in Control.Monad.Exception Methods liftIO :: IO a -> ExceptionT m a Source #
MonadAsyncException m => MonadAsyncException (ExceptionT m) Source # |
Instance details Defined in Control.Monad.Exception Methods mask :: ((forall a. ExceptionT m a -> ExceptionT m a) -> ExceptionT m b) -> ExceptionT m b Source #
Monad m => MonadException (ExceptionT m) Source # |
Instance details Defined in Control.Monad.Exception Methods throw :: Exception e => e -> ExceptionT m a Source # catch :: Exception e => ExceptionT m a -> (e -> ExceptionT m a) -> ExceptionT m a Source # finally :: ExceptionT m a -> ExceptionT m b -> ExceptionT m a Source #
(Functor m, Monad m) => Alternative (ExceptionT m) Source # |
Instance details Defined in Control.Monad.Exception Methods empty :: ExceptionT m a Source # (<|>) :: ExceptionT m a -> ExceptionT m a -> ExceptionT m a Source # some :: ExceptionT m a -> ExceptionT m [a] Source # many :: ExceptionT m a -> ExceptionT m [a] Source #
(Functor m, Monad m) => Applicative (ExceptionT m) Source # |
Instance details Defined in Control.Monad.Exception Methods pure :: a -> ExceptionT m a Source # (<*>) :: ExceptionT m (a -> b) -> ExceptionT m a -> ExceptionT m b Source # liftA2 :: (a -> b -> c) -> ExceptionT m a -> ExceptionT m b -> ExceptionT m c Source # (*>) :: ExceptionT m a -> ExceptionT m b -> ExceptionT m b Source # (<*) :: ExceptionT m a -> ExceptionT m b -> ExceptionT m a Source #
Functor m => Functor (ExceptionT m) Source # |
Instance details Defined in Control.Monad.Exception Methods fmap :: (a -> b) -> ExceptionT m a -> ExceptionT m b Source # (<$) :: a -> ExceptionT m b -> ExceptionT m a Source #
Monad m => Monad (ExceptionT m) Source # |
Instance details Defined in Control.Monad.Exception Methods (>>=) :: ExceptionT m a -> (a -> ExceptionT m b) -> ExceptionT m b Source # (>>) :: ExceptionT m a -> ExceptionT m b -> ExceptionT m b Source # return :: a -> ExceptionT m a Source #
Monad m => MonadPlus (ExceptionT m) Source # |
Instance details Defined in Control.Monad.Exception Methods mzero :: ExceptionT m a Source # mplus :: ExceptionT m a -> ExceptionT m a -> ExceptionT m a Source #
Monad m => MonadFail (ExceptionT m) Source # |
Instance details Defined in Control.Monad.Exception Methods fail :: String -> ExceptionT m a Source #
MonadFix m => MonadFix (ExceptionT m) Source # |
Instance details Defined in Control.Monad.Exception Methods mfix :: (a -> ExceptionT m a) -> ExceptionT m a Source #

mapExceptionT :: (m (Either SomeException a) -> n (Either SomeException b)) -> ExceptionT m a -> ExceptionT n b Source #

liftException :: MonadException m => Either SomeException a -> m a Source #

Lift the result of running a computation in a monad transformed by `ExceptionT` into another monad that supports exceptions.