unliftio-pool 0.2.2.0 → 0.4.3.1
raw patch · 2 files changed
Files
- src/UnliftIO/Pool.hs +17/−6
- unliftio-pool.cabal +2/−4
src/UnliftIO/Pool.hs view
@@ -1,7 +1,10 @@ module UnliftIO.Pool ( Pool+ , P.PoolConfig+ , P.setNumStripes , LocalPool- , createPool+ , mkDefaultPoolConfig+ , newPool , withResource , takeResource , tryWithResource@@ -11,18 +14,26 @@ , destroyAllResources ) where -import Control.Monad.IO.Unlift (MonadUnliftIO(..), liftIO)+import Control.Monad.IO.Unlift (MonadUnliftIO(..), liftIO, unliftIO) import qualified Data.Pool as P-import Data.Time.Clock (NominalDiffTime)+import Data.Pool (PoolConfig) type Pool = P.Pool type LocalPool = P.LocalPool -createPool :: MonadUnliftIO m => m a -> (a -> m ()) -> Int -> NominalDiffTime -> Int -> m (Pool a)-createPool create destroy stripes keepAlive maxPerStripe =+mkDefaultPoolConfig :: MonadUnliftIO m => m a -> (a -> m ()) -> Double -> Int -> m (PoolConfig a)+mkDefaultPoolConfig create destroy keepAlive maxOpen = withRunInIO $ \io ->- liftIO $ P.createPool (io create) (io . destroy) stripes keepAlive maxPerStripe+ pure $ P.defaultPoolConfig (io create) (io . destroy) keepAlive maxOpen++-- | Lifted version of 'P.newPool'+--+-- @since 0.4.2.0+newPool :: MonadUnliftIO m => PoolConfig a -> m (Pool a)+newPool config =+ withRunInIO $ \io ->+ liftIO $ P.newPool config withResource :: MonadUnliftIO m => Pool a -> (a -> m b) -> m b withResource pool action =
unliftio-pool.cabal view
@@ -1,5 +1,5 @@ name: unliftio-pool-version: 0.2.2.0+version: 0.4.3.1 synopsis: Data.Pool generalized to MonadUnliftIO. description: This is a generalization of Data.Pool to MonadUnliftIO. license: BSD3@@ -17,9 +17,7 @@ library exposed-modules: UnliftIO.Pool build-depends: base >= 4.10 && < 5- , resource-pool >= 0.2.3.2 && < 0.3 || >= 0.3.1.0 && < 0.4- , time >= 1.8 && < 2- , transformers >= 0.5 && < 0.6+ , resource-pool >= 0.4 && < 0.6 , unliftio-core >= 0.1.1 && < 0.3 hs-source-dirs: src default-language: Haskell2010