@hackage general-allocate0.2.3.1

Exception-safe resource management in more monads

Write monad-generic resource-safe code that can be instantiated in both IO and pure contexts.

exceptions provides MonadMask, which generalizes the bracket pattern but only for monads that can catch exceptions (i.e., transformer stacks on top of IO or Either SomeException). resourcet provides MonadResource, which allows for arbitrarily interleaved allocations and releases of resources, but only for MonadUnliftIO. This module provides type-classes for both types of resource allocation which can be properly instantiated at more monads, through the expedient of weakening a requirement which doesn't matter in the cases where it's not met: In monads that can't catch exceptions, release actions will not be called in the case of an exception (asynchronous or otherwise), but in those same monads the entire monadic computation will be terminated by the same exception and so resource management has ended anyway.

See Control.Monad.With for scoped (bracket-style) resource management.

See Control.Monad.Allocate for arbitrary lifetime resource management.

See Data.GeneralAllocate to define values that can be used for allocation in either resource management style.