X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Ftypes%2FFunDeps.lhs;fp=ghc%2Fcompiler%2Ftypes%2FFunDeps.lhs;h=f0a97c30611a0d21aecf20962caab55d491be79e;hb=6a6653c0dcff0eb8351b1c4fc36443b14ba20dd0;hp=af42ee98a674e65b6dec47fd27ca3d25ec63bc8e;hpb=6f4cf3e86a304e690aefb6ee2263c44f450f383b;p=ghc-hetmet.git diff --git a/ghc/compiler/types/FunDeps.lhs b/ghc/compiler/types/FunDeps.lhs index af42ee9..f0a97c3 100644 --- a/ghc/compiler/types/FunDeps.lhs +++ b/ghc/compiler/types/FunDeps.lhs @@ -245,7 +245,15 @@ checkGroup inst_env clss@((ClassP cls _, _) : _) -- -- We need to do something very similar comparing each predicate -- with relevant instance decls - pairwise_eqns ++ instance_eqns + + instance_eqns ++ pairwise_eqns + -- NB: we put the instance equations first. This biases the + -- order so that we first improve individual constraints against the + -- instances (which are perhaps in a library and less likely to be + -- wrong; and THEN perform the pairwise checks. + -- The other way round, it's possible for the pairwise check to succeed + -- and cause a subsequent, misleading failure of one of the pair with an + -- instance declaration. See tcfail143.hs for an exmample where (cls_tvs, cls_fds) = classTvsFds cls