[commit: ghc] master: Re-factor TcCanonical (again), fixes Trac #8603 (8721743)

git at git.haskell.org git at git.haskell.org
Mon Dec 30 12:11:17 UTC 2013


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/8721743e88f4c8c385eb0ceb0ca6804b2143a8fa/ghc

>---------------------------------------------------------------

commit 8721743e88f4c8c385eb0ceb0ca6804b2143a8fa
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Sat Dec 28 12:28:52 2013 +0000

    Re-factor TcCanonical (again), fixes Trac #8603
    
    This is a substantial refactoring of the canonicaliser. The proximate
    cause was that we were sometimes failing to correctly orient a
    tyvar/tyvar equality (x ~ y), because the kind of x or y was not fully
    zonked at the moment we compared them.  That in turn led me to look
    closely at the way that canEvNC (which decomposes equalities) worked.
    
    * The big change is that the 'reOrient' and 'classify' functions are gone,
      along with classify's 'TypeClassifier' return type.  Instead the
      re-orientation is built into canEqNC.  When we find a type variable
      we divert into canEqTyVar, and so on, very much as in TcUnify.
    
    * TcCanonical.canEqTyVar, canEqLeafFun, etc now carry a SwapFlag (to
      reduce duplication), just as in TcUnify; now SwapFlag itself is
      defined in BasicTypes
    
    * I renamed TcSMonad.rewriteCtFlavor to rewriteEvidence,
    
    * I added a new specialised version of rewriteEvidence, called
      TcSMonad.rewriteEqEvidence.  It is easier to use, and removes
      the crafty but brain-mangling higher order casts that we were
      using before.
    
    The result is not exactly simpler, but it's pretty clear and, I think,
    significantly more efficient.  And it fixes Trac #8603!


>---------------------------------------------------------------

8721743e88f4c8c385eb0ceb0ca6804b2143a8fa
 compiler/basicTypes/BasicTypes.lhs |    6 +-
 compiler/typecheck/TcCanonical.lhs |  665 +++++++++++++++++++-----------------
 compiler/typecheck/TcSMonad.lhs    |   95 +++++-
 3 files changed, 445 insertions(+), 321 deletions(-)

Diff suppressed because of size. To see it, use:

    git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 8721743e88f4c8c385eb0ceb0ca6804b2143a8fa


More information about the ghc-commits mailing list