Fix Trac #7939, and add kind inference to closed type families.
Now, all open type families have result kinds that default to *. Top-level type families have all arguments default to *, and associated type families have all arguments that are not mentioned in the class header default to *. Closed type families perform kind inference, but generalize only over those kind variables that are parametric in their use. This is all a little fiddly and specific, but it seems to follow use cases. This commit also includes a large Note [Kind-checking strategies] in TcHsType that helps keep all of this straight.
Showing with 345 additions and 112 deletions