X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;ds=sidebyside;f=ghc%2Fcompiler%2Fiface%2FTcIface.lhs;h=39eadfb681b61453db59be4dc4970b66f2d2b797;hb=9d458d01d2a75b1e452ba00c4e76f3c3d0bc5ba6;hp=071948bde4e8fb61f7696dceea9627d856b2176f;hpb=c7c96efc57e5a08e704f13dd05c1baf2c568eb40;p=ghc-hetmet.git diff --git a/ghc/compiler/iface/TcIface.lhs b/ghc/compiler/iface/TcIface.lhs index 071948b..39eadfb 100644 --- a/ghc/compiler/iface/TcIface.lhs +++ b/ghc/compiler/iface/TcIface.lhs @@ -29,7 +29,7 @@ import HscTypes ( ExternalPackageState(..), PackageInstEnv, PackageRuleBase, HscEnv, TyThing(..), implicitTyThings, typeEnvIds, ModIface(..), ModDetails(..), InstPool, ModGuts, TypeEnv, mkTypeEnv, extendTypeEnvList, lookupTypeEnv, - DeclPool, RulePool, Pool(..), Gated, addRuleToPool ) + RulePool, Pool(..) ) import InstEnv ( extendInstEnv ) import CoreSyn import PprCore ( pprIdRules ) @@ -529,8 +529,9 @@ selectInsts pool@(Pool insts n_in n_out) cls tycons -- Reverses the gated decls, but that doesn't matter choose2 (gis, decls) (gates, decl) - | any (`elem` tycons) gates = (gis, decl:decls) - | otherwise = ((gates,decl) : gis, decls) + | null gates -- Happens when we have 'instance T a where ...' + || any (`elem` tycons) gates = (gis, decl:decls) + | otherwise = ((gates,decl) : gis, decls) \end{code} %************************************************************************ @@ -586,7 +587,7 @@ selectRules (Pool rules n_in n_out) type_env | null gates' = (pool, rule:if_rules) | otherwise = ((gates',rule) : pool, if_rules) where - gates' = filter (`elemNameEnv` type_env) gates + gates' = filter (not . (`elemNameEnv` type_env)) gates tcIfaceRule :: IfaceRule -> IfL IdCoreRule