Control.Monad.Trans.Resource

resourcet-1.3.0: Deterministic allocation and freeing of scarce resources.

Safe Haskell | Safe-Inferred
Language | Haskell2010

Control.Monad.Trans.Resource

Contents

- Data types
- Unwrap
  - Check cleanup exceptions
- Special actions
- Monad transformation
- Registering/releasing
- Type class/associated types
  - Low-level
- Re-exports
- Internal state
- Reexport

Description

Allocate resources which are guaranteed to be released.

For more information, see https://github.com/snoyberg/conduit/tree/master/resourcet#readme.

One point to note: all register cleanup actions live in the `IO` monad, not the main monad. This allows both more efficient code, and for monads to be transformed.

Synopsis

- data ResourceT m a
- type ResIO = ResourceT IO
- data ReleaseKey
- runResourceT :: MonadUnliftIO m => ResourceT m a -> m a
- runResourceTChecked :: MonadUnliftIO m => ResourceT m a -> m a
- data ResourceCleanupException = ResourceCleanupException {
  - rceOriginalException :: !(Maybe SomeException)
  - rceFirstCleanupException :: !SomeException
  - rceOtherCleanupExceptions :: ![SomeException]
  }
- resourceForkWith :: MonadUnliftIO m => (IO () -> IO a) -> ResourceT m () -> ResourceT m a
- resourceForkIO :: MonadUnliftIO m => ResourceT m () -> ResourceT m ThreadId
- transResourceT :: (m a -> n b) -> ResourceT m a -> ResourceT n b
- joinResourceT :: ResourceT (ResourceT m) a -> ResourceT m a
- allocate :: MonadResource m => IO a -> (a -> IO ()) -> m (ReleaseKey, a)
- allocate_ :: MonadResource m => IO a -> IO () -> m ReleaseKey
- register :: MonadResource m => IO () -> m ReleaseKey
- release :: MonadIO m => ReleaseKey -> m ()
- unprotect :: MonadIO m => ReleaseKey -> m (Maybe (IO ()))
- resourceMask :: MonadResource m => ((forall a. ResourceT IO a -> ResourceT IO a) -> ResourceT IO b) -> m b
- class MonadIO m => MonadResource m where
  - liftResourceT :: ResourceT IO a -> m a
- type MonadResourceBase = MonadUnliftIO
- data InvalidAccess = InvalidAccess {
  - functionName :: String
  }
- class MonadIO m => MonadUnliftIO (m :: Type -> Type)
- type InternalState = IORef ReleaseMap
- getInternalState :: Monad m => ResourceT m InternalState
- runInternalState :: ResourceT m a -> InternalState -> m a
- withInternalState :: (InternalState -> m a) -> ResourceT m a
- createInternalState :: MonadIO m => m InternalState
- closeInternalState :: MonadIO m => InternalState -> m ()
- class Monad m => MonadThrow (m :: Type -> Type) where
  - throwM :: (HasCallStack, Exception e) => e -> m a

# Data types

data ResourceT m a #

The Resource transformer. This transformer keeps track of all registered actions, and calls them upon exit (via `runResourceT`). Actions may be registered via `register`, or resources may be allocated atomically via `allocate`. `allocate` corresponds closely to `bracket`.

Releasing may be performed before exit via the `release` function. This is a highly recommended optimization, as it will ensure that scarce resources are freed early. Note that calling `release` will deregister the action, so that a release action will only ever be called once.

Since 0.3.0

#### Instances

Instances details

