[Template-haskell] reifyDecl and reifyType not working
g9ks157k at acme.softbase.org
Mon Sep 10 12:57:09 EDT 2007
Am Montag, 10. September 2007 14:18 schrieb Ian Lynagh:
> On Mon, Sep 10, 2007 at 08:59:45AM +0100, Simon Peyton-Jones wrote:
> > 'reifyDecl' is not a language construct; it's a function. You need to
> > import Language.Haskell.TH to bring it into scope.
> It's also just called reify these days.
This is not what the GHC User’s Guide talks about when discussing reifyDecl
and reifyType. In an expression reifyDecl A, A has to be a type constructor
or a class, and in an expression reifyType a, a has to be an identifier. So
reifyDecl and reifyType cannot be functions but must be language constructs.
On the other hand, reify expects a value of type Name as an argument.
The problem is that I wanted to use reifyDecl as a workaround to create values
of type Name. The Template Haskell library doesn’t seem to provide a way to
create a Name value which always refers to the same entity, regardless of the
splice where it is used. So I wanted to use workarounds like this:
className :: Name
ClassD _ className _ _ _ = reifyDecl Class
More information about the template-haskell