sortWith

sortWith for NonEmpty, behaves the same as:
sortBy . comparing
The sortWith function sorts a list of elements using the user supplied function to project something out of each element In general if the user supplied function is expensive to compute then you should probably be using sortOn, as it only needs to compute it once for each element. sortWith, on the other hand must compute the mapping function for every comparison that it performs.
The sortWith function sorts a list of elements using the user supplied function to project something out of each element
Sort elements using the user supplied function to project something out of each element. Inspired by http://hackage.haskell.org/packages/archive/base/latest/doc/html/GHC-Exts.html#v:sortWith.
O(n). Sort a list with a Schwartzian transformation by using discrimination. This linear time replacement for sortWith and sortOn uses discrimination.
O(n log n). Sorts a list by comparing the results of a key function applied to each element. Elements are arranged from lowest to highest, keeping duplicates in the order they appeared in the input.
>>> sortWith fst $ slist [(2, "world"), (4, "!"), (1, "Hello")]
Slist {sList = [(1,"Hello"),(2,"world"),(4,"!")], sSize = Size 3}
Dependency sort a STG program, and annotate it with free variables The returned bindings: * Are in dependency order * Each StgRhsClosure is correctly annotated (in its extension field) with the free variables needed in the closure * Each StgCase is correctly annotated (in its extension field) with the variables that must be saved across the case
This is just like the standard C qsort() function, but the comparison routine accepts a user data argument. This is guaranteed to be a stable sort since version 2.32.
Like byteArraySort, but the comparison function takes an extra user data argument.