ghc.exe: panic! (the 'impossible' happened) using a data family in GHC 9.0.1
Summary
Compiling the below program causes the following error:
Loaded package environment from C:\Users\Owner\AppData\Roaming\ghc\x86_64-mingw32-9.0.1\environments\default
[1 of 1] Compiling Main ( app\Main.hs, app\Main.o )
ghc : ghc.exe: panic! (the 'impossible' happened)
At line:1 char:1
+ ghc app/Main > cabal-output.txt 2>&1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (ghc.exe: panic!...ible' happened):String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
(GHC version 9.0.1:
No skolem info:
[k_ah0[sk:1]]
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler\GHC\Utils\Outputable.hs:1230:37 in ghc:GHC.Utils.Outputable
pprPanic, called at compiler\\GHC\\Tc\\Errors.hs:2810:17 in ghc:GHC.Tc.Errors
Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug
Steps to reproduce
Compile the following program:
{-# LANGUAGE PolyKinds, RankNTypes, TypeFamilies #-}
module Main where
class TypeLike k where
data ToType :: k -> *
instance TypeLike k => TypeLike (k1 -> k) where
data ToType f = ToType1 (forall x. f x)
Expected behavior
I expect to get an error because the kind of forall x. f x
should be k
, not *
Environment
- ghc 9.0.1
Optional:
- Operating System: Windows 10