From 0fe26b96ce3f989642f7e586f45918028172edc9 Mon Sep 17 00:00:00 2001 From: Jens Nolte <git@queezle.net> Date: Tue, 31 Aug 2021 21:06:37 +0200 Subject: [PATCH] Add askResourceManager documentation --- src/Quasar/Disposable.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Quasar/Disposable.hs b/src/Quasar/Disposable.hs index 8a4b1a2..2cac4d6 100644 --- a/src/Quasar/Disposable.hs +++ b/src/Quasar/Disposable.hs @@ -232,11 +232,12 @@ class (MonadAwait m, MonadMask m, MonadIO m) => MonadResourceManager m where localResourceManager :: ResourceManager -> m a -> m a + -- | Get the underlying resource manager. This is intended to fork the Monad (e.g. in the `async`-Function) and must + -- not be used to dispose the resource manager (also doing so is a deadlock). + -- + -- Might be replaced with an alternative mechanism in the future. askResourceManager :: m ResourceManager - -- TODO askResourceManager could maybe be replaced with - --withRunResourceContextInIO :: (((forall f. MonadResourceManager f => f a) -> IO a) -> m b) -> m b - instance (MonadAwait m, MonadMask m, MonadIO m) => MonadResourceManager (ReaderT ResourceManager m) where registerDisposable disposable = do -- GitLab