
Hi, when I tried to reorganize some code to use the data-accessor and data-accessor-template packages, i stumbled across a strange effect: When using template haskell some things are out of scope that really shouldn't be. Let me give an example: ============== T.hs ============== {-# LANGUAGE TemplateHaskell #-} data Foo = Foo { bar :: Bar } $( return [] ) data Bar = Bar ==================================
ghci T.hs GHCi, version 6.10.1: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer ... linking ... done. Loading package base ... linking ... done. [1 of 1] Compiling Main ( T.hs, interpreted )
T.hs:4:13: Not in scope: type constructor or class `Bar' Failed, modules loaded: none. No matter what you do in $( ... ), the code doesn't compile. Even in the simple case above, it doesn't work. What's happening here? Bug or feature? And do you know a workaround? //Stephan -- Früher hieß es ja: Ich denke, also bin ich. Heute weiß man: Es geht auch so. - Dieter Nuhr