As of this PR https://github.com/roc-lang/roc/pull/9832
LT/EQ/GT ordering tags with FirstBeforeSecond, Equivalent, and SecondBeforeFirstdefault_cmp to built-in types that have a natural default ordering, including numbers and tuples. Strings intentionally do not gain an implicit default ordering.List.sortList.sort_byList.sort_withList.sort_reversedList.sort_by_reversedList.sort_with_reversedList.sort_with as a compiler low-level operation backed by Fluxsort/QuadsortThank you to @Jonathan and @Brendan Hansknecht for their work on this.
Also if anyone is interested here are the fuzz targets I used to help validate the implementation and also find/fix some bugs :bug:
https://github.com/lukewilliamboswell/roc-fuzz/pull/8
:smiling_face_with_tear: on the FirstBeforeSecond, Equivalent, and SecondBeforeFirst
I realize such a feedback is too late and I haven't followed this at all, but was something like "LeftComesFirst" and "LeftComesLast" or "RightComesFirst" considered?
It was ruled out because it is not uncommon for left and right to be mixed up.
Sorry for the spam... here is another update on this https://github.com/roc-lang/roc/pull/10975
default_cmp with order_relative_to[FirstBeforeSecond, Equivalent, SecondBeforeFirst] with [Before, Same, After]match a.order_relative_to(b) {
Before => ...
Same => ...
After => ...
}
Last updated: Sep 03 2026 at 15:16 UTC