Module

Control.Monad.Resource.Trans

Package
purescript-resourcet
Repository
robertdp/purescript-resourcet

#ResourceT Source

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 Source

type Resource = ResourceT Aff

The Resource monad is a synonym for ResourceT Aff.

#mapResourceT Source

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 Source

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 Source

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

Run an Aff computation in the ResourceT monad.

#joinResourceT Source

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.