<A extends ReadonlyArray<unknown>>(combiners: {
readonly [K in keyof A]: Combiner.Combiner<A[K]>
}): Combiner.Combiner<A>Creates a Combiner for a tuple shape by providing a Combiner for each
position. When two tuples are combined, each element is merged using its
corresponding combiner.
When to use
Use when you need to merge two same-shape tuples by combining each position independently, such as summing counters or concatenating strings.
Example (Combining tuple elements)
import { Number, String, Tuple } from "effect"
const C = Tuple.makeCombiner<readonly [number, string]>([
Number.ReducerSum,
String.ReducerConcat
])
const result = C.combine([1, "hello"], [2, " world"])
console.log(result) // [3, "hello world"]export function function makeCombiner<
A extends ReadonlyArray<unknown>
>(combiners: {
readonly [K in keyof A]: Combiner.Combiner<A[K]>
}): Combiner.Combiner<A>
Creates a Combiner for a tuple shape by providing a Combiner for each
position. When two tuples are combined, each element is merged using its
corresponding combiner.
When to use
Use when you need to merge two same-shape tuples by combining each position
independently, such as summing counters or concatenating strings.
Example (Combining tuple elements)
import { Number, String, Tuple } from "effect"
const C = Tuple.makeCombiner<readonly [number, string]>([
Number.ReducerSum,
String.ReducerConcat
])
const result = C.combine([1, "hello"], [2, " world"])
console.log(result) // [3, "hello world"]
makeCombiner<function (type parameter) A in makeCombiner<A extends ReadonlyArray<unknown>>(combiners: { readonly [K in keyof A]: Combiner.Combiner<A[K]>; }): Combiner.Combiner<A>A extends interface ReadonlyArray<T>ReadonlyArray<unknown>>(
combiners: {
readonly [K in keyof A]: Combiner.Combiner<A[K]>
}
combiners: { readonly [function (type parameter) KK in keyof function (type parameter) A in makeCombiner<A extends ReadonlyArray<unknown>>(combiners: { readonly [K in keyof A]: Combiner.Combiner<A[K]>; }): Combiner.Combiner<A>A]: import CombinerCombiner.type Combiner.Combiner = /*unresolved*/ anyCombiner<function (type parameter) A in makeCombiner<A extends ReadonlyArray<unknown>>(combiners: { readonly [K in keyof A]: Combiner.Combiner<A[K]>; }): Combiner.Combiner<A>A[function (type parameter) KK]> }
): import CombinerCombiner.type Combiner.Combiner = /*unresolved*/ anyCombiner<function (type parameter) A in makeCombiner<A extends ReadonlyArray<unknown>>(combiners: { readonly [K in keyof A]: Combiner.Combiner<A[K]>; }): Combiner.Combiner<A>A> {
return import CombinerCombiner.make((self: anyself, that: anythat) => {
const const out: any[]out = []
for (let let i: numberi = 0; let i: numberi < self: anyself.length; let i: numberi++) {
const out: any[]out.Array<any>.push(...items: any[]): numberAppends new elements to the end of an array, and returns the new length of the array.
push(combiners: {
readonly [K in keyof A]: Combiner.Combiner<A[K]>
}
combiners[let i: numberi].combine(self: anyself[let i: numberi], that: anythat[let i: numberi]))
}
return const out: any[]out as any
})
}