Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- data RefCounted = RefCounted {}
- newRefCounted :: MonadIO m => IO () -> m RefCounted
- releaseRefCounted :: MonadIO m => RefCounted -> m ()
- takeRefCounted :: MonadIO m => RefCounted -> m ()
- resourceTRefCount :: MonadResource f => RefCounted -> f ()
- wrapped :: MonadResource m => m (ReleaseKey, a) -> m (RefCounted, a)
Documentation
data RefCounted Source #
A RefCounted
will perform the specified action when the count reaches 0
newRefCounted :: MonadIO m => IO () -> m RefCounted Source #
Create a counter with a value of 1
releaseRefCounted :: MonadIO m => RefCounted -> m () Source #
Decrement the value, the action will be run promptly and in this thread if the counter reached 0.
takeRefCounted :: MonadIO m => RefCounted -> m () Source #
Increment the counter by 1
resourceTRefCount :: MonadResource f => RefCounted -> f () Source #
Hold a reference for the duration of the MonadResource
action
wrapped :: MonadResource m => m (ReleaseKey, a) -> m (RefCounted, a) Source #