Given an expression foo
, I could declare a top-level function
bar = foo
and get the type of foo
as Type
by reifying bar
:
case reify 'bar of
VarI _ t _ _ -> t
Is there a direct way of getting the type of foo
, without creating the redundant definition of bar
? Ideally as function of type Exp -> Q Type
.
reify 'foo
work out for you? – Nonetfoo
just stands for an expression here, such as1 + 2 + 3
, it's not a name. – Rectorreify
is the only reification function of TH and since it only accepts names, I guess you're pretty much bound. – Nonet