unliftio-pool 0.2.2.0 → 0.4.0.0
raw patch · 2 files changed
+14/−9 lines, 2 filesdep −timedep ~resource-poolPVP ok
version bump matches the API change (PVP)
Dependencies removed: time
Dependency ranges changed: resource-pool
API changes (from Hackage documentation)
- UnliftIO.Pool: createPool :: MonadUnliftIO m => m a -> (a -> m ()) -> Int -> NominalDiffTime -> Int -> m (Pool a)
+ UnliftIO.Pool: data PoolConfig a
+ UnliftIO.Pool: setNumStripes :: Maybe Int -> PoolConfig a -> PoolConfig a
Files
- src/UnliftIO/Pool.hs +12/−6
- unliftio-pool.cabal +2/−3
src/UnliftIO/Pool.hs view
@@ -1,7 +1,8 @@ module UnliftIO.Pool ( Pool+ , P.PoolConfig+ , P.setNumStripes , LocalPool- , createPool , withResource , takeResource , tryWithResource@@ -11,18 +12,23 @@ , 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++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.0.0 synopsis: Data.Pool generalized to MonadUnliftIO. description: This is a generalization of Data.Pool to MonadUnliftIO. license: BSD3@@ -17,8 +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+ , resource-pool >= 0.4 && < 0.5 , transformers >= 0.5 && < 0.6 , unliftio-core >= 0.1.1 && < 0.3 hs-source-dirs: src