import { MergeDecision } from "@effect/core/stream/Channel/MergeDecision" /** * Runs both sinks in parallel on the input, returning the result or the error * from the one that finishes first. * * @tsplus static effect/core/stream/Sink.Aspects raceBoth * @tsplus pipeable effect/core/stream/Sink raceBoth */ export function raceBoth(that: Sink, capacity = 16) { return ( self: Sink ): Sink> => self.raceWith( that, (selfDone) => MergeDecision.done>( Effect.done(selfDone).map(Either.left) ), (thatDone) => MergeDecision.done>( Effect.done(thatDone).map(Either.right) ), capacity ) }