[Template-haskell] Renaming in pretty printer

Andy Gill andy at galois.com
Tue Mar 28 12:58:20 EST 2006


Template Haskell appears to be doing renaming during pretty printing.
Take this example, that both prints the AST directly, as well as  
pretty printing.

*Main> runQ ([| let x = 1 in x |]) >>= \x -> print (pprint x,x)
("let x_0 = 1\n in x_0",LetE [ValD (VarP x_7) (NormalB (LitE  
(IntegerL 1))) []] (VarE x_7))

The var x has name x_7 in the AST, but x_0 in the pretty printed  
version.

Can someone comment on why this is done?

Andy Gill



More information about the template-haskell mailing list