Proposal (Trac ticket #3671): Add takeRec,
genericTakeRec and spanRec to Data.List
Philip K.F. Hölzenspies
p.k.f.holzenspies at utwente.nl
Thu Nov 19 09:10:16 EST 2009
On Thu, 2009-11-19 at 15:02 +0100, Philip K.F. Hölzenspies wrote:
> > runs :: (a -> Bool) -> [a] -> [[a]]
> > runs = groupBy . on (==)
>
> groupBy . on (==) :: (a -> ()) -> [a] -> [[a]]
Don't know what neuron misfired there... my apologies.
I quickly tried it out in ghci:
> let runs' = groupBy . on (==)
> :t runs'
x :: (a -> ()) -> [a] -> [[a]]
but of course:
> :t groupBy . on (==)
groupBy . on (==) :: (Eq b) => (a -> b) -> [a] -> [[a]]
My bad. However, runs is still considerably more general and, AFAICT,
not a composition of other Data.List functions. I agree with Ian that
even if it took us a while to write those compositions properly, they
shouldn't be in the library. I stand by runs, though ;)
Regards,
Philip
More information about the Libraries
mailing list