On Thu, Oct 30, 2008 at 10:15 AM, Anatoly Yakovenko
<[EMAIL PROTECTED]> wrote:
>>> is there a way to pretty print a module?
>>> like:
>>>
>>> module Main where
>>> import Language.Haskell.TH
>>> main = do
>>>  print $ pprint Main
>>>
>> haskell-src should be able to do that.
>
> I think haskell-src requires you to read the module at run time.  I
> want to embed the contents of the module in my program.  Basically a
> program that can print itself.

Could you use haskell-src from TH and then unsafePerformIO to get the
reading to work during compile time?  I've done something like this in
the past with Language.Haskell and TH.  I described it here:
http://blog.codersbase.com/2006/09/01/simple-unit-testing-in-haskell/

Maybe someone who has studied more TH knows a way to remove the unsafePerformIO.

Jason
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to