MonadTrans ResourceT # |
Instance details Defined in Control.Monad.Trans.Resource.Internal Methods lift :: Monad m => m a -> ResourceT m a
MonadRWS r w s m => MonadRWS r w s (ResourceT m) # |
Instance details Defined in Control.Monad.Trans.Resource.Internal
MonadError e m => MonadError e (ResourceT m) # |
Instance details Defined in Control.Monad.Trans.Resource.Internal Methods throwError :: e -> ResourceT m a catchError :: ResourceT m a -> (e -> ResourceT m a) -> ResourceT m a
MonadReader r m => MonadReader r (ResourceT m) # |
Instance details Defined in Control.Monad.Trans.Resource.Internal Methods ask :: ResourceT m r local :: (r -> r) -> ResourceT m a -> ResourceT m a reader :: (r -> a) -> ResourceT m a
MonadState s m => MonadState s (ResourceT m) # |
Instance details Defined in Control.Monad.Trans.Resource.Internal Methods get :: ResourceT m s put :: s -> ResourceT m () state :: (s -> (a, s)) -> ResourceT m a
MonadWriter w m => MonadWriter w (ResourceT m) # |
Instance details Defined in Control.Monad.Trans.Resource.Internal Methods writer :: (a, w) -> ResourceT m a tell :: w -> ResourceT m () listen :: ResourceT m a -> ResourceT m (a, w) pass :: ResourceT m (a, w -> w) -> ResourceT m a
MonadFail m => MonadFail (ResourceT m) # | Since: 1.2.2
Instance details Defined in Control.Monad.Trans.Resource.Internal Methods fail :: String -> ResourceT m a
MonadFix m => MonadFix (ResourceT m) # | Since: 1.1.8
Instance details Defined in Control.Monad.Trans.Resource.Internal Methods mfix :: (a -> ResourceT m a) -> ResourceT m a
MonadIO m => MonadIO (ResourceT m) # |
Instance details Defined in Control.Monad.Trans.Resource.Internal Methods liftIO :: IO a -> ResourceT m a #
Alternative m => Alternative (ResourceT m) # | Since 1.1.5
Instance details Defined in Control.Monad.Trans.Resource.Internal Methods empty :: ResourceT m a (<|>) :: ResourceT m a -> ResourceT m a -> ResourceT m a some :: ResourceT m a -> ResourceT m [a] many :: ResourceT m a -> ResourceT m [a]
Applicative m => Applicative (ResourceT m) # |
Instance details Defined in Control.Monad.Trans.Resource.Internal Methods pure :: a -> ResourceT m a (<*>) :: ResourceT m (a -> b) -> ResourceT m a -> ResourceT m b liftA2 :: (a -> b -> c) -> ResourceT m a -> ResourceT m b -> ResourceT m c (*>) :: ResourceT m a -> ResourceT m b -> ResourceT m b (<*) :: ResourceT m a -> ResourceT m b -> ResourceT m a
Functor m => Functor (ResourceT m) # |
Instance details Defined in Control.Monad.Trans.Resource.Internal Methods fmap :: (a -> b) -> ResourceT m a -> ResourceT m b (<$) :: a -> ResourceT m b -> ResourceT m a
Monad m => Monad (ResourceT m) # |
Instance details Defined in Control.Monad.Trans.Resource.Internal Methods (>>=) :: ResourceT m a -> (a -> ResourceT m b) -> ResourceT m b (>>) :: ResourceT m a -> ResourceT m b -> ResourceT m b return :: a -> ResourceT m a
MonadPlus m => MonadPlus (ResourceT m) # | Since 1.1.5
Instance details Defined in Control.Monad.Trans.Resource.Internal Methods mzero :: ResourceT m a mplus :: ResourceT m a -> ResourceT m a -> ResourceT m a
MonadCatch m => MonadCatch (ResourceT m) # |
Instance details Defined in Control.Monad.Trans.Resource.Internal Methods catch :: (HasCallStack, Exception e) => ResourceT m a -> (e -> ResourceT m a) -> ResourceT m a
MonadMask m => MonadMask (ResourceT m) # |
Instance details Defined in Control.Monad.Trans.Resource.Internal Methods mask :: HasCallStack => ((forall a. ResourceT m a -> ResourceT m a) -> ResourceT m b) -> ResourceT m b uninterruptibleMask :: HasCallStack => ((forall a. ResourceT m a -> ResourceT m a) -> ResourceT m b) -> ResourceT m b generalBracket :: HasCallStack => ResourceT m a -> (a -> ExitCase b -> ResourceT m c) -> (a -> ResourceT m b) -> ResourceT m (b, c)
MonadThrow m => MonadThrow (ResourceT m) # |
Instance details Defined in Control.Monad.Trans.Resource.Internal Methods throwM :: (HasCallStack, Exception e) => e -> ResourceT m a #
MonadCont m => MonadCont (ResourceT m) # |
Instance details Defined in Control.Monad.Trans.Resource.Internal Methods callCC :: ((a -> ResourceT m b) -> ResourceT m a) -> ResourceT m a
PrimMonad m => PrimMonad (ResourceT m) # |
Instance details Defined in Control.Monad.Trans.Resource.Internal Associated Types type PrimState (ResourceT m) # Methods primitive :: (State# (PrimState (ResourceT m)) -> (# State# (PrimState (ResourceT m)), a #)) -> ResourceT m a #
MonadIO m => MonadResource (ResourceT m) # |
Instance details Defined in Control.Monad.Trans.Resource.Internal Methods liftResourceT :: ResourceT IO a -> ResourceT m a #
MonadUnliftIO m => MonadUnliftIO (ResourceT m) # | Since: 1.1.10
Instance details Defined in Control.Monad.Trans.Resource.Internal Methods withRunInIO :: ((forall a. ResourceT m a -> IO a) -> IO b) -> ResourceT m b #
type PrimState (ResourceT m) # |
Instance details Defined in Control.Monad.Trans.Resource.Internal type PrimState (ResourceT m) = PrimState m

