[commit: ghc] wip/impredicativity: Fix bug on generation of quantified vars in RULEs (212daac)

git at git.haskell.org git at git.haskell.org
Fri Jul 3 13:44:56 UTC 2015


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

On branch  : wip/impredicativity
Link       : http://ghc.haskell.org/trac/ghc/changeset/212daacea7ad2e4fb54ea5ac25f6a2fe406b5ba8/ghc

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

commit 212daacea7ad2e4fb54ea5ac25f6a2fe406b5ba8
Author: Alejandro Serrano <trupill at gmail.com>
Date:   Fri Jul 3 15:45:33 2015 +0200

    Fix bug on generation of quantified vars in RULEs


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

212daacea7ad2e4fb54ea5ac25f6a2fe406b5ba8
 compiler/typecheck/TcRules.hs | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/compiler/typecheck/TcRules.hs b/compiler/typecheck/TcRules.hs
index 4335717..37bcb3a 100644
--- a/compiler/typecheck/TcRules.hs
+++ b/compiler/typecheck/TcRules.hs
@@ -310,7 +310,12 @@ simplifyRule name lhs_wanted rhs_wanted
                 ; rhs_resid <- solveWanteds rhs_wanted
                 ; return (insolubleWC lhs_inst_resid || insolubleWC rhs_resid, lhs_inst) }
 
-       ; zonked_lhs <- zonkSimples (wc_simple lhs_wanted `unionBags` lhs_extra)
+       ; zonked_simple <- zonkSimples (wc_simple lhs_wanted)
+       ; zonked_extra <- zonkSimples lhs_extra
+         -- Remove those extra constraints which were already in the initial set
+       ; let same_type x y = ctPred x == ctPred y
+             none_with_same_type x = not (anyBag (same_type x) zonked_simple)
+             zonked_lhs = zonked_simple `unionBags` filterBag none_with_same_type zonked_extra
        ; let (q_cts, non_q_cts) = partitionBag quantify_me zonked_lhs
              quantify_me  -- Note [RULE quantification over equalities]
                | insoluble = quantify_insol



More information about the ghc-commits mailing list