Hyperlinkv0.8.0-beta.28

Combiner

Combiner.constantfunctioneffect/Combiner.ts:278
<A>(a: A): Combiner<A>

Creates a Combiner that ignores both arguments and always returns the given constant value.

When to use

Use when you need a combiner that always returns a fixed value, including when a generic API requires a combiner but the result is predetermined.

Details

combine(self, that) returns the constant a and ignores both arguments.

Example (Always returning zero)

import { Combiner } from "effect"

const Zero = Combiner.constant(0)

console.log(Zero.combine(42, 99))
// Output: 0
constructorsfirstlast
export function constant<A>(a: A): Combiner<A> {
  return make(() => a)
}