[Haskell-cafe] Re: Propagating Parsec errors

Peter Simons simons at cryp.to
Sun Dec 5 13:36:07 EST 2004

Mark Carroll writes:

 > Is there a way in Parsec to, within a parser, throw an
 > error generated by another parser?

How about wrapping the ParseError into your result type?
Like this:

  data Foo = Bar String | ... | BadLuck ParseError

Then you could run any number of parsers (with 'runParser')
inside another parser and return their results and errors
without needing any special support from the Parsec library.


More information about the Haskell-Cafe mailing list