[commit: ghc] master: Tiny refactoring; no change in behaviour (6be91dd)

git at git.haskell.org git at git.haskell.org
Thu Feb 12 15:29:41 UTC 2015


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/6be91ddaffe8b4d3796cb78b261b318c9c380f4b/ghc

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

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

    Tiny refactoring; no change in behaviour


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

6be91ddaffe8b4d3796cb78b261b318c9c380f4b
 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 b4ec62a..b87e257 100644
--- a/compiler/typecheck/TcCanonical.hs
+++ b/compiler/typecheck/TcCanonical.hs
@@ -746,22 +746,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