-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Thread-safe resource pools. -- -- Useful for stuff like database connection pools. @package pool @version 0.1.1 module Data.Pool data Pool a -- | Create a new pool without any resource alive checking. createPool :: MonadControlIO m => IO a -> (a -> IO ()) -> Int -> (Pool a -> m b) -> m b -- | Create a new pool, including a function to check if a resource is -- still alive. Stale resources will automatically be removed from the -- pool. createPoolCheckAlive :: MonadControlIO m => IO a -> (a -> IO ()) -> Int -> (Pool a -> m b) -> (a -> IO Bool) -> m b -- | Attempt to run the given action with a resource from the given -- Pool. Returns Nothing if no resource was available. withPool :: MonadControlIO m => Pool a -> (a -> m b) -> m (Maybe b) -- | This function throws a PoolExhaustedException when no resources -- are available. See withPoolAllocate to avoid this. withPool' :: MonadControlIO m => Pool a -> (a -> m b) -> m b -- | Same as withPool', but instead of throwing a -- PoolExhaustedException when there the maximum number of -- resources are created and allocated, it allocates a new resource, -- passes it to the subprocess and then frees it. withPoolAllocate :: MonadControlIO m => Pool a -> (a -> m b) -> m b data PoolStats PoolStats :: Int -> Int -> Int -> PoolStats poolStatsMax :: PoolStats -> Int poolStatsAvailable :: PoolStats -> Int poolStatsCreated :: PoolStats -> Int poolStats :: Pool a -> IO PoolStats instance Typeable PoolExhaustedException instance Show PoolExhaustedException instance Exception PoolExhaustedException