The sort function implements a stable sorting algorithm. It is
a special case of sortBy, which allows the programmer to supply
their own comparison function.
Elements are arranged from lowest to highest, keeping duplicates in
the order they appeared in the input.
The argument must be finite.
**Examples**

>>> sort [1,6,4,3,2,5] [1,2,3,4,5,6]

>>> sort "haskell" "aehklls"

>>> import Data.Semigroup(Arg(..)) >>> sort [Arg ":)" 0, Arg ":D" 0, Arg ":)" 1, Arg ":3" 0, Arg ":D" 1] [Arg ":)" 0,Arg ":)" 1,Arg ":3" 0,Arg ":D" 0,Arg ":D" 1]

The `nubOrd` function removes duplicate elements
from a list. In particular, it keeps only the first occurrence of each
element. By using a Set internally it has better asymptotics
than the standard nub function.
#### Strictness

`nubOrd` is strict in the elements of the list.
#### Efficiency note

When applicable, it is almost always better to use nubInt or
nubIntOn instead of this function, although it can be a little
worse in certain pathological cases. For example, to nub a list of
characters, use

nubIntOn fromEnum xs

A right-biased version of ordNub.
Example:

>>> ordNub [1,2,1] :: [Int] [1,2]

>>> ordNubRight [1,2,1] :: [Int] [2,1]

Remove duplicates but keep elements in order. O(n * log n)

nubOrd "this is a test" == "this ae" nubOrd (take 4 ("this" ++ undefined)) == "this" \xs -> nubOrd xs == nub xs

nubSort "this is a test" == " aehist" \xs -> nubSort xs == nub (sort xs)

relude Relude.List.Reexport, Cabal-syntax Distribution.Compat.Prelude, universum Universum.List.Reexport

The sort function implements a stable sorting algorithm. It is
a special case of sortBy, which allows the programmer to supply
their own comparison function.
Elements are arranged from lowest to highest, keeping duplicates in
the order they appeared in the input.

>>> sort [1,6,4,3,2,5] [1,2,3,4,5,6]The argument must be finite.

Like ordNub runs in <math> but also sorts a list.

>>> sortNub [3, 3, 3, 2, 2, -1, 1] [-1,1,2,3]

The sort function implements a stable sorting algorithm. It is
a special case of sortBy, which allows the programmer to supply
their own comparison function.
Elements are arranged from lowest to highest, keeping duplicates in
the order they appeared in the input.

>>> sort [1,6,4,3,2,5] [1,2,3,4,5,6]

candidates for Utility ?

The nubSort function is equivalent to `nub .
sort`, except that duplicates are removed as it sorts. It
is essentially the same implementation as `Data.List.sort`,
with merge replaced by union. Thus the performance of
nubSort should better than or nearly equal to sort
alone. It is faster than both sort and `nub .
sort` when the input contains significant quantities of
duplicated elements.

Like ordNub but also sorts a list.

>>> sortNub [3, 3, 3, 2, 2, -1, 1] [-1,1,2,3]

Returns an (arbitrary) representative for each list element that
occurs more than once. O(n log n).

Remove the first representative for each list element. Thus, returns
all duplicate copies. O(n log n).
`allDuplicates xs == sort $ xs \ nub xs`.