
27 May
2012
27 May
'12
11:27 a.m.
It's common to use a writer monad possibly stacked with other monads (e.g. a state monad for fresh variable names) for code generation that approximates "macro expansion" - i.e. one call in Haskell maps to one-or-more lines of code in the output language, no global transformations are permitted. If you want transformations, then it is likely you will need to model the syntax of the output language or an intermediate language to have something concrete to transform.