[Haskell-cafe] The 13-line example in Text.Megaparsec.Expr
stephen.tetley at gmail.com
Mon Feb 29 08:22:52 UTC 2016
Megaparsec does away with Parsec's LanguageDef machinery (which
provides reservedOp). This is a double edge sword - as Megaparsec's
author notes Parsec lexers (i.e LanguageDef based lexers) are
inflexible especially if you need whitespace sensitive parsing; but
they are very handy for the simple case of whitespace insensitive
For the expression parser, Megaparsec's documentation is wrong[*] and
probably it should use symbol rather than reservedOp. Note that symbol
is slightly different in Megaparsec as it's a plain combinator (rather
than one instantiated from a first class module as in Parsec) so it
takes two args rather than one.
[*] Well, likely wrong - I haven't got round to using Megaparsec yet.
On 27 February 2016 at 17:04, Özgür Akgün <ozgurakgun at gmail.com> wrote:
> On 27 February 2016 at 04:20, William Yager <will.yager at gmail.com> wrote:
> If I understand it correctly, Jeffrey is asking about using Megaparsec, and
> this link is to the parsec combinator with the same name.
> I am very surprised to find out that Megaparsec does not provide[*] the same
> combinator. Especially since they keep the same example!
> [*] At least it is not listed here:
> Özgür Akgün
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
More information about the Haskell-Cafe