Proposal: Add Data.List.sortNub and sortNubBy

Neil Mitchell ndmitchell at gmail.com
Tue Mar 13 05:38:14 EDT 2007


Hi

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

This implementation seems to perform better on at least one particular
usage case. I'll take a closer look and see if this is always the
case.

Are we going to have dependency problems by making Data.List depend on
Data.Set? My guess is yes, but I'm not sure.


> > 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.

I use Set's where appropriate, I use List's where appropriate. Just
because I'm using a list which I want nub'ing doesn't mean it is a
set. Set's also don't allow things like pattern matching, and don't
have the same range of functions over them, so lists are sometimes
easier for certain tasks.

Thanks

Neil


More information about the Libraries mailing list