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

GHC ghc-devs at haskell.org
Sat Jan 9 19:18:59 UTC 2016


#11334: GHC panic when calling typeOf on a promoted data constructor
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:
            Type:  bug               |               Status:  new
        Priority:  high              |            Milestone:  8.0.1
       Component:  Compiler (Type    |              Version:  8.1
  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):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by RyanGlScott):

 I dug a little more into the issue, and it looks like the issue is
 specifically with `typeOf`, not, say, `typeRep`. Compare:

 {{{
 $ /opt/ghc/head/bin/ghci
 GHCi, version 8.1.20160108: http://www.haskell.org/ghc/  :? for help
 λ> :set -XDataKinds
 λ> :m Data.Proxy Data.Functor.Compose Data.Typeable
 λ> typeRep (Proxy :: Proxy 'Compose)
 'Compose
 λ> typeRep (Proxy :: Proxy 'Just)
 'Just
 λ> typeRep (Proxy :: Proxy 'Proxy)
 'Proxy
 }}}

 versus

 {{{
 λ> typeOf (Proxy :: Proxy 'Compose)
 ghc: panic! (the 'impossible' happened)
   (GHC version 8.1.20160108 for x86_64-unknown-linux):
         piResultTy
   *
   TYPE 'Lifted *

 Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

 λ> typeOf (Proxy :: Proxy 'Just)
 Proxy (TYPE 'Lifted -> Maybe (TYPE 'Lifted)) 'Just
 λ> typeOf (Proxy :: Proxy 'Proxy)
 Proxy (Proxy (TYPE 'Lifted) (TYPE 'Lifted)) 'Proxy
 }}}

 Those last two results definitely look funny. I'm guessing that the issue
 pertains to levity polymorphism. I'll try to see what I can find about how
 `typeOf` works.

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


More information about the ghc-tickets mailing list