Annotating Expressions

ajb at spamcop.net ajb at spamcop.net
Wed Dec 17 01:32:42 EST 2003


G'day all.

Quoting Fergus Henderson <fjh at cs.mu.oz.au>:

> Unless I missed something, none of those solve all the problems that
> Meacham is trying to solve (numbers 1 and 2 in his original mail).

Many of them solve problem number 1, in that an unannotated structure
is computationally identical to the original data structure.

They don't solve problem number 2, that's true, but problem number 2
is largely a matter of taste.

Having said that, have you considered Template Haskell?  I'm not very
familiar with it, but should, in theory, be possible not only to generate
multiple type declarations from the one specification (e.g. one undecorated
type, one decorated with unboxed decorations and another with boxed
decorations), but also generate code which traverses each version uniformly,
ignoring decorations if they're not needed.

However, you may find this even more annoying than casting and uncasting
the newtype.

Cheers,
Andrew Bromage


More information about the Haskell mailing list