Skip to content

Add sortNub and sortNubBy to Data.List

I propose the addition of sortNub and sortNubBy to Data.List

sortNub = sort . nub, but can run in O(n log n) instead of O(n^2) with the implementation:

sortNub = map head . group . sort

I personally have defined this function over 25 times. Debate on the libraries list.

Trac metadata
Trac field Value
Version
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component libraries/base
Test case
Differential revisions
BlockedBy
Related
Blocking
CC libraries@haskell.org
Operating system Unknown
Architecture Unknown
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information