diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2015-02-12 15:31:15 +0000 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2015-02-12 15:31:15 +0000 |
commit | 6be91ddaffe8b4d3796cb78b261b318c9c380f4b (patch) | |
tree | 0beae702d747d591ab38651680b38f0fee2c01f3 | |
parent | b45309fb660955558a10cbde058cf5db2e37ef2b (diff) | |
download | haskell-6be91ddaffe8b4d3796cb78b261b318c9c380f4b.tar.gz |
Tiny refactoring; no change in behaviour
-rw-r--r-- | compiler/typecheck/TcCanonical.hs | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/compiler/typecheck/TcCanonical.hs b/compiler/typecheck/TcCanonical.hs index b4ec62a99a..b87e257628 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] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |