
2011/12/9 Stephen Tetley
Geoffrey Mainland did significant work generating C with his GHC quasi quote extension. I'm not sure the status or availability of the code but there was a good Haskell Workshop paper describing it.
For the specific problem of OpenGL - as the package already exists I'm not sure a generative approach would actually pay its way
I believe it is the right approach, and the one used originally. Whenever you will want to add appearing functionalities (from later OpenGL specs) or modify something (debugging facilities), having a generative approach will pay. Actually, from the OpenGL spec files, there is a lot that can be done, not just OpenGL bindings. As for the OP original question, I wonder why he wants to add comments in the generated code. That code should be a straightforward mapping to the original C API. No need to document it. Documentation would be good for higher-level bindings but not for one corresponding tightly to the specs files. Of course some documentation about the used conventions and other generic properties of the bindings would be usefull, but I don't see any reason to generate documentation as part of the generated code. Cheers, Thu