
20 Nov
2006
20 Nov
'06
3:05 a.m.
On Monday 20 November 2006 02:44, chris moline wrote:
sep :: (a -> Bool) -> [a] -> [[a]] sep p = takeWhile (/= "") . iterT (breakDrop p)
Setting the type signature of sep to (Char -> Bool) -> [Char] -> [[Char]] fixes the problem but I don't get why the signature isn't as general as I think it should be. Something to do with defaulting perhaps?
The problem is (I believe) 'takeWhile (/= "")'. That's a string, which causes everything to be specialized to Char. You want 'takeWhile (not . null)'. -- Dan