[GHC] #13848: Unexpected order of variable quantification with GADT constructor

GHC ghc-devs at haskell.org
Mon Jun 19 23:53:15 UTC 2017


#13848: Unexpected order of variable quantification with GADT constructor
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler (Type    |              Version:  8.0.1
  checker)                           |             Keywords:
      Resolution:                    |  TypeApplications
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 RyanGlScott):

 The question remains: how could we preserve the order in which the user
 wrote the `forall`d variables? The assumption that they should be
 partitioned into separate universal and existential groups is baked pretty
 deeply into the GHC AST, as `DataCon` has separate `dcUnivTyVars` and
 `dcExTyVars` fields, and never the twain shall meet.

 One possible solution is to introduce a `dcOrigTyVars :: Maybe [TyVar]`
 field, which is `Just` the `forall`d variables (in whatever order the user
 writes) or `Nothing` otherwise. GHC could then use this information when
 computing `dataConUserType`, which I believe GHC uses for determining the
 order in which `TypeApplications` happen.

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


More information about the ghc-tickets mailing list