[Template-haskell] quasi quotes and Q monad

Bulat Ziganshin bulatz at HotPOP.com
Thu Jan 19 04:13:34 EST 2006


Hello Ch.,

Wednesday, January 04, 2006, 5:44:53 PM, you wrote:

sorry, but i read your message only now. try to read
http://freearc.narod.ru/th.htm - it contains my own unfinished tutorial on
TH, which may be helpful for you. in brief, all TH syntax sugar in
form of quotation brackets is translated to low-level expressions,
which runs in the global quotation monad environment

CAH> I worried whether the function f in low-level style with this
CAH> use of return is equivalent to the quasi-quoted version.
CAH> Somehow I  felt the need to  connect the argument of  g with
CAH> the monad of which the value of g's result belongs to. It
CAH> appeared to me that this is what the quotation brackets [|y|] are
CAH> establishing, because y is also in the scope of the outer brackets. 

CAH> On the one hand, I wonder why the name generation history, when
CAH> code generation for a quotation part is finished, is not reset to the state
CAH> before. This would be the case with the separate monad for g's
CAH> argument. On the other hand, it must be possible to nest quotation
CAH> brackets and still establish that names at the different levels are
CAH> distinct, if it is wanted.

CAH> Many thanks in advance for any enlighting explanation

-- 
Best regards,
 Bulat                            mailto:bulatz at HotPOP.com





More information about the template-haskell mailing list