| Stability | experimental |
|---|---|
| Maintainer | tomac `at` pacific `dot` net `dot` au |
System.IOR
Description
Region based resource management for the IO monad. Based on the ideas and code from http://okmij.org/ftp/Haskell/regions.html
Type Classes and Auxiliary Data Types
IOR Monad
IO monad with support for region based resource allocation.
A computation of type wraps an action of type IOR r rs a
where IO ar is an unconstrained type variable indicating the current region
and rs is a collection of all accessible regions within the computation.
IO actions can be lifted into the IOR monad using liftIO.
It is safe to throw IOError-s inside an IOR computation.
Allocated resources will be released on exit automatically.
runIOR :: IOR r (RCons r RNil) a -> IO aSource
Create the initial region, r, and run the computation returning a
value of type .
IO a
newIOR :: IOR r' (RCons r' rs) a -> IOR r rs aSource
Create a new region r' inside r. All resources allocated in
r' are only accessible from r' and any of it's child regions.
On exit from the region, all allocated resources are automatically
released.
Region Tags
A region tag captures state of the region IORTag rr including all
currently allocated resources in r.