Break up TyCoRep
The TyCoRep module is one of the largest modules in GHC and mixes a variety of concerns. This makes identifying the reasons for the many import cycles that it participates in quite challenge. While attempting an implementation of a new free type/coercion variables traversal I ran head-long into one such cycle.
This patch breaks up TyCoRep along the boundaries of its various concerns:
-
TyCoRep: Contains theCoercion,Type, and related type definitions and a few simple predicates but nothing further -
TyCoPpr: Contains the the pretty-printer logic -
TyCoFVs: Contains the free variable computations (andtyConAppNeedsKindSig, although I suspect this should change) -
TyCoSubst: Contains the substitution logic for types and coercions -
TyCoTidy: Contains the tidying logic for types
While we are able to eliminate a good number of SOURCE imports (and
make a few others smaller) with this change, we must introduce one new
hs-boot file for TyCoPpr so that TyCoRep can define Outputable
instances for the types it defines.
In addition, we move the well-scoped free variable logic to TyCoFVs to eliminate the need for some source imports.