red-g / sort / Sort

Useful ways to combine sorters.


type Sorter a

A sorter which produces an Order between values.

all : List (Sorter a) -> Sorter a

Combine a list of sorters, defering to those earlier in the list.

and : Sorter a -> Sorter a -> Sorter a

Combine sorters, deferring to the second sorter.

by : (b -> a) -> Sorter a -> Sorter b

Sort by a derived property.

custom : (a -> a -> Basics.Order) -> Sorter a

For when you need to handroll a sorter!

equal : Sorter a

A sorter that always returns EQ.

float : Sorter Basics.Float

Sort floats in increasing order.

int : Sorter Basics.Int

Sort integers in increasing order.

list : Sorter a -> List a -> List a

Order a list with given sorter.

order : Sorter a -> a -> a -> Basics.Order

Order two elements according to a sorter.

reverse : Sorter a -> Sorter a

Reverse the order of a sorter.

string : Sorter String

Sort strings alphabetically.