type ResIO = ResourceT IO #

Convenient alias for `ResourceT IO`.

data ReleaseKey #

A lookup key for a specific release action. This value is returned by `register` and `allocate`, and is passed to `release`.

Since 0.3.0

# Unwrap

runResourceT :: MonadUnliftIO m => ResourceT m a -> m a #

Unwrap a `ResourceT` transformer, and call all registered release actions.

Note that there is some reference counting involved due to `resourceForkIO`. If multiple threads are sharing the same collection of resources, only the last call to `runResourceT` will deallocate the resources.

NOTE Since version 1.2.0, this function will throw a `ResourceCleanupException` if any of the cleanup functions throw an exception.

Since: 0.3.0

## Check cleanup exceptions

runResourceTChecked :: MonadUnliftIO m => ResourceT m a -> m a #

Backwards compatible alias for `runResourceT`.

Since: 1.1.11

data ResourceCleanupException #

Thrown when one or more cleanup functions themselves throw an exception during cleanup.

Since: 1.1.11

Constructors

ResourceCleanupException |
Fields rceOriginalException :: !(Maybe SomeException) If the `ResourceT` block exited due to an exception, this is that exception. Since: 1.1.11 rceFirstCleanupException :: !SomeException The first cleanup exception. We keep this separate from `rceOtherCleanupExceptions` to prove that there's at least one (i.e., a non-empty list). Since: 1.1.11 rceOtherCleanupExceptions :: ![SomeException] All other exceptions in cleanups. Since: 1.1.11

#### Instances

Instances details

Exception ResourceCleanupException # |
Instance details Defined in Control.Monad.Trans.Resource.Internal Methods toException :: ResourceCleanupException -> SomeException fromException :: SomeException -> Maybe ResourceCleanupException displayException :: ResourceCleanupException -> String
Show ResourceCleanupException # |
Instance details Defined in Control.Monad.Trans.Resource.Internal Methods showsPrec :: Int -> ResourceCleanupException -> ShowS show :: ResourceCleanupException -> String showList :: [ResourceCleanupException] -> ShowS

# Special actions

resourceForkWith :: MonadUnliftIO m => (IO () -> IO a) -> ResourceT m () -> ResourceT m a #

Introduce a reference-counting scheme to allow a resource context to be shared by multiple threads. Once the last thread exits, all remaining resources will be released.

The first parameter is a function which will be used to create the thread, such as `forkIO` or `async`.

Note that abuse of this function will greatly delay the deallocation of registered resources. This function should be used with care. A general guideline:

If you are allocating a resource that should be shared by multiple threads, and will be held for a long time, you should allocate it at the beginning of a new `ResourceT` block and then call `resourceForkWith` from there.

Since: 1.1.9

resourceForkIO :: MonadUnliftIO m => ResourceT m () -> ResourceT m ThreadId #

Launch a new reference counted resource context using `forkIO`.

This is defined as `resourceForkWith forkIO`.

Note: Using regular `forkIO` inside of a `ResourceT` is inherently unsafe, since the forked thread may try access the resources of the parent after they are cleaned up. When you use `resourceForkIO` or `resourceForkWith`, `ResourceT` is made aware of the new thread, and will only cleanup resources when all threads finish. Other concurrency mechanisms, like `concurrently` or `race`, are safe to use.

If you encounter `InvalidAccess` exceptions ("The mutable state is being accessed after cleanup"), use of `forkIO` is a possible culprit.

Since: 0.3.0

# Monad transformation

transResourceT :: (m a -> n b) -> ResourceT m a -> ResourceT n b #

Transform the monad a `ResourceT` lives in. This is most often used to strip or add new transformers to a stack, e.g. to run a `ReaderT`.

Note that this function is a slight generalization of `hoist`.

