Hyperlinkv0.8.0-beta.28

Combiner

Combiner.makefunctioneffect/Combiner.ts:81
<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
constructorsCombiner
Source effect/Combiner.ts:813 lines
export function make<A>(combine: (self: A, that: A) => A): Combiner<A> {
  return { combine }
}
Referenced by 11 symbols