[commit: ghc] type-nats: Add some extra impossible cases (x + 5 ~ x) (0d898ce)

Iavor Diatchki <[email protected]>
Newsgroups gmane.comp.lang.haskell.cvs.ghc
Message-ID <[email protected]>
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : type-nats

http://hackage.haskell.org/trac/ghc/changeset/0d898cef94e7693a876a013ff4bb50dac4a0f943

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

commit 0d898cef94e7693a876a013ff4bb50dac4a0f943
Author: Iavor S. Diatchki <[email protected]>
Date:   Sun Sep 16 15:22:36 2012 -0700

    Add some extra impossible cases (x + 5 ~ x)

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

 compiler/typecheck/TcTypeNats.hs |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/compiler/typecheck/TcTypeNats.hs b/compiler/typecheck/TcTypeNats.hs
index d4531c2..9bfcfea 100644
--- a/compiler/typecheck/TcTypeNats.hs
+++ b/compiler/typecheck/TcTypeNats.hs
@@ -174,6 +174,8 @@ impossible (CFunEqCan { cc_fun = tc, cc_tyargs = [t1,t2], cc_rhs = t3 })
       case (mbA,mbB,mbC) of
         (Just a, _     , Just c) -> isNothing (minus c a)
         (_     , Just b, Just c) -> isNothing (minus c b)
+        (Just a, _     , _) | a > 0 -> eqType t2 t3
+        (_     , Just b, _) | b > 0 -> eqType t1 t3
         _                        -> False
 
   | name == typeNatMulTyFamName =
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.