
Hi Martijn, Martijn van Steenbergen wrote:
[...]
Apart from the specific problematic file you gave, I had some other scoping issues when using TH to generate the accessors. I worked around this by defining my data types in a separate module Types and calling the TH functions in that module as the last lines. [...]
looks like your workaround also works in this case. This file (the template instanciation was moved to the last line) compiles: ============== T.hs ============== {-# LANGUAGE TemplateHaskell #-} data Foo = Foo { bar :: Bar } data Bar = Bar $( return [] ) ================================== It looks like the scope is interrupted just above $( ... ) - but I'd like to know why and find a more beautiful way than just moving all th calls to the bottom of the module file :) Regards Stephan -- Früher hieß es ja: Ich denke, also bin ich. Heute weiß man: Es geht auch so. - Dieter Nuhr