sortBy -package:basement

The sortBy function is the non-overloaded version of sort. The argument must be finite.
>>> sortBy (\(a,_) (b,_) -> compare a b) [(2, "world"), (4, "!"), (1, "Hello")]
[(1,"Hello"),(2,"world"),(4,"!")]
The supplied comparison relation is supposed to be reflexive and antisymmetric, otherwise, e. g., for _ _ -> GT, the ordered list simply does not exist. The relation is also expected to be transitive: if it is not then sortBy might fail to find an ordered permutation, even if it exists.
sortBy for NonEmpty, behaves the same as sortBy
sortBy sorts the specified Seq according to the specified comparator. The sort is stable. If stability is not required, unstableSortBy can be slightly faster.
The sortBy function is the non-overloaded version of sort.
>>> sortBy (\(a,_) (b,_) -> compare a b) [(2, "world"), (4, "!"), (1, "Hello")]
[(1,"Hello"),(2,"world"),(4,"!")]
Sort a vector using a custom ordering.
A fully parameterized version of the sorting algorithm. Again, this function takes both radix information and a comparison, because the algorithms falls back to insertion sort for small arrays.
Sorts an entire array using a custom ordering.
Sorts an entire array using a given comparison
A variant on sortBy which returns a vector of unique elements.
Sorts an array using a custom comparison.
Radix sorts an array using custom radix information requires the number of passes to fully sort the array, the size of of auxiliary arrays necessary (should be one greater than the maximum value returned by the radix function), and a radix function, which takes the pass and an element, and returns the relevant radix.
Sort a sequence using an supplied element ordering function.
> let compare' x y = case compare x y of LT -> GT; EQ -> EQ; GT -> LT
> sortBy compare' [5,3,6,1,2,4]
[6,5,4,3,2,1]
Return a list of the elements of the given Shell, sorted by the given function and keeping duplicates:
>>> sortBy (comparing fst) (select [(1,'a'),(4,'b'),(2,'c'),(3,'d'),(3,'e'),(7,'f')])
[(1,'a'),(2,'c'),(3,'d'),(3,'e'),(4,'b'),(7,'f')]
Sort function taking a custom comparison function
Sort the input stream using a supplied comparison function. O(n) space Note: this is not the fastest possible implementation as of now. Pre-release
The sortBy function is the non-overloaded version of sort.
Sort an ordered collection using the specified order function
Sort the input stream using a supplied comparison function. Sorting can be achieved by simply:
>>> sortBy cmp = StreamK.mergeMapWith (StreamK.mergeBy cmp) StreamK.fromPure
However, this combinator uses a parser to first split the input stream into down and up sorted segments and then merges them to optimize sorting when pre-sorted sequences exist in the input stream. O(n) space
sortBy sorts the specified NESeq according to the specified comparator. The sort is stable. If stability is not required, unstableSortBy can be slightly faster.
Generalized version of sort. Since 0.7.0.0