Skip to content

maybe

maybe<A>(inner): Combinable<Maybe<A>>

Defined in: Core/Combinable.ts:89

Lifts a Combinable<A> to Combinable<Maybe<A>>. None is the neutral element — combining with None on either side returns the other value unchanged. Two Some values combine their inner values using the inner Combinable.

A

Combinable<A>

Combinable<Maybe<A>>

const c = Combinable.maybe(Combinable.sum);
c.combine(Maybe.some(3))(Maybe.some(2)); // Some(5)
c.combine(Maybe.none())(Maybe.some(5));  // Some(5)