[GHC] #9813: Error when reifying type constructor

GHC ghc-devs at haskell.org
Mon Feb 15 18:11:06 UTC 2016


#9813: Error when reifying type constructor
-------------------------------------+-------------------------------------
        Reporter:  owst              |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Template Haskell  |              Version:  7.8.3
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D1899
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by rwbarton):

 This all sounds great except for one thing. Do we have a plan for actually
 loosening the stage restriction? The stage restriction exists for
 technical reasons, not conceptual reasons.

 The stage restriction currently applies to the module as a whole. It says
 you cannot use an identifier that was defined in a module within a splice
 in the same module. Clearly if the use is in a later declaration group
 than the definition, there is no problem in principle with lifting the
 restriction. But in order to do so, we would have to run the declaration
 group containing the definition through the entire compiler pipeline,
 right up to linking, so that we can load it to run the splice in the
 latter declaration group to begin type checking it. GHC just isn't
 organized to work that way currently.

 The user's guide has this to say on the subject:

 > You can only run a function at compile time if it is imported from
 another module. That is, you can't define a function in a module, and call
 it from within a splice in the same module. (It would make sense to do so,
 but it's hard to implement.)

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


More information about the ghc-tickets mailing list