[commit: ghc] ghc-7.10: Tiny refactoring; no change in behaviour (f424118)

git at git.haskell.org git at git.haskell.org
Mon May 11 10:07:23 UTC 2015


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

On branch  : ghc-7.10
Link       : http://ghc.haskell.org/trac/ghc/changeset/f424118036618b6ca0de822cc987833b316e5f47/ghc

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

commit f424118036618b6ca0de822cc987833b316e5f47
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Thu Feb 12 15:31:15 2015 +0000

    Tiny refactoring; no change in behaviour
    
    (cherry picked from commit 6be91ddaffe8b4d3796cb78b261b318c9c380f4b)


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

f424118036618b6ca0de822cc987833b316e5f47
 compiler/typecheck/TcCanonical.hs | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/compiler/typecheck/TcCanonical.hs b/compiler/typecheck/TcCanonical.hs
index 8df7ee1..1511885 100644
--- a/compiler/typecheck/TcCanonical.hs
+++ b/compiler/typecheck/TcCanonical.hs
@@ -709,22 +709,23 @@ canDecomposableTyConApp :: CtEvidence -> EqRel
                         -> TcS (StopOrContinue Ct)
 -- See Note [Decomposing TyConApps]
 canDecomposableTyConApp ev eq_rel tc1 tys1 tc2 tys2
-  | tc1 /= tc2 || length tys1 /= length tys2
-    -- Fail straight away for better error messages
-  = let eq_failure
-          | isDataFamilyTyCon tc1 || isDataFamilyTyCon tc2
-                -- See Note [Use canEqFailure in canDecomposableTyConApp]
-          = canEqFailure
-          | otherwise
-          = canEqHardFailure in
-    eq_failure ev eq_rel (mkTyConApp tc1 tys1) (mkTyConApp tc2 tys2)
-
-  | otherwise
+  | tc1 == tc2
+  , length tys1 == length tys2  -- Success: decompose!
   = do { traceTcS "canDecomposableTyConApp"
                   (ppr ev $$ ppr eq_rel $$ ppr tc1 $$ ppr tys1 $$ ppr tys2)
        ; canDecomposableTyConAppOK ev eq_rel tc1 tys1 tys2
        ; stopWith ev "Decomposed TyConApp" }
 
+  -- Fail straight away for better error messages
+  -- See Note [Use canEqFailure in canDecomposableTyConApp]
+  | isDataFamilyTyCon tc1 || isDataFamilyTyCon tc2
+  = canEqFailure ev eq_rel ty1 ty2
+  | otherwise
+  = canEqHardFailure ev eq_rel ty1 ty2
+  where
+    ty1 = mkTyConApp tc1 tys1
+    ty2 = mkTyConApp tc2 tys2
+
 {-
 Note [Use canEqFailure in canDecomposableTyConApp]
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



More information about the ghc-commits mailing list