[Haskell-cafe] Metaprogramming in Haskell vs. Ocaml
dons at galois.com
Fri Apr 2 22:59:52 EDT 2010
> Hi all,
> I would like to learn a little bit more about metaprogramming in
> Haskell. And I'm also wondering why metaprogramming is used much more
> in Ocaml than in Haskell.
> Camlp4 (Ocaml's metaprogramming facility) doesn't seem to much more
> powerful that Template Haskell. The former is celebrated in its
> community as a killer feature of the language and its use is
> encouraged by numerous accessible tutorials. The latter however is
> down-played and not as well documented.
> Seeing that the languages are parallel in many ways is there some
> reason for this? Is metaprogramming less useful in Haskell? Is it
> worth learning?
Template Haskell is actually a fairly popular extension (around 5% of
Hackage packages use some TH). And the addition of quasiquotation --
which allows custom syntax -- might make it more popular.
I think we don't see as much metaprogramming because of other language
features -- laziness, operator syntax, and type classes -- make a bunch
of common designs work without needing metaprogramming.
More information about the Haskell-Cafe