module InstEnv (
DFunId, InstEnv,
- emptyInstEnv, extendInstEnv, pprInstEnv,
+ emptyInstEnv, extendInstEnv,
lookupInstEnv,
classInstEnv, simpleDFunClassTyCon, checkFunDeps
) where
ins_tv_set = mkVarSet ins_tvs
ins_item = (ins_tv_set, ins_tys, dfun_id)
+#ifdef UNUSED
pprInstEnv :: InstEnv -> SDoc
pprInstEnv env
= vcat [ brackets (pprWithCommas ppr (varSetElems tyvars)) <+>
| cls_inst_env <- eltsUFM env
, (tyvars, tys, dfun) <- cls_inst_env
]
-
+#endif
simpleDFunClassTyCon :: DFunId -> (Class, TyCon)
simpleDFunClassTyCon dfun
\begin{code}
lookupInstEnv :: DynFlags
- -> (InstEnv, -- Home-package inst-env
- InstEnv) -- External package inst-env
+ -> (InstEnv -- External package inst-env
+ ,InstEnv) -- Home-package inst-env
-> Class -> [Type] -- What we are looking for
-> ([(TyVarSubstEnv, InstEnvElt)], -- Successful matches
[Id]) -- These don't match but do unify
-- but Foo [Int] is a unifier. This gives the caller a better chance of
-- giving a suitable error messagen
-lookupInstEnv dflags (home_ie, pkg_ie) cls tys
+lookupInstEnv dflags (pkg_ie, home_ie) cls tys
| not (null all_unifs) = (all_matches, all_unifs) -- This is always an error situation,
-- so don't attempt to pune the matches
| otherwise = (pruned_matches, [])
-> Maybe [DFunId] -- Nothing <=> ok
-- Just dfs <=> conflict with dfs
-- Check wheher adding DFunId would break functional-dependency constraints
-checkFunDeps (home_ie, pkg_ie) dfun
+checkFunDeps (pkg_ie, home_ie) dfun
| null bad_fundeps = Nothing
| otherwise = Just bad_fundeps
where