• simonpj@microsoft.com's avatar
    Substantial improvements to coercion optimisation · b06d623b
    simonpj@microsoft.com authored
    The main purpose of this patch is to add a bunch of new rules
    to the coercion optimiser.  They are documented in the (revised)
    Appendix of the System FC paper.  
    Some code has moved about:
    - OptCoercion is now a separate module, mainly because it
      now uses tcMatchTy, which is defined in Unify, so OptCoercion
      must live higehr up in the hierarchy
    - Functions that manipulate Kinds has moved from 
      Type.lhs to Coercion.lhs.  Reason: the function typeKind
      now needs to call coercionKind.  And in any case, a Kind is
      a flavour of Type, so it builds on top of Type; indeed Coercions
      and Kinds are both flavours of Type.
      This change required fiddling with a number of imports, hence
      the one-line changes to otherwise-unrelated modules
    - The representation of CoTyCons in TyCon has changed.   Instead of
      an extensional representation (a kind checker) there is now an
      intensional representation (namely TyCon.CoTyConDesc).  This was
      needed for one of the new coercion optimisations.
Coercion.lhs 30.6 KB