Order
Reference for mo:core/Order in the core library.
Order wraps the comparison variant { #less; #equal; #greater }. Use it with
custom comparators for maps, sorted sequences, and APIs that need an explicit
three-way ordering.
Import
mo:core/Order
Status
- Runtime module
Public API
Types
Order
Functions
isLess(order : Types.Order) : Bool
Checks the predicate described by the return contract.
Contract
ensures result == (order == #less);
Use when: a branch condition or contract needs this predicate as a named fact.
isEqual(order : Types.Order) : Bool
Checks the predicate described by the return contract.
Contract
ensures result == (order == #equal);
Use when: a branch condition or contract needs this predicate as a named fact.
isGreater(order : Types.Order) : Bool
Checks the predicate described by the return contract.
Contract
ensures result == (order == #greater);
Use when: a branch condition or contract needs this predicate as a named fact.
equal(order1 : Types.Order, order2 : Types.Order) : Bool
Compares the supplied values and relates the result to the underlying order.
Contract
ensures result == (order1 == order2);
Use when: code or contracts need an explicit comparison helper instead of an operator.
allValues() : Iter.Iter<Types.Order>
Creates an iterator over the requested numeric range or domain.
Contract
ensures Iter.Spec.contains<Types.Order>(result, (#less : Types.Order));
ensures Iter.Spec.contains<Types.Order>(result, (#equal : Types.Order));
ensures Iter.Spec.contains<Types.Order>(result, (#greater : Types.Order));
Use when: iteration boundaries should be explicit in code and examples.
Summary
- Runtime module under
mo:core/Order. - Exposes 5 public functions.