Re[4]: Template Haskell crashes unexpectedly...

2006-08-22 Thread Bulat Ziganshin
Hello Brian, Tuesday, August 22, 2006, 1:16:08 AM, you wrote: The solution seems to be something like: $(extend_data [d| data D = X {f::Int, g::String} |]) $(extend_instance [d| instance Obj D where ... |]) or just

Template Haskell crashes unexpectedly...

2006-08-21 Thread Brian Hulley
Hi, I'm starting to explore Template Haskell and I've got the following program: -- almost directly from Template meta-programming in Haskell paper module Duma.Template.Test ( Format(..) , printf ) where import Language.Haskell.TH

Re: Template Haskell crashes unexpectedly...

2006-08-21 Thread Arie Peterson
Hello Brian, [snip] getInfo :: Q Info getInfo = reify (mkName Car) [snip] -- Crashes if I try to print out the info -- info - runQ getInfo -- putStrLn (pprint info) [snip] The example from the paper works fine with the few minor

Re: Template Haskell crashes unexpectedly...

2006-08-21 Thread Bulat Ziganshin
Hello Brian, Monday, August 21, 2006, 6:34:06 PM, you wrote: -- almost directly from Template meta-programming in Haskell paper i should warn you that some TH details was changed in 6.4. these changes described in second TH paper and afair, reifying is among them look at

Re: Template Haskell crashes unexpectedly...

2006-08-21 Thread Brian Hulley
Bulat Ziganshin wrote: Hello Brian, Monday, August 21, 2006, 6:34:06 PM, you wrote: -- almost directly from Template meta-programming in Haskell paper i should warn you that some TH details was changed in 6.4. these changes described in second TH paper and afair, reifying is among

Re: Template Haskell crashes unexpectedly...

2006-08-21 Thread Brian Hulley
Arie Peterson wrote: I seem to remember that 'reify' cannot be run in the IO monad. IIRC ghci gives a nice error message saying this, so perhaps you can try to execute 'main' from within ghci to corroborate my suspicion. Yes you're right - ghci gives the error: Can't do `reify' in the IO

Re[2]: Template Haskell crashes unexpectedly...

2006-08-21 Thread Bulat Ziganshin
Hello Arie, Monday, August 21, 2006, 7:08:31 PM, you wrote: getInfo :: Q Info getInfo = reify (mkName Car) -- Crashes if I try to print out the info -- info - runQ getInfo I seem to remember that 'reify' cannot be run in the IO monad. oh, yes! runQ

Re: Re[2]: Template Haskell crashes unexpectedly...

2006-08-21 Thread Brian Hulley
Bulat Ziganshin wrote: as you can see, it don't supports reification, recovery and information about currently compiled module just because there is no such information when program runs. and of course, you can't add new fields or new functions at run-time. isntead typical technique is: