Implement a fast path for new constraints looking like (a~b), namely unifyWanted
authorSimon Peyton Jones <simonpj@microsoft.com>
Wed, 10 Dec 2014 14:11:51 +0000 (14:11 +0000)
committerSimon Peyton Jones <simonpj@microsoft.com>
Wed, 10 Dec 2014 16:01:17 +0000 (16:01 +0000)
commit832f8db2ee13120d5914149bd86f81df7e377b75
tree262802fab9ce95f3374acd4be30d7041ba64932d
parentbcb967abaaa51df281b70d905df915b6b4bb31cc
Implement a fast path for new constraints looking like (a~b), namely unifyWanted

Looking at some typechecker traces I could see places where we were laboriously
creating a Refl coercion.  This patch short-circuits the process.

See TcCanonical:
  Note [unifyWanted and unifyDerived]
  Note [Decomposing TyConApps]

I ended up with some refactoring, notably

  * I moved xCtEvidence, rewriteEvidence, rewriteEqEvidence
    from TcSMonad to TcCanonical

There are some knock-on effects, but only minor ones.
compiler/typecheck/TcCanonical.hs
compiler/typecheck/TcInteract.hs
compiler/typecheck/TcSMonad.hs