
Here is a restriction for hs-boot files and TH which might solve this
#12034: Template Haskell + hs-boot = Not in scope during type checking, but it passed the renamer -------------------------------------+------------------------------------- Reporter: ezyang | Owner: (none) Type: bug | Status: new Priority: low | Milestone: Component: Template Haskell | Version: 8.0.1-rc2 Resolution: | Keywords: backpack hs- | boot Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Ericson2314): I have a situation with a {{{makeClassy}} classy lens class cycle that I cannot break (modulo manually expanding the TH). I'd like something like an ''intra''-module hs-boot file to fix this. I gather from this issue that I shouldn't waste time breaking up my module, as .hs-boot as it currently stands won't save me. Replying to [comment:3 ezyang]: problem.... Ezyang's proposal would also not help because the splice defines the Has* class. I believe the staging restriction as it currently stands ought just to apply to code executed as part of a TH splice. Quoted variable resolution should be fine: if and only the user uses one of the APIs to learn more about a defintion, they should only hit a Nothing/exception because a staging restriction. intra-module hs-boot would then be a way to assert that some further-down splice defines some names, enough for names, including quoted names, to resolve. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12034#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler