// 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 ZipWith from "./zipWith.js" export function zip_[]>( ...[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 = ZipWith.zipWith_(s1, s2, Tp.tuple) // @ts-expect-error return A.reduce_(sinks, init, (acc, v) => // @ts-expect-error ZipWith.zipWith_(acc, v, (a, b) => Tp.append_(a, b)) ) } /** * @ets_data_first zip_ */ export function zip[]>( ...[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 > => zip_(self, s1, ...sinks) }