
#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): I don't think it's going to be that simple. If you look at the implementation of `mkDataConRep`, you'll notice that it figures out the type of the `wrap_id` like this: {{{#!hs wrap_ty = dataConUserType data_con }}} So obviously we don't want to change `dataConUserType`'s implementation to use `idType wrap_id`, since that would be a circular definition.
We should ensure that the wrapper type reflects exactly the type the user wrote including type variable order
Sure, but that's easier said than done. The only info you have in `mkDataConId` to determine the wrapper type is the `DataCon` itself, and at that point, the type variables have already been carved up into the universal and existential ones, with no way to recover the original order. So I don't see any way to make this work without having a separate `dcOrigTyVars` fields, as proposed in comment:2. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13848#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler