Get rid of TcTyVars more assiduously
authorSimon Peyton Jones <simonpj@microsoft.com>
Wed, 2 Nov 2016 11:42:37 +0000 (11:42 +0000)
committerSimon Peyton Jones <simonpj@microsoft.com>
Wed, 2 Nov 2016 11:54:55 +0000 (11:54 +0000)
commit996894922c3c23f0ed68f0e344d0e5b573f95212
tree839f8c328695a12198d69793bf508630472e71dd
parent79fb6e663908041eebc5a88987f67dd875326d94
Get rid of TcTyVars more assiduously

* I found a bug in 'generalize' in TcTyClsDecls.kcTyClGroup, where
  the kind variables weren't being turned into proper TyVars, so
  we got (skolem) TcTyVars in TyCons, which shouldn't happen.  Fix
  was easy.

* Similarly TcHsType.kindGeneralizeType wasn't turning the forall'd
  TcTyVars into TyVars.  To achieve this I defined TcHsTyn.zonkSigType.

* All this allowed me to remove awkward and ill-explained bit of
  footwork on DFunIds in Inst.newClsInst

This is just refactoring, but it does make the printout from
-ddump-deriv make a bit more sense by not grautuitiously cloning
type variables.  In the display I was seeing

   instance C [a_df4] where
      f x = ...a_dx5...

where actually the d_df4 and a_dx5 were the same.
compiler/typecheck/Inst.hs
compiler/typecheck/TcHsSyn.hs
compiler/typecheck/TcHsType.hs
compiler/typecheck/TcTyClsDecls.hs