krisajenkins/elm-exts/27.1.0

NOTE: this package is not compatible with Elm 0.19.1

Exts.Basics

Extensions to the core Basics library.

on : (a -> b) -> (b -> b -> c) -> a -> a -> c

Run a function on two inputs, before doing something with the result. I can be useful for things like sorts. For example, compare (List.length a) (List.length b) can be written on List.length compare.

See also compareBy.

compareBy : (a -> comparable) -> a -> a -> Order

Like Basics.compare, with a custom function. For example:

compareBy Date.toTime earlyDate laterDate
--> LT
maxBy : (a -> comparable) -> a -> a -> a

Like Basics.max, but it works on non-comparable types by taking a custom function. For example:

maxBy Date.toTime earlyDate laterDate
--> laterDate
minBy : (a -> comparable) -> a -> a -> a

Like Basics.min, but it works on non-comparable types by taking a custom function. For example:

minBy Date.toTime earlyDate laterDate
--> earlyDate