2005-10-27

Standard Annotation Language for Haskell

A thought struck me today: Maybe Haskell needs some standard way to annotate the source code? There's already a semi standard for documentation and that is Haddock. But what I mean is something juicier than that.

It seems several projects are working on attaching some kind annotations to Haskell. It mostly has to do with properties of Haskell functions, for example if a function is idempotent or if it commutes with some other function. The two larger projects that I'm aware of that does these kinds of things are Programatica and Cover. And there is also DrIFT which it a kind of code generation tool for Haskell to simply certain repetitive tasks. All these projects use different means to attach information to Haskell programs.

But doesn't Haskell already have a way to annotate the source code? There is the compiler pragma specified in the language standard. Well, pragmas are only standardized up to the point that they are delimited by certain characters. Apart from that, all bets are off. We need some more structure, a unified syntax along the lines with Java's annotations. While I haven't used the annotation mechanism in Java it looks really well designed and useful. Something along those lines is what I'm after for Haskell.

So, what would this look like. Currently I have no idea. All I know is that having a common way of expressing things saves time and work. Syntax is not shallow, it is really important. The problem is that those people who need it the most (the Programatica and Cover people) are the people who are the least likely to spend any time with this. I know most of these people and the look down upon thing like this, defining a common syntax with no meaning. But XML is also a syntax without meaning and although that sounds like something really ridiculous XML has actually saved a lot of work and has let programmers and designers spend their brainpower on the more semantic parts of their problems.

Well, I should really talk to someone about this. Make the wheels start turning. We'll see how it goes. Unfortunately I'm a bit pessimistic.

No comments: