Open thomasjm opened 1 year ago
I'd like some generalized versions, too. MonadMask can be another candidate.
There exists https://hackage.haskell.org/package/unliftio-pool :slightly_smiling_face:
Nice! Thanks!
This should do the job:
withResourceM :: MonadBaseControl IO m => Pool a -> (a -> m b) -> m b
withResourceM pool func = control $ \run -> Pool.withResource pool (run . func)
Feel free to add it to the library (or steal it for another library).
This should do the job:
withResourceM :: MonadBaseControl IO m => Pool a -> (a -> m b) -> m b withResourceM pool func = control $ \run -> Pool.withResource pool (run . func)
Feel free to add it to the library (or steal it for another library).
Thanks! It saved my day!
Version 0.3.0.0 changed the type of
withResource
fromto
I'm not the biggest fan of
MonadBaseControl
, but it was nice to be able to dowithResource
in more general monad stacks. Would it be possible to bring something like that back? I think MonadUnliftIO is a nice candidate.P.S. Thanks for maintaining this library!