Since 0.3.0

joinResourceT :: ResourceT (ResourceT m) a -> ResourceT m a #

This function mirrors `join` at the transformer level: it will collapse two levels of `ResourceT` into a single `ResourceT`.

Since 0.4.6

# Registering/releasing

allocate #

Arguments

:: MonadResource m |
=> IO a | allocate
-> (a -> IO ()) | free resource
-> m (ReleaseKey, a) |

Perform some allocation, and automatically register a cleanup action.

This is almost identical to calling the allocation and then `register`ing the release action, but this properly handles masking of asynchronous exceptions.

Since 0.3.0

allocate_ #

Arguments

:: MonadResource m |
=> IO a | allocate
-> IO () | free resource
-> m ReleaseKey |

Perform some allocation where the return value is not required, and automatically register a cleanup action.

`allocate_` is to `allocate` as `bracket_` is to `bracket`

This is almost identical to calling the allocation and then `register`ing the release action, but this properly handles masking of asynchronous exceptions.

Since: 1.2.4

register :: MonadResource m => IO () -> m ReleaseKey #

Register some action that will be called precisely once, either when `runResourceT` is called, or when the `ReleaseKey` is passed to `release`.

Since 0.3.0

release :: MonadIO m => ReleaseKey -> m () #

Call a release action early, and deregister it from the list of cleanup actions to be performed.

Since 0.3.0

unprotect :: MonadIO m => ReleaseKey -> m (Maybe (IO ())) #

Unprotect resource from cleanup actions; this allows you to send resource into another resourcet process and reregister it there. It returns a release action that should be run in order to clean resource or Nothing in case if resource is already freed.

Since 0.4.5

resourceMask :: MonadResource m => ((forall a. ResourceT IO a -> ResourceT IO a) -> ResourceT IO b) -> m b #

Perform asynchronous exception masking.

This is more general then `Control.Exception.mask`, yet more efficient than `Control.Exception.Lifted.mask`.

Since 0.3.0

# Type class/associated types

class MonadIO m => MonadResource m where #

A `Monad` which allows for safe resource allocation. In theory, any monad transformer stack which includes a `ResourceT` can be an instance of `MonadResource`.

Note: `runResourceT` has a requirement for a `MonadUnliftIO m` monad, which allows control operations to be lifted. A `MonadResource` does not have this requirement. This means that transformers such as `ContT` can be an instance of `MonadResource`. However, the `ContT` wrapper will need to be unwrapped before calling `runResourceT`.

Since 0.3.0

Methods

liftResourceT :: ResourceT IO a -> m a #

Lift a `ResourceT IO` action into the current `Monad`.

Since 0.4.0

#### Instances

Instances details

MonadIO m => MonadResource (ResourceT m) # |
Instance details Defined in Control.Monad.Trans.Resource.Internal Methods liftResourceT :: ResourceT IO a -> ResourceT m a #
MonadResource m => MonadResource (MaybeT m) # |
Instance details Defined in Control.Monad.Trans.Resource.Internal Methods liftResourceT :: ResourceT IO a -> MaybeT 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 #
MonadResource m => MonadResource (IdentityT m) # |
Instance details Defined in Control.Monad.Trans.Resource.Internal Methods liftResourceT :: ResourceT IO a -> IdentityT m a #
MonadResource m => MonadResource (ReaderT r m) # |
Instance details Defined in Control.Monad.Trans.Resource.Internal Methods liftResourceT :: ResourceT IO a -> ReaderT r m a #
MonadResource m => MonadResource (StateT s m) # |
Instance details Defined in Control.Monad.Trans.Resource.Internal Methods liftResourceT :: ResourceT IO a -> StateT s m a #
MonadResource m => MonadResource (StateT s m) # |
Instance details Defined in Control.Monad.Trans.Resource.Internal Methods liftResourceT :: ResourceT IO a -> StateT s m a #
(Monoid w, MonadResource m) => MonadResource (WriterT w m) # |
Instance details Defined in Control.Monad.Trans.Resource.Internal Methods liftResourceT :: ResourceT IO a -> WriterT w m a #
(Monoid w, MonadResource m) => MonadResource (WriterT w m) # |
Instance details Defined in Control.Monad.Trans.Resource.Internal Methods liftResourceT :: ResourceT IO a -> WriterT w m a #
MonadResource m => MonadResource (ContT r m) # |
Instance details Defined in Control.Monad.Trans.Resource.Internal Methods liftResourceT :: ResourceT IO a -> ContT r m a #
(Monoid w, MonadResource m) => MonadResource (RWST r w s m) # |
Instance details Defined in Control.Monad.Trans.Resource.Internal Methods liftResourceT :: ResourceT IO a -> RWST r w s m a #
(Monoid w, MonadResource m) => MonadResource (RWST r w s m) # |
Instance details Defined in Control.Monad.Trans.Resource.Internal Methods liftResourceT :: ResourceT IO a -> RWST r w s m a #

