Skip to content

GHC panic when calling typeOf on a promoted data constructor

Here's what I did in GHCi to trigger the panic:

$ inplace/bin/ghc-stage2 --interactive
GHCi, version 8.1.20160101: http://www.haskell.org/ghc/  :? for help
λ> :set -XDataKinds
λ> :m Data.Typeable Data.Functor.Compose
λ> typeOf (Proxy :: Proxy 'Compose)
ghc-stage2: panic! (the 'impossible' happened)
  (GHC version 8.1.20160101 for x86_64-unknown-linux):
        piResultTy
  *
  TYPE 'Lifted *

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

Enabling -XPolyKinds doesn't trigger the error, though; #10343 (closed) will be triggered instead:

λ> :set -XPolyKinds
λ> typeOf (Proxy :: Proxy 'Compose)

<interactive>:5:1: error:
    • No instance for (Typeable a0) arising from a use of ‘typeOf’
    • In the expression: typeOf (Proxy :: Proxy Compose)
      In an equation for ‘it’: it = typeOf (Proxy :: Proxy Compose)
Trac metadata
Trac field Value
Version 8.1
Type Bug
TypeOfFailure OtherFailure
Priority high
Resolution Unresolved
Component Compiler (Type checker)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC goldfire
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information