> Since you ask how other packages solve this problem, and since most
> packages use template haskell, I have to ask: why can't you use
> template haskell for this?
For my case, template haskell can't create modules, and template
haskell solves a different problem - I've not interested in creating
Haskell declarations from Haskell declarations - I'm interested in
creating Haskell modules from an external, formal, specification. In
a sense I'm compiling to Haskell.
It occurs to me that c2hs (or more appropriately the gtk2hsc2hs fork) is intended to solve this problem; have you looked into it?