On Tue, Jun 29, 2010 at 10:26 PM, Erik de Castro Lopo <mle...@mega-nerd.com> wrote: > Hi all, > > I'm reading John Hughes' paper "Generalizing Monads to Arrows" and found > the statement regarding parser combinators: > > "... depend on the programmer using an additional combinator similar > to Prolog's 'cut' operator do declare that a parser need never > backtrack beyond a certain point." > > Does something like this already exist in Parsec? If not is there a way > to write it? > > Having this would really help with a parsing problem I have. > > Cheers, > Erik
For Parsec, in the absence of the "try" combinator, a parser will never back-track once it consumes a portion of the input. If "try" is pushed out into the leaves of you parser, you shouldn't run in to too much trouble with excessive backtracking. What problems are you running in to? Take care, Antoine _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe