Possible Duplicate:
Local variables in Template Haskell declarations
I'm trying to construct a simple Template Haskell function that, given a string like "Foo", will construct the syntax tree for data Foo = Foo
.
Right now, I'm trying to do something like mkDecl name = [d|data $(conT name) = Foo|]
, but that's giving me the error: "Malformed head of type or class declaration: $(conT name)". Any idea what's going on?
I could just write it out using dataD and such, but I prefer this way since it'd be much clearer what's going on.