HscEnv, TyThing(..), implicitTyThings, typeEnvIds,
ModIface(..), ModDetails(..), InstPool, ModGuts,
TypeEnv, mkTypeEnv, extendTypeEnvList, lookupTypeEnv,
HscEnv, TyThing(..), implicitTyThings, typeEnvIds,
ModIface(..), ModDetails(..), InstPool, ModGuts,
TypeEnv, mkTypeEnv, extendTypeEnvList, lookupTypeEnv,
-- Reverses the gated decls, but that doesn't matter
choose2 (gis, decls) (gates, decl)
-- 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)
| null gates' = (pool, rule:if_rules)
| otherwise = ((gates',rule) : pool, if_rules)
where
| null gates' = (pool, rule:if_rules)
| otherwise = ((gates',rule) : pool, if_rules)
where