Module

Control.Monad.Resource.Trans

#ResourceT

newtype ResourceT (m :: Type -> Type) a

The resource cleanup monad transformer.

This monad transformer extends the base monad with a mutable registry for tracking resource cleanup actions. At the end of evaluation all remaining cleanup actions are executed.

Constructors

Instances

#Resource

type Resource = ResourceT Aff

The Resource monad is a synonym for ResourceT Aff.

#mapResourceT

mapResourceT :: forall m m' a b. (m a -> m' b) -> ResourceT m a -> ResourceT m' b

Change the type of the result in a ResourceT monad action.

#runResourceT

runResourceT :: forall m a b. (m a -> Aff b) -> ResourceT m a -> Aff b

Run a computation in the ResourceT monad, while changing it to Aff to ensure the cleanup will run safely.

#runResource

runResource :: forall a. Resource a -> Aff a

Run an Aff computation in the ResourceT monad.

#joinResourceT

joinResourceT :: forall m a. 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.

Modules