-- 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.2.0.2
module Context.Resource
-- | An opaque resource provider.
data Provider m 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 m res a. (MonadIO m, MonadMask m) => (forall r. (res -> m r) -> m r) -> (Provider m res -> m a) -> m a
-- | Acquire a resource from the specified Provider, for the
-- duration of the specified action.
withResource :: forall m res a. (MonadIO m, MonadThrow m) => Provider m res -> (res -> m a) -> m 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 :: forall m res a. (MonadIO m, MonadMask m) => Provider m res -> res -> m a -> m 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 :: forall m res a. (MonadIO m, MonadMask m) => Provider m res -> (res -> m a) -> m a