-
Simon Peyton Jones authored
This patch deals with the following remark Suppose we have type family T a :: * -> * type instance T Int = [] and now we encounter the type (T Int Bool). If we call lookupFamInstEnv on (T Int Bool) we'll fail, because T has arity 1. Indeed, I *think* it's a precondition of lookupFamInstEnv that the supplied types exactly match the arity of the type function. But that precondition is neither stated, nor is there an assertion to check it. With this patch, lookupFamInstEnv can take "extra" type arguments in the over-saturated case, and does the Right Thing. There was a nearly-identical function lookupFamInstEnvUnify, which required the precisely analogous change, so I took the opportunity to combine the two into one function, so that bugs can be fixed in one place. This was a bit harder than I expected, but I think the result is ok. The conflict-decision function moves from FamInst to FamInstEnv. Net lines code decreases, although there are more comments.
027e6be2