[Haskell-cafe] Parsec, updateState, and failure
Andrew Coppin
andrewcoppin at btinternet.com
Sat May 31 10:39:45 EDT 2008
Dimitry Golubovsky wrote:
> Hi,
>
> If a parser which updated user state fails, will such update be reverted?
>
Without actually checking, I would strongly suspect that yes, if a
parser fails, all its state modifications are thrown away. (This is
usually what you would want...)
> Is there any bracket- or try-catch-finally-like mechanism for Parsec?
>
I don't think so. If you find yourself wanting to parse data differently
depending on stuff you've already seen, you might find it easier to run
a 2-pass parser of some kind.
More information about the Haskell-Cafe
mailing list