Skip to content
  • Simon Peyton Jones's avatar
    Further improvements to well-kinded types · 0a12d92a
    Simon Peyton Jones authored
    The typechecker has the invariant that every type should be well-kinded
    as it stands, without zonking.  See Note [The well-kinded type invariant]
    in TcType.
    
    That invariant was not being upheld, which led to Trac #14174.  I fixed
    part of it, but T14174a showed that there was more.  This patch finishes
    the job.
    
    * See Note [The tcType invariant] in TcHsType, which articulates an
      invariant that was very nearly, but not quite, true.  One place that
      falisified it was the HsWildCardTy case of tc_hs_type, so I fixed that.
    
    * mkNakedCastTy now makes no attempt to eliminate casts; indeed it cannot
      lest it break Note [The well-kinded type invariant].  The prior comment
      suggested that it was crucial for performance but happily it seems not
      to be. The extra Refls are eliminated by the zonker.
    
    * I found I could tidy up TcHsType.instantiateTyN and instantiateTyUntilN
      by eliminating one of its parameters.  That led to a cascade of minor
      improvements in TcTyClsDecls. Hooray.
    0a12d92a