-- 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}
%************************************************************************
| 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