type MonadResourceBase = MonadUnliftIO #

Deprecated: Use MonadUnliftIO directly instead

Just use `MonadUnliftIO` directly now, legacy explanation continues:

A `Monad` which can be used as a base for a `ResourceT`.

A `ResourceT` has some restrictions on its base monad:

- `runResourceT` requires an instance of `MonadUnliftIO`.
- `MonadResource` requires an instance of `MonadIO`

Note that earlier versions of `conduit` had a typeclass `ResourceIO`. This fulfills much the same role.

Since 0.3.2

## Low-level

data InvalidAccess #

Indicates either an error in the library, or misuse of it (e.g., a `ResourceT`'s state is accessed after being released).

Since 0.3.0

Constructors

InvalidAccess |
Fields functionName :: String

#### Instances

Instances details

Exception InvalidAccess # |
Instance details Defined in Control.Monad.Trans.Resource.Internal Methods toException :: InvalidAccess -> SomeException fromException :: SomeException -> Maybe InvalidAccess displayException :: InvalidAccess -> String
Show InvalidAccess # |
Instance details Defined in Control.Monad.Trans.Resource.Internal Methods showsPrec :: Int -> InvalidAccess -> ShowS show :: InvalidAccess -> String showList :: [InvalidAccess] -> ShowS

# Re-exports

class MonadIO m => MonadUnliftIO (m :: Type -> Type) #

Monads which allow their actions to be run in `IO`.

While `MonadIO` allows an `IO` action to be lifted into another monad, this class captures the opposite concept: allowing you to capture the monadic context. Note that, in order to meet the laws given below, the intuition is that a monad must have no monadic state, but may have monadic context. This essentially limits `MonadUnliftIO` to `ReaderT` and `IdentityT` transformers on top of `IO`.

Laws. For any function `run` provided by `withRunInIO`, it must meet the monad transformer laws as reformulated for `MonadUnliftIO`:

-     run . return = return

-     run (m >>= f) = run m >>= run . f

Instances of `MonadUnliftIO` must also satisfy the following laws:

Identity law
  `withRunInIO (\run -> run m) = m`
Inverse law
  `withRunInIO (\_ -> m) = liftIO m`

As an example of an invalid instance, a naive implementation of `MonadUnliftIO (StateT s m)` might be

    withRunInIO inner =
      StateT $ \s ->
        withRunInIO $ \run ->
          inner (run . flip evalStateT s)

This breaks the identity law because the inner `run m` would throw away any state changes in `m`.

Since: unliftio-core-0.1.0.0

Minimal complete definition

withRunInIO

#### Instances

Instances details

MonadUnliftIO IO |
Instance details Defined in Control.Monad.IO.Unlift Methods withRunInIO :: ((forall a. IO a -> IO a) -> IO b) -> IO b #
MonadUnliftIO m => MonadUnliftIO (ResourceT m) # | Since: 1.1.10
Instance details Defined in Control.Monad.Trans.Resource.Internal Methods withRunInIO :: ((forall a. ResourceT m a -> IO a) -> IO b) -> ResourceT m b #
MonadUnliftIO m => MonadUnliftIO (IdentityT m) |
Instance details Defined in Control.Monad.IO.Unlift Methods withRunInIO :: ((forall a. IdentityT m a -> IO a) -> IO b) -> IdentityT m b #
MonadUnliftIO m => MonadUnliftIO (ReaderT r m) |
Instance details Defined in Control.Monad.IO.Unlift Methods withRunInIO :: ((forall a. ReaderT r m a -> IO a) -> IO b) -> ReaderT r m b #

# Internal state

A `ResourceT` internally is a modified `ReaderT` monad transformer holding onto a mutable reference to all of the release actions still remaining to be performed. If you are building up a custom application monad, it may be more efficient to embed this `ReaderT` functionality directly in your own monad instead of wrapping around `ResourceT` itself. This section provides you the means of doing so.

type InternalState = IORef ReleaseMap #

The internal state held by a `ResourceT` transformer.

Since 0.4.6

getInternalState :: Monad m => ResourceT m InternalState #

Get the internal state of the current `ResourceT`.

Since 0.4.6

runInternalState :: ResourceT m a -> InternalState -> m a #

Unwrap a `ResourceT` using the given `InternalState`.

Since 0.4.6

withInternalState :: (InternalState -> m a) -> ResourceT m a #

Run an action in the underlying monad, providing it the `InternalState`.

Since 0.4.6

createInternalState :: MonadIO m => m InternalState #

Create a new internal state. This state must be closed with `closeInternalState`. It is your responsibility to ensure exception safety. Caveat emptor!

Since 0.4.9

closeInternalState :: MonadIO m => InternalState -> m () #

Close an internal state created by `createInternalState`.

Since 0.4.9

# Reexport

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

Methods

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

#### Instances

Instances details

MonadThrow STM |
Instance details Defined in Control.Monad.Catch Methods throwM :: (HasCallStack, Exception e) => e -> STM a #
MonadThrow IO |
Instance details Defined in Control.Monad.Catch Methods throwM :: (HasCallStack, Exception e) => e -> IO a #
MonadThrow Q |
Instance details Defined in Control.Monad.Catch Methods throwM :: (HasCallStack, Exception e) => e -> Q a #
MonadThrow Maybe |
Instance details Defined in Control.Monad.Catch Methods throwM :: (HasCallStack, Exception e) => e -> Maybe a #
MonadThrow List |
Instance details Defined in Control.Monad.Catch Methods throwM :: (HasCallStack, Exception e) => e -> [a] #
e ~ SomeException => MonadThrow (Either e) |
Instance details Defined in Control.Monad.Catch Methods throwM :: (HasCallStack, Exception e0) => e0 -> Either e a #
MonadThrow (ST s) |
Instance details Defined in Control.Monad.Catch Methods throwM :: (HasCallStack, Exception e) => e -> ST s a #
MonadThrow m => MonadThrow (ResourceT m) # |
Instance details Defined in Control.Monad.Trans.Resource.Internal Methods throwM :: (HasCallStack, Exception e) => e -> ResourceT m a #
MonadThrow m => MonadThrow (MaybeT m) |
Instance details Defined in Control.Monad.Catch Methods throwM :: (HasCallStack, Exception e) => e -> MaybeT m a #
MonadThrow m => MonadThrow (ExceptT e m) |
Instance details Defined in Control.Monad.Catch Methods throwM :: (HasCallStack, Exception e0) => e0 -> ExceptT e m a #
MonadThrow m => MonadThrow (IdentityT m) |
Instance details Defined in Control.Monad.Catch Methods throwM :: (HasCallStack, Exception e) => e -> IdentityT m a #
MonadThrow m => MonadThrow (ReaderT r m) |
Instance details Defined in Control.Monad.Catch Methods throwM :: (HasCallStack, Exception e) => e -> ReaderT r m a #
MonadThrow m => MonadThrow (StateT s m) |
Instance details Defined in Control.Monad.Catch Methods throwM :: (HasCallStack, Exception e) => e -> StateT s m a #
MonadThrow m => MonadThrow (StateT s m) |
Instance details Defined in Control.Monad.Catch Methods throwM :: (HasCallStack, Exception e) => e -> StateT s m a #
(MonadThrow m, Monoid w) => MonadThrow (WriterT w m) |
Instance details Defined in Control.Monad.Catch Methods throwM :: (HasCallStack, Exception e) => e -> WriterT w m a #
(MonadThrow m, Monoid w) => MonadThrow (WriterT w m) |
Instance details Defined in Control.Monad.Catch Methods throwM :: (HasCallStack, Exception e) => e -> WriterT w m a #
MonadThrow m => MonadThrow (ContT r m) |
Instance details Defined in Control.Monad.Catch Methods throwM :: (HasCallStack, Exception e) => e -> ContT r m a #
(MonadThrow m, Monoid w) => MonadThrow (RWST r w s m) |
Instance details Defined in Control.Monad.Catch Methods throwM :: (HasCallStack, Exception e) => e -> RWST r w s m a #
(MonadThrow m, Monoid w) => MonadThrow (RWST r w s m) |
Instance details Defined in Control.Monad.Catch Methods throwM :: (HasCallStack, Exception e) => e -> RWST r w s m a #