getEq<T> static method

Eq<Option<T>> getEq<T>(
  1. Eq<T> eq
)

Build an Eq<Option> by comparing the values inside two Option.

If both Option are None, then calling eqv returns true. Otherwise, if both are Some and their contained value is the same, then calling eqv returns true. It returns false in all other cases.

Implementation

static Eq<Option<T>> getEq<T>(Eq<T> eq) => Eq.instance((a1, a2) =>
    a1 == a2 ||
    a1
        .flatMap((j1) => a2.flatMap((j2) => Some(eq.eqv(j1, j2))))
        .getOrElse(() => false));