[Haskell-cafe] Template Haskell a Permanent solution?

Dominique Devriese dominique.devriese at cs.kuleuven.be
Tue Jan 4 15:41:49 CET 2011


2010/12/27 Jonathan Geddes <geddes.jonathan at gmail.com>:
> I see TH used most for the following tasks:
> #1 Parse a string at compile-time so that a custom syntax for
> representing data can be used. At the extreme, this "data" might even
> be an EDSL.
> #2 Provide instances automatically.

Just a note that TH is also sometimes used in its generality: as a
general compile time meta-programming facility. For example, in my
experimental grammar-combinators parsing library [1], I am using it to
perform grammar transformations at compile time by simply generating
the definition for the transformed grammar using TH. This could be
extended in the future to provide a low-cost parser generator that
works from within TH, which can reuse the library's infrastructure.


[1] http://projects.haskell.org/grammar-combinators/

More information about the Haskell-Cafe mailing list