opvasger / comparable / Comparable

This module contains replacements for functions that are imported by default.

Comparable


type alias Comparable value =
value -> value -> Basics.Order

A function to implement comparison for a given type of value.

default : Comparable comparable

The default implementation for comparison of values in Elm. This function implements equality as well as ordering for some types of values - Custom types aren't supported.

Basics

Basic functions with explicit comparison.

lt : Comparable value -> value -> value -> Basics.Bool

is the first value less than the second?

gt : Comparable value -> value -> value -> Basics.Bool

is the first value greater than the second?

lte : Comparable value -> value -> value -> Basics.Bool

is the first value less than or equal to the second?

gte : Comparable value -> value -> value -> Basics.Bool

is the first value greater than or equal to the second?

max : Comparable value -> value -> value -> value

return the greater of two values.

min : Comparable value -> value -> value -> value

return the lesser of two values.

List

List functions with explicit comparison.

maximum : Comparable value -> List value -> Maybe value

Find the maximum element in a non-empty list.

minimum : Comparable value -> List value -> Maybe value

Find the minimum element in a non-empty list.

sort : Comparable value -> List value -> List value

Sort values Comparable lowest to highest.