-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Thread-safe, pool-compatible resource provider -- -- A thread-safe, pool-compatible resource provider abstraction that -- supports resource-sharing within nested actions. @package context-resource @version 0.1.0.0 module Context.Resource -- | An opaque resource provider. data Provider res -- | Given a with-style function to acquire a resource, supplies -- the caller with a resource Provider. This Provider -- should ideally be long-lived and threaded throughout the application -- to the components that need to acquire resources. withProvider :: (forall r. (res -> IO r) -> IO r) -> (Provider res -> IO a) -> IO a -- | Acquire a resource from the specified Provider, for the -- duration of the specified action. withResource :: Provider res -> (res -> IO a) -> IO a -- | Tell the specified Provider to share the specified resource for -- the duration of the specified action. All calls to withResource -- (or withSharedResource) within the action will return the -- shared resource. shareResource :: Provider res -> res -> IO a -> IO a -- | Acquire a resource from the specified Provider and share that -- resource for the duration of the specified action. All calls to -- withResource (or withSharedResource) within the action -- will return the shared resource. -- -- This is a convenience function combining withResource and -- shareResource. withSharedResource :: Provider res -> (res -> IO a) -> IO a