| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Freckle.App.Async
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
- forConcurrently :: (MonadUnliftIO m, MonadMask m, Traversable t) => t a -> (a -> m b) -> m (t b)
- forConcurrently_ :: (MonadUnliftIO m, MonadMask m, Traversable t) => t a -> (a -> m b) -> m ()
- mapConcurrently :: (MonadUnliftIO m, MonadMask m, Traversable t) => (a -> m b) -> t a -> m (t b)
- mapConcurrently_ :: (MonadUnliftIO m, MonadMask m, Traversable t) => (a -> m b) -> t a -> m ()
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.
Arguments
| :: (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 #
Constructors
| ThreadContext | |
Fields | |
getThreadContext :: MonadIO m => m ThreadContext Source #
withThreadContext :: (MonadIO m, MonadMask m) => ThreadContext -> m a -> m a Source #
forConcurrently :: (MonadUnliftIO m, MonadMask m, Traversable t) => t a -> (a -> m b) -> m (t b) Source #
forConcurrently but passing the thread context along
forConcurrently_ :: (MonadUnliftIO m, MonadMask m, Traversable t) => t a -> (a -> m b) -> m () Source #
forConcurrently_ but passing the thread context along
mapConcurrently :: (MonadUnliftIO m, MonadMask m, Traversable t) => (a -> m b) -> t a -> m (t b) Source #
mapConcurrently but passing the thread context along
mapConcurrently_ :: (MonadUnliftIO m, MonadMask m, Traversable t) => (a -> m b) -> t a -> m () Source #
mapConcurrently_ but passing the thread context along