Panic on ":t datatypeName"
Reproduction:
GHCi, version 8.1.20160826: http://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /Users/leo/.ghci
Prelude> :m + GHC.Generics
:m + GHC.Generics
Prelude GHC.Generics> :t datatypeName
:t datatypeName
ghc-stage2: panic! (the 'impossible' happened)
(GHC version 8.1.20160826 for x86_64-apple-darwin):
ASSERT failed!
CallStack (from HasCallStack):
assertPprPanic, called at compiler/types/TyCoRep.hs:2094:44 in ghc:TyCoRep
checkValidSubst, called at compiler/types/TyCoRep.hs:2122:17 in ghc:TyCoRep
substTy, called at compiler/typecheck/TcMType.hs:793:24 in ghc:TcMType
in_scope InScope {k1_a1X8}
tenv [a1X0 :-> k1_a1X8[tau:3]]
cenv []
tys [k_a1X4[tau:3] → (k1_a1X0 → *) → k1_a1X0 → ★]
cos []
needInScope [a1X4 :-> k_a1X4[tau:3]]
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug