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

Add withResourceManager

parent c7c31854
No related branches found
No related tags found
No related merge requests found
...@@ -10,11 +10,12 @@ module Quasar.Disposable ( ...@@ -10,11 +10,12 @@ module Quasar.Disposable (
-- ** ResourceManager -- ** ResourceManager
ResourceManager, ResourceManager,
HasResourceManager(..), HasResourceManager(..),
withResourceManager,
newResourceManager, newResourceManager,
disposeEventually,
attachDisposable, attachDisposable,
attachDisposeAction, attachDisposeAction,
attachDisposeAction_, attachDisposeAction_,
disposeEventually,
) where ) where
import Control.Concurrent.STM import Control.Concurrent.STM
...@@ -135,6 +136,9 @@ class HasResourceManager a where ...@@ -135,6 +136,9 @@ class HasResourceManager a where
instance IsDisposable ResourceManager where instance IsDisposable ResourceManager where
toDisposable = undefined toDisposable = undefined
withResourceManager :: (ResourceManager -> IO a) -> IO a
withResourceManager = bracket newResourceManager (awaitIO <=< dispose)
newResourceManager :: IO ResourceManager newResourceManager :: IO ResourceManager
newResourceManager = pure ResourceManager newResourceManager = pure ResourceManager
......
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