ask/equivalence

Types

pub type Equivalence(a) =
  fn(a, a) -> Bool

Functions

pub fn and(
  first: fn(a, a) -> Bool,
  second: fn(a, a) -> Bool,
) -> fn(a, a) -> Bool

Combine two equivalences into a new equivalence that returns True if both equivalences return True.

pub fn list(eq: fn(a, a) -> Bool) -> fn(List(a), List(a)) -> Bool

Create a new equivalence for a list of values based on the given equivalence.

pub fn map_input(
  over eq: fn(a, a) -> Bool,
  with fun: fn(b) -> a,
) -> fn(b, b) -> Bool

Map the input of an equivalence to create a new equivalence.

pub fn not(eq: fn(a, a) -> Bool) -> fn(a, a) -> Bool

Negate an equivalence to create a new equivalence that returns True if the original equivalence returns False.

pub fn or(
  first: fn(a, a) -> Bool,
  second: fn(a, a) -> Bool,
) -> fn(a, a) -> Bool

Combine two equivalences into a new equivalence that returns True if either equivalence returns True.

pub fn pair(
  first: fn(a, a) -> Bool,
  second: fn(b, b) -> Bool,
) -> fn(#(a, b), #(a, b)) -> Bool

Create a new equivalence for a pair of values based on the given equivalences.

pub fn trivial() -> fn(a, a) -> Bool

Create a new equivalence that always returns True.

This is sometimes called the trivial or universal equivalence.

Search Document