multitasking
Safe HaskellNone
LanguageGHC2021

Multitasking.Race

Contents

Synopsis

Race

raceTwo :: MonadIO m => IO a -> IO a -> m a Source #

Race two actions. The slower one is canceled.

raceTwoMaybe :: MonadIO m => IO (Maybe a) -> IO (Maybe a) -> m (Maybe a) Source #

Race two actions which may produce results. The slower one is canceled.

raceMany :: (MonadIO m, Traversable t) => t (IO a) -> m a Source #

Race many actions which may produce results. When one action produces a result, the other ones are cancelled.

raceManyMaybe :: (MonadIO m, Traversable t) => t (IO (Maybe a)) -> m (Maybe a) Source #

Race many actions. The slower ones are canceled. If no actions produce a result, then the resulting task will also produce nothing.

Timeout

timeout :: MonadIO m => Duration -> IO a -> m (Maybe a) Source #

Time out an action.