:: Ord a => [a] -> [a] -package:witherable -package:base-prelude -package:lens is:exact -package:ghc -package:imports -package:Cabal -package:extra -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