From 03b468c46b2a12a51400a6d5f5aa37524b5b998b Mon Sep 17 00:00:00 2001 From: Tom Schrijvers Date: Wed, 5 Sep 2007 13:44:26 +0000 Subject: [PATCH] also swap for variables in completion algorithm --- compiler/typecheck/TcTyFuns.lhs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/compiler/typecheck/TcTyFuns.lhs b/compiler/typecheck/TcTyFuns.lhs index 0130aa6..c91ac63 100644 --- a/compiler/typecheck/TcTyFuns.lhs +++ b/compiler/typecheck/TcTyFuns.lhs @@ -526,7 +526,12 @@ swapInst i@(EqInst {}) -- we should swap! go ty1 ty2@(TyConApp tyCon _) | isOpenSynTyCon tyCon - = do { wg_co <- eitherEqInst i + = actual_swap ty1 ty2 + go ty1@(TyConApp _ _) ty2@(TyVarTy _) + = actual_swap ty1 ty2 + go _ _ = return (i,False) + + actual_swap ty1 ty2 = do { wg_co <- eitherEqInst i -- old_co := sym new_co (\old_covar -> do { new_cotv <- newMetaTyVar TauTv (mkCoKind ty2 ty1) @@ -539,7 +544,6 @@ swapInst i@(EqInst {}) ; new_inst <- mkEqInst (EqPred ty2 ty1) wg_co ; return (new_inst,True) } - go _ _ = return (i,False) -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ decompInsts :: [Inst] -> TcM ([Inst],Bool) -- 1.7.10.4