
hi I am having trouble with a function that is supposed to eliminate spaces from the start of a String and return the resulting string. I reckon a dropWhile could be used but the isSpace bit is causing me problems... words :: String -> String words a = case dropWhile isSpace a of "" -> s:ss -> (s:word) : words rest where (word,rest) = break isSpace ss Thanks Ryan _________________________________________________________________ The next generation of MSN Hotmail has arrived - Windows Live Hotmail http://www.newhotmail.co.uk

On Dec 4, 2007 12:13 PM, Ryan Bloor
hi
I am having trouble with a function that is supposed to eliminate spaces from the start of a String and return the resulting string. I reckon a dropWhile could be used but the isSpace bit is causing me problems...
You need to be more specific. What trouble are you having? What problems is the isSpace bit causing? -Brent

On Tue, Dec 04, 2007 at 05:13:19PM +0000, Ryan Bloor wrote:
hi
I am having trouble with a function that is supposed to eliminate spaces from the start of a String and return the resulting string. I reckon a dropWhile could be used but the isSpace bit is causing me problems...
words :: String -> String words a = case dropWhile isSpace a of "" -> s:ss -> (s:word) : words rest where (word,rest) = break isSpace ss
You might want to write the code for the first case; an expression is mandatory after ->. Stefan
participants (3)
-
Brent Yorgey
-
Ryan Bloor
-
Stefan O'Rear