X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Ftypecheck%2FTcTyFuns.lhs;h=5777955ed73cd5536c52baec3d4aa004a38b31b2;hb=e5a8d57c85d42007c8cc561e6d6b805c23603fc0;hp=77d72058c5cfb78142516231ff77a019f468bd13;hpb=cfda0421ca2c7c5f762814fd25988cf89871f1d8;p=ghc-hetmet.git diff --git a/compiler/typecheck/TcTyFuns.lhs b/compiler/typecheck/TcTyFuns.lhs index 77d7205..5777955 100644 --- a/compiler/typecheck/TcTyFuns.lhs +++ b/compiler/typecheck/TcTyFuns.lhs @@ -37,6 +37,7 @@ import Name import Bag import Outputable import SrcLoc ( Located(..) ) +import Util ( debugIsOn ) import Maybes import FastString @@ -69,21 +70,16 @@ tcUnfoldSynFamInst (TyConApp tycon tys) | not (isOpenSynTyCon tycon) -- unfold *only* _synonym_ family instances = return Nothing | otherwise - = do { -- we only use the indexing arguments for matching, - -- not the additional ones - ; maybeFamInst <- tcLookupFamInst tycon idxTys + = do { -- The TyCon might be over-saturated, but that's ok for tcLookupFamInst + ; maybeFamInst <- tcLookupFamInst tycon tys ; case maybeFamInst of Nothing -> return Nothing - Just (rep_tc, rep_tys) -> return $ Just (mkTyConApp rep_tc tys', - mkTyConApp coe_tc tys') + Just (rep_tc, rep_tys) -> return $ Just (mkTyConApp rep_tc rep_tys, + mkTyConApp coe_tc rep_tys) where - tys' = rep_tys ++ restTys coe_tc = expectJust "TcTyFuns.tcUnfoldSynFamInst" (tyConFamilyCoercion_maybe rep_tc) } - where - n = tyConArity tycon - (idxTys, restTys) = splitAt n tys tcUnfoldSynFamInst _other = return Nothing \end{code} @@ -231,9 +227,6 @@ tcReduceEqs locals wanteds We maintain normalised equalities together with the skolems introduced as intermediates during flattening of equalities as well as -!!!TODO: We probably now can do without the skolem set. It's not used during -finalisation in the current code. - \begin{code} -- |Configuration of normalised equalities used during solving. -- @@ -286,7 +279,15 @@ no further propoagation is possible. -- normaliseEqs :: [Inst] -> TcM EqConfig normaliseEqs eqs - = do { ASSERTM2( allM wantedEqInstIsUnsolved eqs, ppr eqs ) + = do { if debugIsOn then do { all_unsolved <- allM wantedEqInstIsUnsolved eqs + ; let msg = ptext (sLit "(This warning is harmless; for Simon & Manuel)") + ; WARN( not all_unsolved, msg $$ ppr eqs ) return () } + else return () + -- This is just a warning (not an error) because a current + -- harmless bug means that we sometimes solve the same + -- equality more than once It'll go away with the new + -- solver. See Trac #2999 for example + ; traceTc $ ptext (sLit "Entering normaliseEqs") ; (eqss, skolemss) <- mapAndUnzipM normEqInst eqs @@ -384,9 +385,6 @@ families. Moreover, in Forms (2) & (3), the left-hand side may not occur in the right-hand side, and the relation x > y is an arbitrary, but total order on type variables -!!!TODO: We may need to keep track of swapping for error messages (and to -re-orient on finilisation). - \begin{code} data RewriteInst = RewriteVar -- Form (2) above @@ -960,9 +958,6 @@ applySubstFam eq1@(RewriteFam {rwi_fam = fam1, rwi_args = args1}) -- rule matches => rewrite | fam1 == fam2 && tcEqTypes args1 args2 && (isWantedRewriteInst eq2 || not (isWantedRewriteInst eq1)) --- !!!TODO: tcEqTypes is insufficient as it does not look through type synonyms --- !!!Check whether anything breaks by making tcEqTypes look through synonyms. --- !!!Should be ok and we don't want three type equalities. = do { co2' <- mkRightTransEqInstCo co2 co1 (lhs, rhs) ; eq2' <- deriveEqInst eq2 lhs rhs co2' ; liftM Just $ normEqInst eq2' @@ -1240,7 +1235,7 @@ instantiateAndExtract eqs localsEmpty skolems | Just tv2 <- tcGetTyVar_maybe ty2 , isMetaTyVar tv2 , mayInst tv2 && (checkingMode || tv2 `elemVarSet` skolems) - -- !!!TODO: this is too liberal, even if tv2 is in + -- !!!FIXME: this is too liberal, even if tv2 is in -- skolems we shouldn't instantiate if tvs occurs -- in other equalities that may propagate it into the -- environment