diff --git a/src/Quasar/Awaitable.hs b/src/Quasar/Awaitable.hs index a004e80be596d37f7406bcdf3fdc9af2d5f57028..1094b6787587cd220b0803b5c03cb739a734e761 100644 --- a/src/Quasar/Awaitable.hs +++ b/src/Quasar/Awaitable.hs @@ -14,6 +14,7 @@ module Quasar.Awaitable ( -- * Awaiting multiple awaitables awaitEither, awaitAny, + awaitAny2, -- * AsyncVar AsyncVar, @@ -271,6 +272,10 @@ awaitAny xs = toAwaitable $ FnAwaitable $ stepAll Empty Empty $ runAwaitable <$> stepAll Empty Empty newAwaitableSteps +awaitAny2 :: IsAwaitable r a => a -> a -> Awaitable r +awaitAny2 x y = awaitAny (x :| [y]) + + groupLefts :: Either (Either ex a) (Either ex b) -> Either ex (Either a b) groupLefts (Left x) = Left <$> x groupLefts (Right y) = Right <$> y