Extensions to the core Basics library.
Like Basics.compare, with a custom function. For example:
compareBy Date.toTime earlyDate laterDate
--> LTLike Basics.max, but it works on non-comparable types by taking a custom function. For example:
maxBy Date.toTime earlyDate laterDate
--> laterDateLike Basics.min, but it works on non-comparable types by taking a custom function. For example:
minBy Date.toTime earlyDate laterDate
--> earlyDate
Run a function on two inputs, before doing something with the result. Can be useful for things like sorts. For example,
compare (List.length a) (List.length b)can be writtenon List.length compare.See also
compareBy.