GHC doesn't emit error for kind mismatch in TH splice
Consider the following program:
{-# LANGUAGE TemplateHaskell #-}
module Bug where
$(let slurmp :: [Maybe]
slurmp = []
in pure [])
There is a kind error in this program (see [Maybe]
). GHC 8.6.5 correctly identifies the kind error:
$ /opt/ghc/8.6.5/bin/ghc Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
Bug.hs:4:18: error:
• Expecting one more argument to ‘Maybe’
Expected a type, but ‘Maybe’ has kind ‘* -> *’
• In the type signature: slurmp :: [Maybe]
In the expression:
let
slurmp :: [Maybe]
slurmp = []
in pure []
|
4 | $(let slurmp :: [Maybe]
| ^^^^^
GHC 8.8.4 and later, however, do not emit an error at all!
$ /opt/ghc/8.8.4/bin/ghc Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
$ echo $?
1
$ /opt/ghc/9.0.1/bin/ghc Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o, Bug.dyn_o )
$ echo $?
1
This appears to be a regression.