[Haskell-cafe] isSpace
Stefan O'Rear
stefanor at cox.net
Tue Dec 4 16:57:59 EST 2007
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20071204/ff37e836/attachment.bin
More information about the Haskell-Cafe
mailing list