Hyperlinkv0.8.0-beta.28

UndefinedOr

UndefinedOr.makeCombinerFailFastfunctioneffect/UndefinedOr.ts:200
<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)
export function makeCombinerFailFast<A>(combiner: Combiner.Combiner<A>): Combiner.Combiner<A | undefined> {
  return Combiner.make((self, that) => {
    if (self === undefined || that === undefined) return undefined
    return combiner.combine(self, that)
  })
}
Referenced by 1 symbols