getComparableEither
import { getComparableEither } from "https://github.gh-proxy.cn/raw.githubusercontent.com/baetheus/fun/main/either.ts";Create a Comparable instance for Either given Comparable instances for both Left and Right types. Left values are compared before Right values.
@example
import * as E from "./either.ts";
import * as S from "./string.ts";
import * as N from "./number.ts";
const comparableEither = E.getComparableEither(S.ComparableString, N.ComparableNumber);
const result1 = comparableEither.compare(E.right(5))(E.right(3));
// true (5 > 3)
const result2 = comparableEither.compare(E.left("a"))(E.left("b"));
// false ("a" < "b")
const result3 = comparableEither.compare(E.right(5))(E.left("error"));
// false (Right comes after Left)