
On 1 November 2010 22:18, Andrew Coppin
I vaguely recall somebody mentioning a parser library on Hackage where "try" is the default behaviour and you turn it off explicitly, rather than turning it on explicitly. Apparently this is much more intuitive. But unfortunately I can't remember what the hell the library was...
polyparse, is it? from http://code.haskell.org/~malcolm/polyparse/docs/index.html#what
If you have only ever used the parsec combinators before, then you might be
pleasantly surprised by polyparse: all of the same functionality is
available,
but it removes the confusion that all too commonly arises from a failure to use parsec's try combinator correctly. Ambiguous grammars often fail to be compositional in parsec, and it can be a black art guessing where to
introduce
a try to fix it. In contrast, polyparsers are by default fully
compositional.
It is possible to improve their efficiency (and the accuracy of error messages) by inserting commits (which are the dual of try), but it is not necessary for writing a correct parser, and furthermore, it is usually
obvious
where it can be beneficial to add a commit. Ozgur