Substantial improvements to coercion optimisation
authorsimonpj@microsoft.com <unknown>
Mon, 4 Jan 2010 08:21:55 +0000 (08:21 +0000)
committersimonpj@microsoft.com <unknown>
Mon, 4 Jan 2010 08:21:55 +0000 (08:21 +0000)
commitb06d623b2e367a572de5daf06d6a0b12c2740471
tree6b7928ccf7e14bef94358e5bc58c38f4e0a030e7
parent3029576129e31d23e749be21c6a5a6f376ba28cd
Substantial improvements to coercion optimisation

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.
17 files changed:
compiler/coreSyn/CoreLint.lhs
compiler/coreSyn/CoreSubst.lhs
compiler/ghc.cabal.in
compiler/hsSyn/Convert.lhs
compiler/hsSyn/HsTypes.lhs
compiler/main/GHC.hs
compiler/main/InteractiveEval.hs
compiler/parser/Parser.y.pp
compiler/parser/ParserCore.y
compiler/prelude/TysPrim.lhs
compiler/simplCore/Simplify.lhs
compiler/types/Coercion.lhs
compiler/types/OptCoercion.lhs [new file with mode: 0644]
compiler/types/TyCon.lhs
compiler/types/Type.lhs
compiler/types/Unify.lhs
compiler/utils/Util.lhs