
#9871: Template Haskell declaration splice causes subsequent declarations to fall out of scope -------------------------------------+------------------------------------- Reporter: | Owner: RyanGlScott | Status: closed Type: bug | Milestone: Priority: normal | Version: 7.8.3 Component: | Keywords: Documentation | Architecture: Unknown/Multiple Resolution: fixed | Difficulty: Unknown Operating System: | Blocked By: Unknown/Multiple | Related Tickets: Type of failure: GHC | rejects valid program | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by goldfire): * status: new => closed * resolution: => fixed * component: Template Haskell => Documentation Comment: This is by design, but I've tweaked the TH documentation to make this more apparent. A top-level declaration splice (your `$(deriveJSON ... )`) breaks up the mutual recursion among all top-level declarations. Code above the splice can't see code below it. This allows code within the splice to see some definitions in your file, and code after the splice to see the definitions in the splice itself. Thanks for reporting! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9871#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler