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

Safe HaskellNone




newtype Acquire a Source

A method for acquiring a scarce resource, providing the means of freeing it when no longer needed. This data type provides Functor@Applicative@Monad instances for composing different resources together. You can allocate these resources using either the bracket pattern (via with) or using ResourceT (via allocateAcquire).

This concept was originally introduced by Gabriel Gonzalez and described at: The implementation in this package is slightly different, due to taking a different approach to async exception safety.

Since 1.1.0


Acquire ((forall b. IO b -> IO b) -> IO (Allocated a)) 

data Allocated a Source


Allocated !a !(IO ()) 

with :: MonadBaseControl IO m => Acquire a -> (a -> m b) -> m bSource

Allocate the given resource and provide it to the provided function. The resource will be freed as soon as the inner block is exited, whether normally or via an exception. This function is similar in function to bracket.

Since 1.1.0



:: IO a

acquire the resource

-> (a -> IO ())

free the resource

-> Acquire a 

Create an Acquire value using the given allocate and free functions.

Since 1.1.0