[Haskell-cafe] parsing and printing - applicative style?

Johannes Waldmann johannes.waldmann at htwk-leipzig.de
Wed Dec 9 09:23:22 UTC 2015

Dear Cafe,

what is the current state of the art (and notation)
in writing combined parser/printers?
(as in Rendel/Ostermann ICFP 2010,
http://lambda-the-ultimate.org/node/4191 )

>From the paper I get the impression that this is,
or could be, a nice showcase for Applicative and Alternative.
Indeed, if parsing a text in a (programming) language
is separated from semantics, then the parsing should be applicative?
You don't need ">>=" since you do not compute
a semantical value on the left, but just the AST, which is syntax only.

But then Section 3.2 shows that Printer cannot be Applicative.
Indeed, the version of "pure" in the paper
(see class "Syntax delta" in Section 3.4)
has type  "Eq a => a -> delta a",
and that's different from the Applicative that we know.

But one of the many "categorial" packages on hackage
can express this, meanwhile?
What is the meta-search-procedure to find it?

- J.W.

More information about the Haskell-Cafe mailing list