[Haskell-cafe] Metaprogramming in Haskell vs. Ocaml

Casey McCann syntaxglitch at gmail.com
Mon Apr 5 19:37:10 EDT 2010

On Mon, Apr 5, 2010 at 7:05 PM, Jason Dagit <dagit at codersbase.com> wrote:
> On Mon, Apr 5, 2010 at 12:27 PM, Jacques Carette <carette at mcmaster.ca>
> wrote:
>> 2. people who care about types use a typed meta-language (like metaocaml)
>> instead of an untyped template layer atop a (fantastic!) typed language.
> Are you implying that template haskell is not typed?

Not to speak for Jacques, but my impression is that while TH itself is
typed--it's just more Haskell after all--it doesn't do much to prevent
you from generating code that is not well-typed. Or even well-formed,
for that matter; my initial attempts to learn how to use TH produced
quite a few "that's impossible!" errors from GHC (I do not think that
word means what it thinks it means).

There's also type-level metaprogramming, as in e.g. HList, which is
almost completely untyped. I have some personal library code that
implements a simple meta-type system and it's a huge, horrid, painful
mess for something with an expressive power no better than System F.

In contrast, MetaOCaml seems to be some variety of a multi-stage
system where metaprogramming blends smoothly into "regular"
programming with a single, consistent type ensuring type safety at all

- C.

More information about the Haskell-Cafe mailing list