[Haskell-beginners] Parsing Revisited
Tillmann Rendel
rendel at daimi.au.dk
Mon Nov 10 00:10:32 EST 2008
Jeffrey Drake wrote:
> This helps a lot, and I can go over this in the morning. The only final
> question I have is what you would use to apply all this to an arbitrary
> string.
You can use parseTest for testing, e.g. in ghci.
parseTest texList "hello\world {example}"
That will either print the resulting {TeX], or a parser error message.
For normal processing, use parse.
case parse texList "<no source>" "hello\world {example}" of
Left problem -> error (show problem)
Right texList -> convertToHTML texList
Tillmann
More information about the Beginners
mailing list