
16 Jan
2008
16 Jan
'08
6:32 p.m.
ndmitchell:
Hi
An often requested function is 'split', to split a list into parts delimited by some separator. ByteString has the functions split and splitWith for this purpose. I propose we add equivalents to Data.List:
split :: Eq a => a -> [a] -> [[a]] split x = splitWith (x==)
splitWith :: (a -> Bool) -> [a] -> [[a]] splitWith p xs = ys : case zs of [] -> [] _:ws -> splitWith p ws where (ys,zs) = break p xs
trac: http://hackage.haskell.org/trac/ghc/ticket/2048 deadline: two weeks from now, January 30
(+10) Agreement. This is long overdue!
I'd like some QuickCheck properties, so we can avoid the unlines . lines /= id fiasco. Given that, I'd support this too. -- Don