Quantify class variables first in associated families' kinds

Authored by RyanGlScott on Oct 1 2018, 11:05 AM.

Description

Quantify class variables first in associated families' kinds

Summary:
Previously, kcLHsQTyVars would always quantify class-bound
variables invisibly in the kinds of associated types, resulting in
Trac #15591. We counteract this by explicitly passing the class-bound
variables to kcLHsQTyVars and quantifying over the ones that are
mentioned in the associated type such that (1) they are specified,
and (2) they come before other kind variables.
See Note [Kind variable ordering for associated types].

Test Plan: make test TEST=T15591

Reviewers: goldfire, simonpj, bgamari

Reviewed By: simonpj

Subscribers: rwbarton, carter

GHC Trac Issues: Trac #15591

Differential Revision: https://phabricator.haskell.org/D5159