$ cat Bug.hs
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE FlexibleInstances #-}
module Bug where
data Data :: [*] -> *
class ClassData ps where classData :: Data ps
class ClassR r where classR :: r
instance ClassR r where classR = classData @r
The kind mismatch is correctly reported by ghc:
$ stack ghc Bug.hs [1 of 1] Compiling Bug ( Bug.hs, Bug.o )
Bug.hs:11:45: error:
• Expected kind ‘[*]’, but ‘r’ has kind ‘*’
• In the type ‘r’
In the expression: classData @r
In an equation for ‘classR’: classR = classData @r
|
11 | instance ClassR r where classR = classData @r
| ^
But hie panics:
$ hie Bug.hs
[...]
Dumping diagnostics:
/home/julm/bug/Bug.hs: panic! (the 'impossible' happened)
(GHC version 8.8.3 for x86_64-unknown-linux):
lookup_final_id
$fClassRr
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1159:37 in ghc:Outputable
pprPanic, called at compiler/main/TidyPgm.hs:201:12 in ghc:TidyPgm
Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug
$ hie --version
Version 1.2, Git revision 35f62cffb6bae6c3f86113cb0c55f52b7192689d (3841 commits) x86_64 ghc-8.8.3
On this file:
The kind mismatch is correctly reported by ghc:
But hie panics: