[GHC] #9813: Error when reifying type constructor

GHC ghc-devs at haskell.org
Fri Feb 12 13:51:37 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 goldfire):

 If we are willing to expose GHC's internal toposort of declarations (that
 is, its process of finding mutually recursive groups, without regard to
 top-to-bottom ordering, and then processing these groups in dependency
 order), then we might be able to do away with the stage restriction.

 Indeed, I was surprised to see that the Haskell 2010 report even contains
 a description of the toposort: see
 [https://www.haskell.org/onlinereport/haskell2010/haskellch4.html#x10-880004.5
 Section 4.5.1]. The context there is different than here, but it all still
 relies on finding chunks of perhaps-mutually-recursive definitions.

 So perhaps the process is this:

 1. Split up the module into regions separated by top-level declaration
 splices.
 2. Within each region, chunk the declarations into mutually recursive
 groups. Any declaration with a splice in it is considered to depend on all
 other declarations in the region.
 3. Process the chunks in dependency order, making already-processed chunks
 available both for
   a. reification
   b. calling in a splice (i.e. loosening the stage restriction)

 I actually that's not quite so bad. It's not really too hard to
 understand. It might be some work to implement; it will depend on the
 details. But it surely seems ''possible'' to implement. And, as far as I
 can see, this is a loosening of existing restrictions. No code that is
 accepted today would be rejected by these rules.

 What do you think?

 And, in answer to your question, I don't think this is much related to
 #1831.

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


More information about the ghc-tickets mailing list