summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2012-10-01 11:26:04 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2012-10-01 11:26:04 +0100
commit316d3edcdd6ebb3126956e35d9360bebdf5efda8 (patch)
treee3e786fe55c9b9c5ab83973f319bf5c93cd03838 /compiler
parent935fa10a2d9ec0bd4b0f69b3a73b62d382b19caa (diff)
downloadhaskell-316d3edcdd6ebb3126956e35d9360bebdf5efda8.tar.gz
Tracing in TcUnify
Diffstat (limited to 'compiler')
-rw-r--r--compiler/typecheck/TcUnify.lhs14
1 files changed, 12 insertions, 2 deletions
diff --git a/compiler/typecheck/TcUnify.lhs b/compiler/typecheck/TcUnify.lhs
index 65e787103f..88dbd7f19a 100644
--- a/compiler/typecheck/TcUnify.lhs
+++ b/compiler/typecheck/TcUnify.lhs
@@ -767,7 +767,9 @@ uUnfilledVar origin swapped tv1 details1 non_var_ty2 -- ty2 is not a type varia
MetaTv { mtv_info = TauTv, mtv_ref = ref1 }
-> do { mb_ty2' <- checkTauTvUpdate tv1 non_var_ty2
; case mb_ty2' of
- Nothing -> do { traceTc "Occ/kind defer" (ppr tv1); defer }
+ Nothing -> do { traceTc "Occ/kind defer" (ppr tv1 <+> dcolon <+> ppr (tyVarKind tv1)
+ $$ ppr non_var_ty2 $$ ppr (typeKind non_var_ty2))
+ ; defer }
Just ty2' -> updateMeta tv1 ref1 ty2'
}
@@ -854,9 +856,17 @@ checkTauTvUpdate :: TcTyVar -> TcType -> TcM (Maybe TcType)
-- we return Nothing, leaving it to the later constraint simplifier to
-- sort matters out.
+-- Used in debug meesages only
+_ppr_sub :: Maybe Ordering -> SDoc
+_ppr_sub (Just LT) = text "LT"
+_ppr_sub (Just EQ) = text "EQ"
+_ppr_sub (Just GT) = text "GT"
+_ppr_sub Nothing = text "Nothing"
+
checkTauTvUpdate tv ty
= do { ty' <- zonkTcType ty
; sub_k <- unifyKindX (tyVarKind tv) (typeKind ty')
+-- ; traceTc "checktttv" (ppr tv $$ ppr ty' $$ ppr (tyVarKind tv) $$ ppr (typeKind ty') $$ _ppr_sub sub_k)
; case sub_k of
Nothing -> return Nothing
Just LT -> return Nothing
@@ -920,7 +930,7 @@ function @occ_check_ok@.
Note [Type family sharing]
-~~~~~~~~~~~~~~
+~~~~~~~~~~~~~~~~~~~~~~~~~~
We must avoid eagerly unifying type variables to types that contain function symbols,
because this may lead to loss of sharing, and in turn, in very poor performance of the
constraint simplifier. Assume that we have a wanted constraint: