Inferred type variable check is defeated by nested foralls
GHC HEAD will reject the following program:
{-# LANGUAGE DefaultSignatures #-}
{-# LANGUAGE RankNTypes #-}
module Bug where
class C a where
m :: forall b. forall c. a -> b -> c -> c
default m :: forall {b}. forall c. a -> b -> c -> c
m _ _ = id
$ ~/Software/ghc5/inplace/bin/ghc-stage2 Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
Bug.hs:7:3: error:
A default type signature cannot contain inferred type variables
In a class method signature for ‘m’
|
7 | default m :: forall {b}. forall c. a -> b -> c -> c
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
However, a simple change to the default signature will evade this check and cause the program to typecheck successfully:
default m :: forall b. forall {c}. a -> b -> c -> c
This seems inconsistent to me.