
5 Jan
2012
5 Jan
'12
3:41 p.m.
Cafe, I'm playing around with Template Haskell, specifically QuasiQuotes and I've run into something that I hope is not an inherent limitation in TH. Specifically I want to get the type of a variable whose name is used in a QuasiQuote. The code generated by the QQ should depend on the type of the variables that are to be antiquoted. For example let a = True in [qq | a |] should result in different code being generated by the qq than let a = 42 in [qq | a |] because the type of variable "a" is different. So far I've tried simple reification, but
quote = do let varname = "someVariableKnownToExist" info <- reify $ mkName str