getFirstMonoid<T> static method

Monoid<Option<T>> getFirstMonoid<T>()

Build an instance of Monoid in which the empty value is None and the combine function is based on the first Option if it is Some, otherwise the second.

Implementation

static Monoid<Option<T>> getFirstMonoid<T>() =>
    Monoid.instance(const Option.none(), (a1, a2) => a1.isNone() ? a2 : a1);