[commit: ghc] tc-untouchables: Simplify the reOrient function (no change in behaviour) (7fdcf2c)

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

On branch  : tc-untouchables

http://hackage.haskell.org/trac/ghc/changeset/7fdcf2c755fde160d9fe5211cedc65d65fef68f1

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

commit 7fdcf2c755fde160d9fe5211cedc65d65fef68f1
Author: Simon Peyton Jones <[email protected]>
Date:   Mon Oct 1 10:38:22 2012 +0100

    Simplify the reOrient function (no change in behaviour)

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

 compiler/typecheck/TcCanonical.lhs |   14 +++++---------
 1 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/compiler/typecheck/TcCanonical.lhs b/compiler/typecheck/TcCanonical.lhs
index 826375b..18bfe2b 100644
--- a/compiler/typecheck/TcCanonical.lhs
+++ b/compiler/typecheck/TcCanonical.lhs
@@ -1071,19 +1071,15 @@ reOrient :: CtEvidence -> TypeClassifier -> TypeClassifier -> Bool
 -- We try to say False if possible, to minimise evidence generation
 --
 -- Postcondition: After re-orienting, first arg is not OTherCls
-reOrient _ev (OtherCls {}) (FunCls {})   = True
-reOrient _ev (OtherCls {}) (VarCls {})   = True
-reOrient _ev (OtherCls {}) (OtherCls {}) = panic "reOrient"  -- One must be Var/Fun
+reOrient _ev (OtherCls {}) cls2 = ASSERT( case cls2 of { OtherCls {} -> False; _ -> True } )
+                                  True  -- One must be Var/Fun
 
-reOrient _ev (FunCls {})   (VarCls _tv)  = False  
+reOrient _ev (FunCls {}) _      = False             -- Fun/Other on rhs
   -- But consider the following variation: isGiven ev && isMetaTyVar tv
-
   -- See Note [No touchables as FunEq RHS] in TcSMonad
-reOrient _ev (FunCls {}) _                = False             -- Fun/Other on rhs
-
-reOrient _ev (VarCls {}) (FunCls {})      = True 
-reOrient _ev (VarCls {})  (OtherCls {})   = False
 
+reOrient _ev (VarCls {})   (FunCls {})      = True 
+reOrient _ev (VarCls {})   (OtherCls {})   = False
 reOrient _ev (VarCls tv1)  (VarCls tv2)  
   | isMetaTyVar tv2 && not (isMetaTyVar tv1) = True 
   | otherwise                                = False
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.