From 11f3cf8edf4d743dee830b9db28da9ca97716901 Mon Sep 17 00:00:00 2001 From: Joris Dral Date: Tue, 10 Dec 2024 21:29:51 +0100 Subject: [PATCH 1/2] Add `withIOCtx` --- src/System/IO/BlockIO.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/System/IO/BlockIO.hs b/src/System/IO/BlockIO.hs index 11c5592..419991b 100644 --- a/src/System/IO/BlockIO.hs +++ b/src/System/IO/BlockIO.hs @@ -7,9 +7,10 @@ module System.IO.BlockIO ( -- * I\/O context and initialisation IOCtx, - initIOCtx, IOCtxParams(..), defaultIOCtxParams, + withIOCtx, + initIOCtx, closeIOCtx, -- * Performing I\/O @@ -34,7 +35,7 @@ import Control.Concurrent.MVar import Control.Concurrent.QSemN import Control.Concurrent.Chan import Control.Exception (mask_, throw, ArrayException(UndefinedElement), - finally, assert, throwIO) + finally, assert, throwIO, bracket) import System.IO.Error import GHC.IO.Exception (IOErrorType(ResourceVanished, InvalidArgument)) @@ -90,6 +91,9 @@ defaultIOCtxParams = ioctxConcurrencyLimit = 64 * 3 } +withIOCtx :: IOCtxParams -> (IOCtx -> IO a) -> IO a +withIOCtx params = bracket (initIOCtx params) closeIOCtx + initIOCtx :: IOCtxParams -> IO IOCtx initIOCtx IOCtxParams {ioctxBatchSizeLimit, ioctxConcurrencyLimit} = do #if MIN_VERSION_base(4,16,0) From 553fbef65e621cfd681e303dd715c00ef6126d0e Mon Sep 17 00:00:00 2001 From: Joris Dral Date: Tue, 10 Dec 2024 21:30:05 +0100 Subject: [PATCH 2/2] Add `index-state` to `cabal.project` --- cabal.project | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cabal.project b/cabal.project index e6fdbad..94e1a92 100644 --- a/cabal.project +++ b/cabal.project @@ -1 +1,6 @@ +index-state: + -- Bump this if you need newer packages from Hackage + -- current date: quickcheck-lockstep-0.6.0 + , hackage.haskell.org 2024-12-10T00:00:00Z + packages: .