import { type comparable } from "https://deno.land/x/fun@v2.0.0/mod.ts";
const { Comparable } = comparable;
A Comparable is an algebra with a notion of equality. Specifically, a Comparable for a type T has an equal method that determines if the two objects are the same. Comparables can be combined, like many algebraic structures. The combinators for Comparable in fun can be found in comparable.ts.
An instance of a Comparable must obey the following laws:
- Reflexivity: compare(a, a) === true
- Symmetry: compare(a, b) === compare(b, a)
- Transitivity: if compare(a, b) and compare(b, c), then compare(a, c)