
With macros you can define new variable binding constructs.
That's something I occasionally miss in Haskell.
-- Lennart
On Wed, Jan 14, 2009 at 6:48 PM, Jonathan Cast
On Wed, 2009-01-14 at 12:39 -0600, Tim Wawrzynczak wrote:
You're probably right. I've played around with LISP macros a little, but it seems that most of the cases where you would use a macro in LISP you don't need one in haskell due to lazy evaluation. Although I haven't played around with them enough to say much one way or another.
Do you know of a particular example where a macro would be a big help in haskell?
Well, like many good programming tools, Lisp macros are another abstraction, but instead of dealing with data, they deal with code.
Haskell already has a couple of abstraction tools for dealing with code. One is called `first-class functions'; another is called `lazy evaluation'.
They are a syntactic abstraction.
What is this good for? I suspect most Lisp macros are parametric in form, rather than really syntactic; I know that every example of a Lisp macro I've seen is parametric in form. Parametric macros --- macros that don't deconstruct their arguments --- don't usually need to be macros at all in modern functional languages. Do you have an example of a macro that can't be replaced by higher-order functions and laziness?
They're often described as "programs that write programs."
So are code generators. The most common example of a code generator is probably YACC --- but Parsec replaces it, with better readability even, with first-class parsers (built atop first-class functions).
jcc
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe