Proposal #2629: Data.List: Replace nub; add nubOrd, nubInt, nubWith

Jeremy Shaw jeremy at
Sun Sep 28 15:40:59 EDT 2008

At Sun, 28 Sep 2008 11:05:42 -0700,
Alexander Dunlap wrote:

> This seems like a good idea but it's kind of strange to have three
> different exposed versions of nub. Would it be possible to hide them,
> hide the StopList typeclass and use {-# RULES #-} pragmas to use the
> faster versions when possible?

The RULES pragma is GHC-specific. Would it make sense to export the
faster versions so that people targeting alternative compilers could
use them? 

Additionally, I think RULES only take effect if you are compiling with
optimizations, but not if you just load the files into GHCi. I have
written programs which run fine with nubOrd but are unacceptable with
nubEq. So, I would certainly want the option to force the use of
nubOrd at all times, rather than rely on the compiler to sometimes
make the required optimization for me.


More information about the Libraries mailing list