nubBy package:ihaskell

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]