[Haskell-cafe] Yet more type confusion
dan.doel at gmail.com
Mon Nov 20 03:05:01 EST 2006
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)'.
More information about the Haskell-Cafe