
On Fri, Nov 06, 2009 at 07:20:11PM +0100, Matthias Guedemann wrote:
Hi Brent,
thanks for the illustrative example.
For example, consider parsing a file which contains a positive integer, followed by that many letters. For example,
3xyz 12abcdefghijkl
are two instances of this format. In order to parse this, a monadic interface is required, since the result of parsing the number must be used to decide how many things to parse after that.
I see, but as long as I want to parse context free grammars, it is sufficient?
Well, technically, if you want to be able to do any choice at all, you need Alternative in addition to Applicative (this is what provides the <|> choice operator). But intuitively, yes, I expect that you should be able to parse any context-free grammar using only Alternative. -Brent