[Haskell-cafe] Parsec combinator like Prolog's cut operator?

Erik de Castro Lopo mle+hs at mega-nerd.com
Wed Jun 30 01:20:33 EDT 2010

Antoine Latter wrote:

> For Parsec, in the absence of the "try" combinator, a parser will
> never back-track once it consumes a portion of the input.

Thanks for reminding me.

> If "try" is pushed out into the leaves of you parser, you shouldn't
> run in to too much trouble with excessive backtracking.

I agree.

> What problems are you running in to?

Unfortunately I have an existing, mostly working and quite complex
parser which does indeed use Parsec.try quite close to the root of
the tree. I have tried on a number of ocassions to refactor this
to remove this particular usage of Parsec.try without success.

Erik de Castro Lopo

More information about the Haskell-Cafe mailing list