Parsec problem

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Parsec problem

Kees Bleijenberg
module Main(main) where

import Text.ParserCombinators.Parsec  


parseToNewLine = do

                    line <- manyTill anyChar newline

                    return line


keyValue = do

                    fieldName <- many letter


                    char '='


                    fieldValue <- parseToNewLine

                    return (fieldName,fieldValue)


main = parseTest keyValue "key=\n"


I don't understand why te code above doesn't parse to ("key","")

parseToNewLine "\n" parses to ""

parseTest keyValue "a=b\n" works fine and parses to ("a","b")



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>