
If I'm understanding this correctly, Template Haskell is a way to auto-generate repetative Haskell source code. The thing that worries me is... if you need to write repetative Haskell source code, doesn't that mean that Haskell itself is broken in the first place?

Andrew Coppin
If I'm understanding this correctly, Template Haskell is a way to auto-generate repetative Haskell source code.
The thing that worries me is... if you need to write repetative Haskell source code, doesn't that mean that Haskell itself is broken in the first place?
If you've merely got repetitive code, use monads or even plain, simple functions. If you've got something to generate code from, be it an .xml or directly a direct algorithmic description of an algorithm, use templates. Imagine generating an HTML combinator library out of the HTML dtd or generating specialised versions of an n-dimensional A*. -- (c) this sig last receiving data processing entity. Inspect headers for copyright history. All rights reserved. Copying, hiring, renting, performance and/or quoting of this signature prohibited.

Achim Schneider wrote:
Imagine generating an HTML combinator library out of the HTML dtd.
That seems like a fairly extreme thing to want to be doing... But yeah, if you wanted to do something like that, machine-generated is the way. (Presumably a much more common thing to want to do is generate Haskell bindings from a C header file...)

On Tue, 21 Oct 2008, Andrew Coppin wrote:
If I'm understanding this correctly, Template Haskell is a way to auto-generate repetative Haskell source code.
Amongst other things, yes. It's also a way to perform repetitive transformations on code, for example.
The thing that worries me is... if you need to write repetative Haskell source code, doesn't that mean that Haskell itself is broken in the first place?
For what're sometimes pretty picky values of broken that apply to almost any statically-typed language, yeah. Sometimes we don't know what non-broken would look like yet though. -- flippa@flippac.org "I think you mean Philippa. I believe Phillipa is the one from an alternate universe, who has a beard and programs in BASIC, using only gotos for control flow." -- Anton van Straaten on Lambda the Ultimate

The thing that worries me is... if you need to write repetative Haskell source code, doesn't that mean that Haskell itself is broken in the first place?
I wouldn't go as far as calling it "broken". Sure, writing boilerplate is a pain, but Haskell in this respect is far better than many (most?) other languages. On top of that, the language keeps evolving with new extensions that add new flexibility, TH being one of them. This is the part when the Lisp hackers in the audience chuckle, as one of them raises a hand and asks "What happens when you grow tired of writing TH boilerplate? Wait for another extension? And what after that?". Note to self: give Liskell a try before the end of the year. -- Ariel J. Birnbaum

On Wed, 22 Oct 2008, Ariel J. Birnbaum wrote:
This is the part when the Lisp hackers in the audience chuckle, as one of them raises a hand and asks "What happens when you grow tired of writing TH boilerplate? Wait for another extension? And what after that?".
To be fair, the TH boilerplate isn't an awful lot more than you'd get stuck with in lisp anyway. You just use TH to call more TH in that case. -- flippa@flippac.org Performance anxiety leads to premature optimisation
participants (4)
-
Achim Schneider
-
Andrew Coppin
-
Ariel J. Birnbaum
-
Philippa Cowderoy