I created Data with a help of Template Haskell. I use it from another program by $(code here).
So, can I convert Data to .hs file? I want to see the structure of Data.
I created Data with a help of Template Haskell. I use it from another program by $(code here).
So, can I convert Data to .hs file? I want to see the structure of Data.
One common way to do this is to write you normal Haskell code that uses the template Haskell and then feed GHC the option -ddump-splices
and -ddump-to-file
to have it output a file containing all of your original code but with the template Haskell expanded so you can see exactly what is being compiled.
Another option if you want to not see the full file is to use the pretty printer that comes with the template-haskell package. The module contains a number of helper functions for constructing a Doc
which may then be rendered to a string with pprint :: Doc -> String
and outputted using the IO features of the Q
monad.