<A>(combiner: Combiner.Combiner<A>): Combiner.Combiner<A | undefined>Creates a Combiner for A | undefined that combines values only when both
operands are defined.
When to use
Use to lift a Combiner so any undefined operand makes the combined result
undefined.
Details
undefinedcombined with any value returnsundefined- Any value combined with
undefinedreturnsundefined acombined withbreturnscombiner.combine(a, b)
export function function makeCombinerFailFast<A>(
combiner: Combiner.Combiner<A>
): Combiner.Combiner<A | undefined>
Creates a Combiner for A | undefined that combines values only when both
operands are defined.
When to use
Use to lift a Combiner so any undefined operand makes the combined result
undefined.
Details
undefined combined with any value returns undefined
- Any value combined with
undefined returns undefined
a combined with b returns combiner.combine(a, b)
makeCombinerFailFast<function (type parameter) A in makeCombinerFailFast<A>(combiner: Combiner.Combiner<A>): Combiner.Combiner<A | undefined>A>(combiner: Combiner.Combiner<A>(parameter) combiner: {
combine: (self: A, that: A) => A;
}
combiner: import CombinerCombiner.interface Combiner<A>Represents a strategy for combining two values of the same type A. A
Combiner contains a single combine method that takes two values and
returns a merged result. It does not include an identity/empty value; use
Reducer when you need one.
When to use
Use when you need to describe how two values of the same type
merge, pass a reusable combining strategy to library functions like
Struct.makeCombiner or Option.makeCombinerFailFast, or define the
combining step for a Reducer.
Example (Combining numbers with addition)
import { Combiner } from "effect"
const Sum = Combiner.make<number>((self, that) => self + that)
console.log(Sum.combine(3, 4))
// Output: 7
Combiner<function (type parameter) A in makeCombinerFailFast<A>(combiner: Combiner.Combiner<A>): Combiner.Combiner<A | undefined>A>): import CombinerCombiner.interface Combiner<A>Represents a strategy for combining two values of the same type A. A
Combiner contains a single combine method that takes two values and
returns a merged result. It does not include an identity/empty value; use
Reducer when you need one.
When to use
Use when you need to describe how two values of the same type
merge, pass a reusable combining strategy to library functions like
Struct.makeCombiner or Option.makeCombinerFailFast, or define the
combining step for a Reducer.
Example (Combining numbers with addition)
import { Combiner } from "effect"
const Sum = Combiner.make<number>((self, that) => self + that)
console.log(Sum.combine(3, 4))
// Output: 7
Combiner<function (type parameter) A in makeCombinerFailFast<A>(combiner: Combiner.Combiner<A>): Combiner.Combiner<A | undefined>A | undefined> {
return import CombinerCombiner.function make<A>(
combine: (self: A, that: A) => A
): Combiner<A>
Creates a Combiner from a binary function.
When to use
Use when you have a custom combining operation that is not covered by
the built-in constructors (min, max, first, last, constant).
Details
The returned combiner's combine method delegates to the provided function.
Any purity, associativity, or mutation behavior comes from that function.
Example (Multiplying numbers)
import { Combiner } from "effect"
const Product = Combiner.make<number>((self, that) => self * that)
console.log(Product.combine(3, 5))
// Output: 15
make((self: A | undefinedself, that: A | undefinedthat) => {
if (self: A | undefinedself === var undefinedundefined || that: A | undefinedthat === var undefinedundefined) return var undefinedundefined
return combiner: Combiner.Combiner<A>(parameter) combiner: {
combine: (self: A, that: A) => A;
}
combiner.Combiner<A>.combine: (self: A, that: A) => ACombines two values into a new value.
When to use
Use to merge two values according to this combining strategy.
combine(self: A & ({} | null)self, that: A & ({} | null)that)
})
}