On 02 May 2003 16:51:46 +0200
François-Régis Sinot
My second point is that the syntax is inconsistent with the intended semantics: for example, the documentation says that it should be possible to reify a function definition and a prototype. But if I ask reifyDecl length, what do I expect ? The def or the proto ? Same thing with reification of instance declarations. As a matter of fact, the present implementation does not seem to handle the cases of prototypes and instances, and I don't think it is an urgent matter. However, I think the syntax should not already forbid that. [...]
I can't comment on the other parts, I would imagine it's an implementation restriction that could be lifted, but with quite a bit of effort. However, which documntation says reifyDecl reifies the type? I don't remember reading that anywhere (though I may have just forgotten). I've always thought of reifyDecl and it has always worked that way for me as providing the definition and only the definition. There is a seperate construct (reifyType) for type information (I think last time I checked it wasn't implemented or maybe I'm thinking of something else). My solution for abstracting away which datatype to process, is simply to have the generation function be f :: Decl -> Decl, actually in my case it was genAlgebra :: String -> [Decl] -> Q [Dec]. Then, one would use it as: $(genAlgebra "Lang" [reifyDecl Type,reifyDecl Expr]) not the prettiest solution, but not much worse than what it would be anyways. However, I can think of other problems where this limitation may be an issue, your problem may be in that category.