SPECIALISE instance pragmas allow nested `forall`s/contexts
GHC rejects nested forall
s and contexts in instance declarations, like so:
class C a
instance forall a. forall b. C (Either a b)
Bug.hs:6:20: error:
Instance head cannot contain nested ‘forall’s or contexts
In an instance declaration
|
6 | instance forall a. forall b. C (Either a b)
| ^^^^^^^^^^^^^^^^^^^^^^^^
However, GHC permits nested forall
s in SPECIALISE instance
pragmas, like in the following example:
instance C (Either a b) where
{-# SPECIALISE instance forall a. forall b. C (Either a b) #-}
This seems inconsistent. If we reject nested forall
s in the former, we should reject them in the latter as well.