X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2Ftypecheck%2FTcGadt.lhs;h=e45d6bd53a5c887999e5bdf1ec74220711e4e0ad;hp=286e5b6bee638b8ef18defff7ee2d9f8184d83a2;hb=30c122df62ec75f9ed7f392f24c2925675bf1d06;hpb=ad94d40948668032189ad22a0ad741ac1f645f50 diff --git a/compiler/typecheck/TcGadt.lhs b/compiler/typecheck/TcGadt.lhs index 286e5b6..e45d6bd 100644 --- a/compiler/typecheck/TcGadt.lhs +++ b/compiler/typecheck/TcGadt.lhs @@ -14,7 +14,7 @@ -- The above warning supression flag is a temporary kludge. -- While working on this module you are encouraged to remove it and fix -- any warnings in the module. See --- http://hackage.haskell.org/trac/ghc/wiki/CodingStyle#Warnings +-- http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#Warnings -- for details module TcGadt ( @@ -39,11 +39,9 @@ import Maybes import Control.Monad import Outputable import TcType - -#ifdef DEBUG import Unique import UniqFM -#endif +import FastString \end{code} @@ -240,11 +238,15 @@ fixTvCoEnv in_scope env -- then use transitivity with the original coercion ----------------------------- +-- XXX Can we do this more nicely, by exploiting laziness? +-- Or avoid needing it in the first place? fixTvSubstEnv :: InScopeSet -> TvSubstEnv -> TvSubstEnv -fixTvSubstEnv in_scope env - = fixpt +fixTvSubstEnv in_scope env = f env where - fixpt = mapVarEnv (substTy (mkTvSubst in_scope fixpt)) env + f e = let e' = mapUFM (substTy (mkTvSubst in_scope e)) e + in if and $ eltsUFM $ intersectUFM_C tcEqType e e' + then e + else f e' ---------------------------- tryToBind :: TyVarSet -> TyVar -> BindFlag @@ -261,7 +263,6 @@ tryToBind tv_set tv | tv `elemVarSet` tv_set = BindMe %************************************************************************ \begin{code} -#ifdef DEBUG badReftElts :: InternalReft -> [(Unique, (Coercion,Type))] -- Return the BAD elements of the refinement -- Should be empty; used in asserions only @@ -274,7 +275,6 @@ badReftElts env | otherwise = False where (ty1,ty2) = coercionKind co -#endif emptyInternalReft :: InternalReft emptyInternalReft = emptyVarEnv