[GHC] #2717: Add nubWith, nubOrd

GHC trac at galois.com
Tue Oct 21 04:52:52 EDT 2008


#2717: Add nubWith, nubOrd
---------------------------------+------------------------------------------
    Reporter:  Bart Massey       |       Owner:                  
        Type:  proposal          |      Status:  new             
    Priority:  normal            |   Component:  libraries/base  
     Version:                    |    Severity:  normal          
    Keywords:                    |    Testcase:                  
Architecture:  Unknown/Multiple  |          Os:  Unknown/Multiple
---------------------------------+------------------------------------------
 This is a followup to my proposal #2629, which had a much more ambitious
 scheme.  After much discussion, it was decided to put this smaller
 proposal on the table.

 I've implemented a new function Data.List.nubWith that takes a "stop list"
 and "filtering function" as an argument, and filters its target list
 against the stop list. I've then implemented Data.Set.nubOrd in terms of
 nubWith. nubBy is left alone, since there's nothing obvious to be done
 about it. All of the nubs are still fully lazy.

 Basic QuickCheck tests have been written, and pass.
 Performance benchmarking shows my nubOrd implementation to be quite
 comparable to that of nub in cases where the latter performs well, and
 dramatically faster when nub performs poorly. In particular, nubOrd can
 work on long lists with long nubs, unlike the basic nub, which is
 hopeless.

 Patch against current Darcs head attached.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2717>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the Glasgow-haskell-bugs mailing list