Use HsTyPats in associated type family defaults
Associated type family default declarations behave strangely in a couple of ways:
- If one tries to bind the type variables with an explicit
forall
, theforall
'd part will simply be ignored. (#16110 (closed)) - One cannot use visible kind application syntax on the left-hand sides of associated default equations, unlike every other form of type family equation. (#16356 (closed))
Both of these issues have a common solution. Instead of using
LHsQTyVars
to represent the left-hand side arguments of an
associated default equation, we instead use HsTyPats
, which is what
other forms of type family equations use. In particular, here are
some highlights of this patch:
-
FamEqn
is no longer parameterized by apats
type variable, as thefeqn_pats
field is now alwaysHsTyPats
. - The new design for
FamEqn
in chronicled inNote [Type family instance declarations in HsSyn]
. -
TyFamDefltEqn
now becomes the same thing asTyFamInstEqn
. This means that many ofTyFamDefltEqn
's code paths can now reuse the code paths forTyFamInstEqn
, resulting in substantial simplifications to various parts of the code dealing with associated type family defaults.
Fixes #16110 (closed) and #16356 (closed).