But Section 8.1 of "Template Meta-programming for Haskell" says:
"In a similar way, reifyDecl f, gives a data structure that represens the value declaration for f;..."
and later "... useful to restrict the use of reifyDecl to type constructors, classes, or variables (e.g. functions) declared at the top level..."
From that I made a conclusion that it is possible to reify function declarations (the most interesting ability of TH to me comparing with C++, for instance). And I still hope :) that it is possible and the error message above is just due to mere bug.
This you definitely can't do and oh, how I wish you could. The closest you can get is to define a function as reified code and then splice it. Example: d_fun = [d| fun = <function body> |] And then you include $(d_fun) in another file to splice it in. This way you have the reified code "d_fun" and fun is also in scope. You can then manually write a lookup table of strings map to reified function declarations. Sean