:: Ord a => [a] -> [a] -package:rio package:containers -is:exact is:exact

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.


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