From: lewie Date: Sun, 14 May 2000 07:16:50 +0000 (+0000) Subject: [project @ 2000-05-14 07:16:50 by lewie] X-Git-Tag: Approximately_9120_patches~4475 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=2558ec224e78bc95bcdde8f65c9ee25cdcb509d9;p=ghc-hetmet.git [project @ 2000-05-14 07:16:50 by lewie] Wobble. Fine tuning tcSimplifyAndCheck a bit further (wrt implicit params). The key is that a method that doesn't constrain a local tyvar, but does has implicit params, needs to be reduced further. --- diff --git a/ghc/compiler/typecheck/Inst.lhs b/ghc/compiler/typecheck/Inst.lhs index 55a1a4f4..f00e8a1 100644 --- a/ghc/compiler/typecheck/Inst.lhs +++ b/ghc/compiler/typecheck/Inst.lhs @@ -25,7 +25,8 @@ module Inst ( lookupInst, lookupSimpleInst, LookupInstResult(..), - isDict, isClassDict, isTyVarDict, isStdClassTyVarDict, isMethodFor, notFunDep, + isDict, isClassDict, isMethod, + isTyVarDict, isStdClassTyVarDict, isMethodFor, notFunDep, instBindingRequired, instCanBeGeneralised, zonkInst, zonkInsts, zonkFunDeps, zonkTvFunDeps, @@ -302,10 +303,14 @@ Predicates \begin{code} isDict :: Inst -> Bool isDict (Dict _ _ _) = True -isDict other = False +isDict other = False isClassDict :: Inst -> Bool isClassDict (Dict _ (Class _ _) _) = True -isClassDict other = False +isClassDict other = False + +isMethod :: Inst -> Bool +isMethod (Method _ _ _ _ _ _) = True +isMethod other = False isMethodFor :: TcIdSet -> Inst -> Bool isMethodFor ids (Method uniq id tys _ _ loc) @@ -574,10 +579,10 @@ pprInst (Dict u pred loc) = pprPred pred <+> show_uniq u pprInst m@(Method u id tys theta tau loc) = hsep [ppr id, ptext SLIT("at"), - brackets (interppSP tys), + brackets (interppSP tys) {- , ppr theta, ppr tau, show_uniq u, - ppr (instToId m)] + ppr (instToId m) -}] pprInst (FunDep clas fds loc) = hsep [ppr clas, ppr fds] diff --git a/ghc/compiler/typecheck/TcSimplify.lhs b/ghc/compiler/typecheck/TcSimplify.lhs index 08b2211..9eb4db8 100644 --- a/ghc/compiler/typecheck/TcSimplify.lhs +++ b/ghc/compiler/typecheck/TcSimplify.lhs @@ -132,7 +132,7 @@ import TcHsSyn ( TcExpr, TcId, import TcMonad import Inst ( lookupInst, lookupSimpleInst, LookupInstResult(..), tyVarsOfInst, tyVarsOfInsts, - isDict, isClassDict, isStdClassTyVarDict, + isDict, isClassDict, isMethod, isStdClassTyVarDict, isMethodFor, notFunDep, instToId, instBindingRequired, instCanBeGeneralised, newDictFromOld, @@ -299,6 +299,7 @@ tcSimplifyAndCheck str local_tvs given_lie wanted_lie try_me inst -- Does not constrain a local tyvar | isEmptyVarSet (tyVarsOfInst inst `intersectVarSet` local_tvs) + && (not (isMethod inst) || null (getIPs inst)) = Free -- When checking against a given signature we always reduce