[Haskell-cafe] how to generate source code from TH Exp?
sergueyz at gmail.com
Thu May 12 16:03:15 CEST 2011
Just pretty-print a Exp.
It seems that "show $ ppr exp" will produce exactly what you need.
The same goes for Dec (declarations), etc.
2011/5/12 Stefan Kersten <sk at k-hornz.de>:
> i was wondering if it's possible to directly generate Haskell source code
> from a Template Haskell `Q Exp', i.e. use TH as a kind of preprocessor? i am
> asking because currently the iOS port of ghc doesn't support TH and i need
> to generate some instances for the persistent package [1,2].
> i've been toying with
> fmap ppr . runQ $ q
> but the result needs to be edited by hand quite a bit. any ideas where to
>  http://hackage.haskell.org/package/persistent
>  http://hackage.haskell.org/package/persistent-template
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
More information about the Haskell-Cafe