A radical overhaul of the coercion infrastucture
* Core Lint now does full checking of kinds and coercion terms which picks up kind errors in coercions that were previously simply not checked for * Coercion.lhs now provides optCoercion which optimises coercion terms. It implements all of Dimitrios's rules * The constructors for coercion terms now make no attempt to be "smart"; instead we rely solely on the coercion optimiser * CoercionTyCons in TyCon.lhs always had a "custom" kinding rule (the coKindFun field of CoercionTyCon) but its type was not clever enough to do both (a) *figure out the result kind*, assuming the whole thing is well-kinded in the first place (b) *check* the kinds of everything, failing gracefully if they aren't right. We need (b) for the new CoreLint stuff. The field now has type CoTyConKindChecker which does the job nicely.
Showing with 698 additions and 519 deletions