Proposal: Add Data.List.sortNub and sortNubBy

Christian Maeder maeder at
Tue Mar 13 05:24:14 EDT 2007

Neil Mitchell schrieb:
> sortNub = map head . group . sort

sortNub = Data.Set.toList . Data.Set.fromList

> This is O(n log n) [time to sort], rather than O(n^2) [time to nub].

> I personally have defined this function at least 25 times, I suspect
> others have to.

Maybe you should have switched from lists to sets anyway.

Cheers Christian

More information about the Libraries mailing list