O(n^2). The nub function removes duplicate elements from a list. In particular, it keeps only the first occurrence of each element. (The name nub means `essence'.) It is a special case of nubBy, which allows the programmer to supply their own equality test.
The nubBy function behaves just like nub, except it uses a user-supplied equality predicate instead of the overloaded == function.