Hi everyone, I have never written a Template Haskell function, but for the first time I am using one from a library, and I am encountering the following situation:
The library I’m using is apecs-stm
. As it reexports symbols from the apecs
library, the library documentation explicitly recommends that I import it qualified, which is what I do (under the alias AS
).
Now apecs-stm
features a Template Haskell function makeWorld
, which generates code that includes the Has
symbol (from apecs-stm
too). The problem is, when I try to compile my code, the compiler complains because Has
is not in scope.
Indeed, Has
is not in scope, only AS.Has
is, since I imported apecs-stm
qualified.
I think that I could easily bypass the issue by importing Has
unqualified on top of the qualified import, but I feel this might not be a good practice, and I worry I might be misunderstanding how TH works/is supposed to be used. In particular, I am surprised that using this TH function requires me to import some symbols one way (unqualified) instead of another.
So I guess my question is:
What is the right way to deal with TH code that generates unqualified library symbols?