Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- mkAcquire1 :: IO a -> (a -> IO ()) -> Acquire a
- mkAcquireType1 :: IO a -> (a -> ReleaseType -> IO ()) -> Acquire a
- acquireReleaseSelf :: Acquire ((ReleaseType -> IO ()) -> a) -> Acquire a
- acquireReleaseKey :: ReleaseKey -> Acquire ()
- registerType :: MonadResource m => (ReleaseType -> IO ()) -> m ReleaseKey
- withAcquire :: (MonadMask m, MonadIO m) => Acquire a -> (a -> m b) -> m b
- withAcquireRelease :: (MonadMask m, MonadIO m) => Acquire a -> ((ReleaseType -> IO ()) -> a -> m b) -> m b
- newtype Restore m = Restore (forall x. m x -> m x)
- getRestoreIO :: MonadIO m => m (Restore IO)
- withRestoreIO :: (MonadMask m, MonadIO m) => ((forall x. IO x -> IO x) -> m a) -> m a
- once :: (MonadIO m, MonadMask m) => m () -> m ()
- onceK :: (MonadIO m, MonadMask m) => (a -> m ()) -> a -> m ()
Acquire
mkAcquire1 :: IO a -> (a -> IO ()) -> Acquire a Source #
Like mkAcquire
, but the release function will be run at most once.
mkAcquireType1 :: IO a -> (a -> ReleaseType -> IO ()) -> Acquire a Source #
Like mkAcquireType
, but the release function will be run at most once.
acquireReleaseSelf :: Acquire ((ReleaseType -> IO ()) -> a) -> Acquire a Source #
Build an Acquire
having access to its own release function.
MonadResource
acquireReleaseKey :: ReleaseKey -> Acquire () Source #
acquireReleaseKey
will unprotect
the ReleaseKey
,
and use Acquire
to manage the release action instead.
registerType :: MonadResource m => (ReleaseType -> IO ()) -> m ReleaseKey Source #
Like register
, but gives access to the ReleaseType
too.
MonadMask
withAcquire :: (MonadMask m, MonadIO m) => Acquire a -> (a -> m b) -> m b Source #
Like withAcquireRelease
, but doesn't take the extra release function.
withAcquireRelease :: (MonadMask m, MonadIO m) => Acquire a -> ((ReleaseType -> IO ()) -> a -> m b) -> m b Source #
acquires the withAcquireRelease
acq \release a -> acta
and
automaticaly releases it when mb
returns or throws an exception.
If desired, release
can be used to release a
earlier.
Restore
Wrapper around a “restore” function like the one given
by
, in a particular mask
(\restore -> ...)Monad
m
.
Restore (forall x. m x -> m x) |