regions-0.7: Provides the region monad for safely opening and working with scarce resources.

MaintainerBas van Dijk <>



This module is not intended for end-users. It should only be used by library authors wishing to extend this regions library.



type CloseAction = IO ()Source

An IO computation that closes or finalizes a resource. For example hClose or free.

data CloseHandle r Source

A handle to a CloseAction that allows you to duplicate the action to a parent region using dup.


onExit :: MonadIO pr => CloseAction -> RegionT s pr (CloseHandle (RegionT s pr))Source

Register the CloseAction in the region. When the region terminates all registered close actions will be perfomed if they're not duplicated to a parent region.