getEq<L, R> static method

Eq<Either<L, R>> getEq<L, R>(
  1. Eq<L> eqL,
  2. Eq<R> eqR

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

Return true when the two Either are equal or when both are Left or Right and comparing using eqL or eqR returns true.


static Eq<Either<L, R>> getEq<L, R>(Eq<L> eqL, Eq<R> eqR) =>
    Eq.instance((e1, e2) =>
        e1 == e2 ||
        (e1.match((l1) => e2.match((l2) => eqL.eqv(l1, l2), (_) => false),
            (r1) => e2.match((_) => false, (r2) => eqR.eqv(r1, r2)))));