Safe Haskell | None |
---|---|
Language | GHC2021 |
Polysemy.Conc.Effect.Race
Description
Documentation
data Race (a :: Type -> Type) b where Source #
Abstract the concept of running two programs concurrently, aborting the other when one terminates.
Timeout
is a simpler variant, where one thread just sleeps for a given interval.
Constructors
Race :: forall (a :: Type -> Type) a1 b1. a a1 -> a b1 -> Race a (Either a1 b1) | Run both programs concurrently, returning the result of the faster one. |
Timeout :: forall u (a :: Type -> Type) a1 b1. TimeUnit u => a a1 -> u -> a b1 -> Race a (Either a1 b1) | Run the first action if the second action doesn't finish within the specified interval. |