[GHC] #9768: Declarations processed in unexpected order in the presence of TH declaration splices

GHC ghc-devs at haskell.org
Tue Nov 4 22:30:22 UTC 2014


#9768: Declarations processed in unexpected order in the presence of TH
declaration splices
-------------------------------------+-------------------------------------
              Reporter:  qnikst      |            Owner:  goldfire
                  Type:  bug         |           Status:  closed
              Priority:  normal      |        Milestone:
             Component:  Template    |          Version:  7.8.3
  Haskell                            |         Keywords:
            Resolution:  wontfix     |     Architecture:  Unknown/Multiple
      Operating System:              |       Difficulty:  Unknown
  Unknown/Multiple                   |       Blocked By:
       Type of failure:              |  Related Tickets:
  None/Unknown                       |
             Test Case:              |
  https://gist.github.com/qnikst/b93e7154e78bcc159be2|
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------
Changes (by goldfire):

 * status:  new => closed
 * resolution:   => wontfix


Comment:

 GHC's current behavior is actually exactly as advertised (although perhaps
 unintuitive). From section 7.16.1 of the manual:

     A declaration group is the group of declarations created by a top-
 level declaration splice, plus those following it, down to but not
 including the next top-level declaration splice. The first declaration
 group in a module includes all top-level definitions down to but not
 including the first top-level declaration splice.

 Thus, in the OP's code, `def "B"` and `main` are in the same group, and
 accordingly, a splice within that group can't reify the group's own types.

 This could be changed easily enough, but I think a change would make TH
 strictly less expressive. Using the current behavior, a splice could
 include part of a declaration (say, just a type signature) and the rest of
 the declaration can be hand-written outside the splice. If we made a top-
 level splice its own inviolable group, such a split declaration would be
 impossible to write.

 So, I'm closing this ticket, as everything seems OK to me. Do reopen if
 this is really ruining your day.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9768#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list