# std.cmp

Functionality for ordering and comparison.

## Types

#### ```#[implicit] type Eq a = { (==) : a -> a -> Bool }```

`Eq a` defines equality (==) on `a`

#### ```type Bool = | False | True```

`Bool` represents a value which can only be `True` or `False`

#### ```#[implicit] type Ord a = { eq : Eq a, compare : a -> a -> Ordering }```

`Ord a` defines an ordering on `a`

#### ```type Ordering = | LT | EQ | GT```

`Ordering` represents the result of comparing two values

## Values

#### ```#[infix(left, 4)] let == ?eq : forall a . [Eq a] -> a -> a -> Bool```

Tests whether the values are equal.

#### ```#[infix(left, 4)] let /= ?eq l r : forall a . [Eq a] -> a -> a -> Bool```

Tests whether the values are not equal.

#### `let compare ?ord : forall a . [Ord a] -> a -> a -> Ordering`

Compares two values and returns wheter the first is less than, equal or greater than the second.

#### ```#[infix(left, 4)] let < l r : forall a . [Ord a] -> a -> a -> Bool```

Returns whether `l` is less than `r`.

#### ```#[infix(left, 4)] let <= l r : forall a . [Ord a] -> a -> a -> Bool```

Returns whether `l` is less than or equal to `r`.

#### ```#[infix(left, 4)] let >= l r : forall a . [Ord a] -> a -> a -> Bool```

Returns whether `l` is greater than or equal to `r`.

#### ```#[infix(left, 4)] let > l r : forall a . [Ord a] -> a -> a -> Bool```

Returns whether `l` is greater than `r`.

#### ```#[implicit] let semigroup : Semigroup Ordering```

`Semigroup a` represents an associative operation on `a`. This means the following laws must hold:

• `forall x . append x (append y z) == append (append x y) z`

#### ```#[implicit] let monoid : Monoid Ordering```

`Monoid a` represents an semigroup an which has an identity. This means the following additional laws must hold:

• `forall x . append x empty == x`
• `forall x . append empty x == x`