[Git][ghc/ghc][wip/pmcheck-eqs] Make TmOracle reduce nullary constructor equalities

Sebastian Graf gitlab at gitlab.haskell.org
Mon May 20 15:20:10 UTC 2019



Sebastian Graf pushed to branch wip/pmcheck-eqs at Glasgow Haskell Compiler / GHC


Commits:
d20ed249 by Sebastian Graf at 2019-05-20T15:20:04Z
Make TmOracle reduce nullary constructor equalities

Previously, `simplifyEqExpr` would just give up on constructor
applications when no argument to either constructor was simplified.

That's unfortunate as all arguments might be equal anyway! A special
case of this is nullary constructors. Currently, the TmOracle would fail
to solve a term equality `False ~ (True = True)` because it can't make
any progress on any of `True`s arguments.

Instead we now try to properly simplify the term equality even when no
simplification of constructor arguments was achieved.

- - - - -


1 changed file:

- compiler/deSugar/TmOracle.hs


Changes:

=====================================
compiler/deSugar/TmOracle.hs
=====================================
@@ -210,7 +210,7 @@ simplifyEqExpr e1 e2 = case (e1, e2) of
             worst_case  = PmExprEq (PmExprCon c1 ts1') (PmExprCon c2 ts2')
         in  if | not (or bs1 || or bs2) -> (worst_case, False) -- no progress
                | all isTruePmExpr  tss  -> (truePmExpr, True)
-               | any isFalsePmExpr tss  -> (falsePmExpr, True)
+               | otherwise              -> (worst_case, or bs1 || or bs2)
                | otherwise              -> (worst_case, False)
     | otherwise -> (falsePmExpr, True)
 



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/commit/d20ed249006bdcb9c6d65069134980a1cce8a950

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/commit/d20ed249006bdcb9c6d65069134980a1cce8a950
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20190520/ff7c8f94/attachment.html>


More information about the ghc-commits mailing list