Safe Haskell | None |
---|---|
Language | GHC2021 |
ConIO.Race
Synopsis
- raceTwo :: IO a -> IO a -> ConIO (Task a)
- raceTwoMaybe :: IO (Maybe a) -> IO (Maybe a) -> ConIO (Task (Maybe a))
- raceMany :: Traversable t => t (IO a) -> ConIO (Task a)
- raceManyMaybe :: Traversable t => t (IO (Maybe a)) -> ConIO (Task (Maybe a))
- raceTwoTasks :: Task a -> Task a -> ConIO (Task a)
- raceTwoTasksMaybe :: Task (Maybe a) -> Task (Maybe a) -> ConIO (Task (Maybe a))
- raceManyTasks :: Traversable t => t (Task a) -> ConIO (Task a)
- raceManyTasksMaybe :: Traversable t => t (Task (Maybe a)) -> ConIO (Task (Maybe a))
- timeout :: Duration -> IO a -> ConIO (Maybe a)
- timeoutTask :: Duration -> Task a -> ConIO (Task (Maybe a))
- waitDuration :: MonadIO m => Duration -> m ()
- waitForever :: MonadIO m => m a
- data Duration
- fromSeconds :: Word -> Duration
- fromMilliseconds :: Word -> Duration
- fromMicroseconds :: Word -> Duration
- durationToMicroseconds :: Duration -> Word
Race
raceTwoMaybe :: IO (Maybe a) -> IO (Maybe a) -> ConIO (Task (Maybe a)) Source #
Race two actions which may produce results. If one action produces a result, the other one is cancelled. If no actions produce a result, then the resulting task also produces nothing.
raceMany :: Traversable t => t (IO a) -> ConIO (Task a) Source #
Race many actions which may produce results. If one action produces a result, the other ones are cancelled. If no actions produce a result, then the resulting task also produces nothing.
raceManyMaybe :: Traversable t => t (IO (Maybe a)) -> ConIO (Task (Maybe a)) Source #
Race many actions. The slower ones are canceled.
raceManyTasks :: Traversable t => t (Task a) -> ConIO (Task a) Source #
raceManyTasksMaybe :: Traversable t => t (Task (Maybe a)) -> ConIO (Task (Maybe a)) Source #
Timeout
timeoutTask :: Duration -> Task a -> ConIO (Task (Maybe a)) Source #
Time out a Task
, counting the Duration
down from the moment that timeoutTask
is executed.
The total runtime of the Task
does not matter.
Waiting
waitDuration :: MonadIO m => Duration -> m () Source #
Waits forever
waitForever :: MonadIO m => m a Source #
Waits forever