[Haskell-beginners] Parsec problem
Andres Löh
andres at well-typed.com
Sat Feb 2 15:23:36 CET 2013
Hi.
> keyValue = do
> fieldName <- many letter
> spaces
> char '='
> spaces
> fieldValue <- parseToNewLine
> return (fieldName,fieldValue)
>
> main = parseTest keyValue "key=\n"
>
> I don’t understand why te code above doesn’t parse to (“key”,””)
The problem is that the \n is already consumed by spaces. The
subsequent parseToNewLine fails.
Cheers,
Andres
--
Andres Löh, Haskell Consultant
Well-Typed LLP, http://www.well-typed.com
More information about the Beginners
mailing list