// ets_tracing: off import * as A from "../../../Collections/Immutable/Array/index.js" import * as Tp from "../../../Collections/Immutable/Tuple/index.js" import type * as C from "./core.js" import type * as U from "./utils.js" import * as ZipWithPar from "./zipWithPar.js" /** * Runs both sinks in parallel on the input and combines the results in a tuple. */ export function zipPar_[]>( ...[s1, s2, ...sinks]: SN & { readonly 0: C.Sink readonly 1: C.Sink } ): C.Sink< U._R, U._InErr, U._In, U._OutErr, U._L, Tp.Tuple<{ [K in keyof SN]: U._Z }> > { const init = ZipWithPar.zipWithPar_(s1, s2, Tp.tuple) // @ts-expect-error return A.reduce_(sinks, init, (acc, v) => // @ts-expect-error ZipWithPar.zipWithPar_(acc, v, (a, b) => Tp.append_(a, b)) ) } /** * Runs both sinks in parallel on the input and combines the results in a tuple. * * @ets_data_first zipPar_ */ export function zipPar[]>( ...[s1, ...sinks]: SN & { readonly 0: C.Sink } ) { return ( self: C.Sink ): C.Sink< R & U._R, InErr & U._InErr, In & U._In, OutErr | U._OutErr, L | U._L, Tp.Tuple< [ Z, ...{ [K in keyof SN]: U._Z } ] > // @ts-expect-error > => zipPar_(self, s1, ...sinks) }