Esc
Start typing to search...

Ordering Module

The Ordering enum represents the result of a three-way comparison.

Returned by all compare functions in the standard library (List.compare, String.compare, DateTime.compare, Date.compare, Time.compare, Duration.compare).

Variants

  • Lt — left operand is less than right
  • Eq — operands are equal
  • Gt — left operand is greater than right

Common patterns

import List
import Ordering

case List.compare 1 2 of
    Ordering::Lt -> "less"
    Ordering::Eq -> "equal"
    Ordering::Gt -> "greater"

Functions