:: Ord a => [a] -> [a] -package:hspec -package:basement -package:integration is:exact -package:base -package:errors -package:lens -package:mono-traversable -package:safe package:containers

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