[Haskell-cafe] Template Haskell messes up scoping?

Martijn van Steenbergen martijn at van.steenbergen.nl
Sun Mar 29 14:34:33 EDT 2009


Hi Stephan,

Stephan Friedrichs wrote:
> 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.

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. Then I had my other 
modules import Types, bringing the types and the accessors back in 
scope. See:

http://code.google.com/p/custard/source/browse/trunk/MudTypes.hs

Hope this helps,

Martijn.


More information about the Haskell-Cafe mailing list