Skip to content
Snippets Groups Projects
Commit 80b9c54e authored by Jens Nolte's avatar Jens Nolte
Browse files

Change the generic variant of withScopedResourceManager to be the default variant

parent c606b92c
No related branches found
No related tags found
No related merge requests found
...@@ -106,7 +106,7 @@ class IsRetrievable v o => IsObservable v o | o -> v where ...@@ -106,7 +106,7 @@ class IsRetrievable v o => IsObservable v o | o -> v where
observeBlocking :: (IsObservable v o, MonadResourceManager m) => o -> (ObservableMessage v -> m ()) -> m a observeBlocking :: (IsObservable v o, MonadResourceManager m) => o -> (ObservableMessage v -> m ()) -> m a
observeBlocking observable handler = do observeBlocking observable handler = do
-- `withScopedResourceManager` removes the `observe` callback when the `handler` fails. -- `withScopedResourceManager` removes the `observe` callback when the `handler` fails.
genericWithScopedResourceManager do withScopedResourceManager do
var <- liftIO newEmptyTMVarIO var <- liftIO newEmptyTMVarIO
observe observable \msg -> liftIO $ atomically do observe observable \msg -> liftIO $ atomically do
void $ tryTakeTMVar var void $ tryTakeTMVar var
......
...@@ -9,7 +9,6 @@ module Quasar.ResourceManager ( ...@@ -9,7 +9,6 @@ module Quasar.ResourceManager (
registerDisposable, registerDisposable,
registerDisposeAction, registerDisposeAction,
withScopedResourceManager, withScopedResourceManager,
genericWithScopedResourceManager,
onResourceManager, onResourceManager,
captureDisposable, captureDisposable,
captureDisposable_, captureDisposable_,
...@@ -156,12 +155,8 @@ registerNewResource action = mask_ $ lockResourceManager do ...@@ -156,12 +155,8 @@ registerNewResource action = mask_ $ lockResourceManager do
registerNewResource_ :: (IsDisposable a, MonadResourceManager m) => m a -> m () registerNewResource_ :: (IsDisposable a, MonadResourceManager m) => m a -> m ()
registerNewResource_ action = void $ registerNewResource action registerNewResource_ action = void $ registerNewResource action
withScopedResourceManager :: MonadResourceManager m => ResourceManagerIO a -> m a withScopedResourceManager :: MonadResourceManager m => m a -> m a
withScopedResourceManager action = withScopedResourceManager action =
bracket newResourceManager dispose \scope -> onResourceManager scope action
genericWithScopedResourceManager :: MonadResourceManager m => m a -> m a
genericWithScopedResourceManager action =
bracket newResourceManager dispose \scope -> localResourceManager scope action bracket newResourceManager dispose \scope -> localResourceManager scope action
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment