Skip to main content
Module

x/fun/comparable.ts>Comparable

A collection of algebraic data types, lenses, and schemables based on a light weight higher kinded type implementation. Written for deno.
Go to Latest
interface Comparable
implements Hold<A>
import { type Comparable } from "https://deno.land/x/fun@v2.0.0-alpha.12/comparable.ts";

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:

  1. Reflexivity: compare(a, a) === true
  2. Symmetry: compare(a, b) === compare(b, a)
  3. Transitivity: if compare(a, b) and compare(b, c), then compare(a, c)