Suggest `-XScopedTypeVariables` with an out-of-scope type variable
Given the setup of
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE ExplicitForAll #-}
import Data.Data (Proxy(Proxy))
import GHC.TypeLits (symbolVal, KnownSymbol, Symbol)
both
class Foo f where
whatever :: Proxy f -> String
data Bar (s :: Symbol)
instance KnownSymbol s => Foo (Bar s) where
whatever _ = symbolVal (Proxy @s)
and
whatever :: forall s. KnownSymbol s => Proxy s -> String
whatever _ = symbolVal (Proxy @s)
fail with [GHC-76037] Not in scope: type variable ‘s’
I think it would be sensible to suggest enabling ScopedTypeVariables
here. The only other place where the extension is suggested is when type signatures occur in patterns.