nubBy package:Cabal-syntax

The nubBy function behaves just like nub, except it uses a user-supplied equality predicate instead of the overloaded == function.
>>> nubBy (\x y -> mod x 3 == mod y 3) [1,2,4,5,6]
[1,2,6]
Like ordNub and nubBy. Selects a key for each element and takes the nub based on that key.