[GHC] #11334: GHC panic when calling typeOf on a promoted data constructor

GHC ghc-devs at haskell.org
Thu Jan 28 02:33:34 UTC 2016


#11334: GHC panic when calling typeOf on a promoted data constructor
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:  bgamari
            Type:  bug               |               Status:  new
        Priority:  highest           |            Milestone:  8.0.1
       Component:  Compiler (Type    |              Version:  8.0.1-rc1
  checker)                           |
      Resolution:                    |             Keywords:  TypeInType
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Compile-time      |  Unknown/Multiple
  crash                              |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D1757
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by goldfire):

 Yech.

 First off, let's rename the data constructor and type constructor
 differently. I got quite confused about that!

 {{{
 data Ty (f :: k -> *) (a :: k) = Con (f a)
 }}}

 This produces

 {{{
 Ty :: forall k. (k -> *) -> k -> *
 Con :: forall k (f :: k -> *) (a :: k). (f a) -> Ty k f a
 }}}

 The question is: how should we interpret `Proxy 'Con` with
 `-XNoPolyKinds`?

 The old rule for `-XNoPolyKinds` was "set all kind variables to `*`",
 which is still what `quantifyTyVars` is doing. This used to make sense,
 because all kind variables used to have sort `BOX`, never something like
 `BOX -> BOX`. But those halcyon days are now gone.

 I suppose it would be reasonable to set all kind variables of kind `*` to
 be `*`, and use `Any` for the others. We don't want to just use `Any` all
 the time, because that wouldn't be backwards compatible and defaulting to
 `*` is quite sensible.

 The other reasonable way forward is to issue an error at `Proxy 'Con`
 without having more direction. For example, the user could say `Proxy
 ('Con :: Maybe Bool -> Ty * Maybe Bool)` to get the right instantiation.

 I actually prefer the "issue an error" option. The user could use a kind
 signature, but more likely should just enable `-XPolyKinds`. Using a
 promoted data constructor taken from a polykinded datatype without
 `-XPolyKinds` is asking for trouble.

 I'm happy to put this change in when I get to rounding up these tickets.

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


More information about the ghc-tickets mailing list