Proposal (Trac ticket #3671): Add takeRec, genericTakeRec and spanRec to Data.List

Ian Lynagh igloo at earth.li
Tue Nov 17 09:35:17 EST 2009


Hi Philip,

On Tue, Nov 17, 2009 at 02:47:44PM +0100, Philip K.F. Hölzenspies wrote:
> 
> After defining these for the umpeenth time, I would like to add the
> functions takeRec, genericTakeRec and spanRec to Data.List, as per
> 
> http://hackage.haskell.org/trac/ghc/ticket/3671

I don't think spanRec does what you want:

    take 10 $ spanRec (< 3) [1,2,3,4,5,6,1,2,3,4,5,6]
    [[1,2],[],[],[],[],[],[],[],[],[]]

I have also defined your "takeRec" a number of times in the past, but I
have called it something like "splitAts". I've also defined functions
called "breaks". I think the 's' suffix is more consistent with "tails",
"inits" etc.


Thanks
Ian



More information about the Libraries mailing list