[Template-haskell] Obtaining the declaration of a variable name.

Alfonso Acosta alfonso.acosta at gmail.com
Fri Nov 2 18:36:47 EDT 2007


Hi,

The reification information of a variable is declared as:

VarI Name Type (Maybe Dec) Fixity

When I began using TH, I thought it was great to be able to retreive
the declaration of a variable out of its name (it would have turned
out to be pretty useful).

However, after testing that reify returned Nothing all the time, I
figured out I sadly couldn't count on that.

That feature seems to be handy for my compiler again so I tried to
guess what was wrong.

According to Language.TH.Syntax:

-- Nothing for lambda-bound variables, and
-- for anything else TH can't figure out
-- E.g. [| let x = 1 in $(do { d <- reify 'x; .. }) |]

However, the typechecker (TcSplice module) always returns Nothing. So
I guess it's simply not implemented.

Am I missing something or should I add a feature request ticket?

Thanks,

Fons


More information about the template-haskell mailing list