Implicit variable binding with type instance and explicit forall
Summary
Variables in signatures on the right hand side of a type instance are imperoply bound when there is an explicit forall.
Steps to reproduce
{-# LANGUAGE ExplicitForAll #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE DataKinds #-}
module ScopeProblem where
type family A :: k
type instance forall. A = Nothing :: Maybe a -- 'a' should be out of scope
class Foo x where
type B x :: Maybe a
type forall x. B x = Nothing :: Maybe a -- 'a' should be out of scope
instance Foo [x] where
type forall. B [x] = Nothing :: Maybe a -- 'a' should be out of scope
Expected behavior
a
should be out of scope in all 3 cases.
Environment
- GHC version used: 8.10.1