[Haskell-cafe] types for parsing a tree

Jared Jennings jjenning at gmail.com
Wed Sep 15 23:42:06 EDT 2010


On Fri, Sep 10, 2010 at 2:00 PM, S. Doaitse Swierstra
<doaitse at swierstra.net> wrote:
> I show how this can be done using uu-parsinglib. Note that we have sevral parsers, each having its own type:

Thanks for such a complete example, Doaitse! Unfortunately I have a
requirement I didn't disclose: the simple tags like <TRNUID>, <NAME>,
<AMOUNT> could come in any order; and some are optional. I tried to
fix that by making every field in my Transaction record a Maybe, and
keeping a Transaction as state for my parser. But after so many Maybes
I began to think this was not the right way. And I had to run a parser
as part of another parser. And after all that, it wouldn't build
because it was badly typed.

But in any case, thanks for turning me on to
Text.ParserCombinators.UU; I'd only tried Parsec before.


More information about the Haskell-Cafe mailing list