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

Henning Thielemann lemming at henning-thielemann.de
Tue Sep 30 10:09:51 EDT 2008


On Mon, 29 Sep 2008, Brandon S. Allbery KF8NH wrote:

> On 2008 Sep 29, at 19:40, Alexander Dunlap wrote:
>> 
>> Well, yes, but presumably different compilers could optimize in
>> different ways. (Perhaps they could use some class behind the scenes,
>> or their own optimizing mechanism?) My point is that we shouldn't have
>> multiple exposed functions for _exactly_ the same semantic operation.
>
> Tell it to the Prelude.  (^), (^^), (**) anyone?

I don't see the relation between the different kind of powers and the 
different implementations of 'nub'. As far as I understand 'nubInt' is 
just an optimization of the generic 'nub'. In contrast to that, the three 
power operators denote really different operations:
   http://www.haskell.org/haskellwiki/Power_function

I think it is reasonable to drop in an optimized 'nub' for certain types 
by an optimizer rule, just like it is legitimate to drop in a special GSL 
function for (GSLMatrix.map sin), or a determinant algorithm for Double 
matrices which uses division, whereas the generic determinant computation 
does not need divisions.


More information about the Libraries mailing list