X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Ftypecheck%2FInst.lhs;h=19c484f592aff8f9252d642c1138c48addc4030d;hb=1f861358a07a4bf2586964a65aebb4433f16ac70;hp=dc96759f6682f65c0cdc7ee44b07ccffe4340bd6;hpb=4418c8e913e93e927a91e58abd1bbc6893aa8d27;p=ghc-hetmet.git diff --git a/ghc/compiler/typecheck/Inst.lhs b/ghc/compiler/typecheck/Inst.lhs index dc96759..19c484f 100644 --- a/ghc/compiler/typecheck/Inst.lhs +++ b/ghc/compiler/typecheck/Inst.lhs @@ -56,7 +56,7 @@ import TcType ( Type, TcType, TcThetaType, TcTyVarSet, isIntTy,isFloatTy, isIntegerTy, isDoubleTy, tcIsTyVarTy, mkPredTy, mkTyVarTy, mkTyVarTys, tyVarsOfType, tyVarsOfTypes, tyVarsOfPred, tidyPred, - isClassPred, isTyVarClassPred, isLinearPred, predHasFDs, + isClassPred, isTyVarClassPred, isLinearPred, getClassPredTys, getClassPredTys_maybe, mkPredName, isInheritablePred, isIPPred, tidyType, tidyTypes, tidyFreeTyVars, tcSplitSigmaTy @@ -101,11 +101,14 @@ dictPred inst = pprPanic "dictPred" (ppr inst) getDictClassTys (Dict _ pred _) = getClassPredTys pred -- fdPredsOfInst is used to get predicates that contain functional --- dependencies; i.e. should participate in improvement -fdPredsOfInst (Dict _ pred _) | predHasFDs pred = [pred] - | otherwise = [] -fdPredsOfInst (Method _ _ _ theta _ _) = filter predHasFDs theta -fdPredsOfInst other = [] +-- dependencies *or* might do so. The "might do" part is because +-- a constraint (C a b) might have a superclass with FDs +-- Leaving these in is really important for the call to fdPredsOfInsts +-- in TcSimplify.inferLoop, because the result is fed to 'grow', +-- which is supposed to be conservative +fdPredsOfInst (Dict _ pred _) = [pred] +fdPredsOfInst (Method _ _ _ theta _ _) = theta +fdPredsOfInst other = [] -- LitInsts etc fdPredsOfInsts :: [Inst] -> [PredType] fdPredsOfInsts insts = concatMap fdPredsOfInst insts