+
+ieNames :: IE a -> [a]
+ieNames (IEVar n ) = [n]
+ieNames (IEThingAbs n ) = [n]
+ieNames (IEThingAll n ) = [n]
+ieNames (IEThingWith n ns) = n:ns
+ieNames (IEModuleContents _ ) = []
+\end{code}
+
+\begin{code}
+instance (Outputable name) => Outputable (IE name) where
+ ppr (IEVar var) = ppr_var var
+ ppr (IEThingAbs thing) = ppr thing
+ ppr (IEThingAll thing) = hcat [ppr thing, text "(..)"]
+ ppr (IEThingWith thing withs)
+ = ppr thing <> parens (fsep (punctuate comma (map ppr_var withs)))
+ ppr (IEModuleContents mod)
+ = ptext SLIT("module") <+> ppr mod
+
+ppr_var v | isOperator v = parens (ppr v)
+ | otherwise = ppr v