[Haskell-cafe] Re: Doing some things right

ChrisK haskell at list.mightyreason.com
Fri Dec 28 12:40:10 EST 2007

Brian Sniffen wrote:
> On Dec 28, 2007 6:05 AM, Andrew Coppin <andrewcoppin at btinternet.com> wrote:
>> [I actually heard a number of people tell me that learning LISP would
>> change my life forever because LISP has something called "macros". I
>> tried to learn it, and disliked it greatly. It's too messy. And what the
>> heck is "cdr" ment to mean anyway? To me, LISP doesn't even seem all
>> that different from normal languages (modulo weird syntax). Now
>> Haskell... that's FUN!]
> Contents of Data Register.
> Macros are like Template Haskell.  One example of where they're useful
> is programmer definition of new binding forms.  That's not possible in
> Haskell without Templates.  Macros were invented in Lisp because the
> syntax is so easy for machine manipulation---they don't have a tenth
> the complexity of Template Haskell for about the same power.
> -Brian

There is also Likell, at http://liskell.org/ by Clemens Fruhwir, which
translates Haskell source into a lisp style prefix syntax (will (all (the
(parentheses)))).  This is to allow macro-like analysis and transformation
without template haskell.

The main use of template haskell that I have seen mentioned on the mailing lists
is to analyze a "data" declaration and auto-generate some new "class" and
"instance" declarations.

But I agree that template haskell has problems:
  (*) Its own syntax, as big and complicated as Haskell
  (*) Has historically been very poorly documented (that _might_ have changed)
  (*) Only works with ghc


More information about the Haskell-Cafe mailing list