Before, there was a discrepancy in how GHC renamed type synonyms as
opposed to type family instances. That is, GHC would accept definitions like
type T = (Nothing :: Maybe a)
However, it would not accept a very similar type family instance:
type family T :: Maybe a type instance T = (Nothing :: Maybe a)
The primary goal of this patch is to bring the renaming of type family
instances up to par with that of type synonyms, causing the latter definition
to be accepted, and fixing Trac #14131.
In particular, we now allow kind variables on the right-hand sides of type
(and data) family instances to be implicitly bound by LHS type (or kind)
patterns (as opposed to type variables, which must always be explicitly
bound by LHS type patterns only). As a consequence, this allows programs
reported in Trac #7938 and Trac #9574 to typecheck, whereas before they would
have been rejected.
Implementation-wise, there isn't much trickery involved in making this happen.
We simply need to bind additional kind variables from the RHS of a type family
in the right place (in particular, see RnSource.rnFamInstEqn, which has
undergone a minor facelift).
While doing this has the upside of fixing Trac #14131, it also made it easier to
trigger Trac #13985, so I decided to fix that while I was in town. This was
accomplished by a careful blast of reportFloatingKvs in tcFamTyPats.