-
Simon Peyton Jones authored
This one was a bit of a surprise. In fixing Trac #7854, I moved the checkAmbiguity tests to checkValidType. That meant it happened even for monotypes, and that turned out to be very expensive in T9872a, for reasons described in this (new) Note in TcUnify: Note [Check for equality before deferring] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Particularly in ambiguity checks we can get equalities like (ty ~ ty). If ty involves a type function we may defer, which isn't very sensible. An egregious example of this was in test T9872a, which has a type signature Proxy :: Proxy (Solutions Cubes) Doing the ambiguity check on this signature generates the equality Solutions Cubes ~ Solutions Cubes and currently the constraint solver normalises both sides at vast cost. This little short-cut in 'defer' helps quite a bit. I fixed the problem with a quick equality test, but it feels like an ad-hoc solution; I think we might want to do something in the constraint solver too. (The problem was there all along, just more hidden.)
3aa2519e