[Template-haskell] RE: Documentation Template Haskell

Tomasz Zielonka tomasz.zielonka at gmail.com
Wed Oct 26 02:58:53 EDT 2005

On 10/25/05, Simon Peyton-Jones <simonpj at microsoft.com> wrote:
> TH seems to have had quite a bit less impact than I originally thought
> it might, given that it provides something qualitatively new.  But maybe
> I'm wrong.  For example, I didn't know that it was important to you.
> Maybe there are others.

I also use TH, mostly to generate instances of some classes and
for things like interpolation (this is the word they use in Perl-world
for this - I've used Perl several years ago) of variables in String literals.
Probably not the most sophisticated uses, but they sure make writing
(some kinds of) code much easier.

There are probably many things that could  be done to make TH
more useful, and hopefully also more popular. Here are some I
thought about:
- allow to use TH to create rules for deriving instances of
  user defined type classes - so the end user doesn't have
  to know about TH - this is quite controversial, because on
  one hand it would make TH less visible, but on the other,
  library writers would be more willing to use it
- allow to use TH as a kind of preprocessor, so TH-preprocessed
  source can be loaded by other compilers
- bridge that gap between ADTs used in TH and haskell-src(-exts),
  so, for example, I could parse parts of String literals as Haskell.
- alternatively, allow to splice inside String literals ;-)
- allow to use syntaxes other than Haskell in quotations, for example,
  I would love to use Haskell to generate C++ (to improve Haskell/C++
  ratio in my code). In other words, make TH an aid in using DSLs.

>  My current hope is to broaden the base of people who are willing to
> contribute to GHC themselves, with support from me and Simon, so that
> Simon and I aren't always on the critical path.

I would like to clarify that I don't expect Simon and you to do any of
these. I am already amazed that you did so much :-)

Best regards

More information about the template-haskell mailing list