8.10.1-alpha2: Unhelpful error message for type signature without corresponding definition
If you compile the following code with GHC 8.10.1-alpha2:
module Bug where
(<+>) :: Int
data (<+>)
You'll get this error message:
$ /opt/ghc/8.10.1/bin/ghc Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
Bug.hs:4:1: error:
The type signature for ‘<+>’ lacks an accompanying binding
Perhaps you meant ‘<+>’ (Defined at Bug.hs:5:1)
|
4 | (<+>) :: Int
| ^^^^^
This error message is profoundly unhelpful, since it complains about missing a binding for <+>
but then recommends trying to instead use the name <+>
, which is exactly the name I'm using! Note that this does not happen with earlier GHC versions, making this a regression (likely introduced in !760 (merged)):
$ /opt/ghc/8.8.1/bin/ghc Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
Bug.hs:4:1: error:
The type signature for ‘<+>’ lacks an accompanying binding
|
4 | (<+>) :: Int
| ^^^^^
Another way to trigger this problem is to use StandaloneKindSignatures
:
{-# LANGUAGE StandaloneKindSignatures #-}
module Bug where
type MkT :: T
data T = MkT
$ /opt/ghc/8.10.1/bin/ghc Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
Bug.hs:4:6: error:
The standalone kind signature for ‘MkT’
lacks an accompanying binding
Perhaps you meant ‘MkT’ (Defined at Bug.hs:5:10)
|
4 | type MkT :: T
| ^^^
Patch incoming.