-
Simon Peyton Jones authored
We now have the invariant for a ClsInst that the is_tvs field is always completely fresh type variables. See Note [Template tyvars are fresh] in InstEnv. (Previously we frehened them when extending the instance environment, but that seems messier because it was an invariant only when the ClsInst was in an InstEnv. Moreover, there was an invariant that thet tyvars of the DFunid in the ClsInst had to match, and I have removed that invariant altogether; there is no need for it.) Other changes I made at the same time: * Make is_tvs into a *list*, in the right order for the dfun type arguments. This removes the wierd need for the dfun to have the same tyvars as the ClsInst template, an invariant I have always hated. The cost is that we need to make it a VarSet when matching. We could cache an is_tv_set instead. * Add a cached is_cls field to the ClsInst, to save fishing the Class out of the DFun. (Renamed is_cls to is_cls_nm.) * Make tcSplitDFunTy return the dfun args, not just the *number* of dfun args * Make InstEnv.instanceHead return just the *head* of the instance declaration. Add instanceSig to return the whole thing.
5efe9b11