HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Moduleresourcet-1.3.0Haskell2010

Control.Monad.Trans.Resource.Internal

  • 6 types
  • 1 class
  • 6 values
  • Packageresourcet-1.3.0
  • Exports13
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceInternal.hs
classclass MonadIO m => MonadResource (m :: Type -> Type) 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

Instances12MonadResource, …
datadata 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

Constructors

newtypenewtype ResourceT (m :: Type -> Type) 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

Constructors

Instances22MonadTrans, MonadRWS, MonadError, MonadReader, MonadState, MonadWriter, …
valuetransResourceT :: (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

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

Constructors

Instances2Show, Exception