Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- async :: (MonadMask m, MonadUnliftIO m) => m a -> m (Async a)
- foldConcurrently :: (MonadUnliftIO m, MonadMask m, Monoid a, Foldable t) => t (m a) -> m a
- immortalCreate :: (MonadMask m, MonadUnliftIO m) => (Either SomeException () -> m ()) -> m () -> m a
- immortalCreateLogged :: (MonadMask m, MonadUnliftIO m, MonadLogger m) => m () -> m a
- data ThreadContext = ThreadContext {}
- getThreadContext :: MonadIO m => m ThreadContext
- withThreadContext :: (MonadIO m, MonadMask m) => ThreadContext -> m a -> m a
Documentation
async :: (MonadMask m, MonadUnliftIO m) => m a -> m (Async a) Source #
async
but passing the thread context along
foldConcurrently :: (MonadUnliftIO m, MonadMask m, Monoid a, Foldable t) => t (m a) -> m a Source #
Run a list of actions concurrently
The forked threads will have the current thread context copied to them.
:: (MonadMask m, MonadUnliftIO m) | |
=> (Either SomeException () -> m ()) | How to handle unexpected finish |
-> m () | The action to run persistently |
-> m a |
Wrapper around creating Control.Immortal processes
Features:
- Ensures the thread context is correctly passed to both your spawned action and your error handler
- Blocks forever after spawning your thread.
immortalCreateLogged :: (MonadMask m, MonadUnliftIO m, MonadLogger m) => m () -> m a Source #
immortalCreate
with logging of unexpected finishes
data ThreadContext Source #
getThreadContext :: MonadIO m => m ThreadContext Source #
withThreadContext :: (MonadIO m, MonadMask m) => ThreadContext -> m a -> m a Source #