-- info to TyDecls/etc; so this list is
-- often empty, downstream.
[HsDecl name pat] -- Type, class, value, and interface signature decls
+ (Maybe DeprecTxt) -- reason/explanation for deprecation of this module
SrcLoc
\end{code}
=> Outputable (HsModule name pat) where
ppr (HsModule name iface_version exports imports
- decls src_loc)
+ decls deprec src_loc)
= vcat [
case exports of
- Nothing -> hsep [ptext SLIT("module"), pprModuleName name, ptext SLIT("where")]
+ Nothing -> pp_header (ptext SLIT("where"))
Just es -> vcat [
- hsep [ptext SLIT("module"), pprModuleName name, lparen],
+ pp_header lparen,
nest 8 (fsep (punctuate comma (map ppr es))),
nest 4 (ptext SLIT(") where"))
],
pp_nonnull decls
]
where
+ pp_header rest = case deprec of
+ Nothing -> pp_modname <+> rest
+ Just d -> vcat [ pp_modname, ppr d, rest ]
+
+ pp_modname = ptext SLIT("module") <+> pprModuleName name
+
pp_nonnull [] = empty
pp_nonnull xs = vcat (map ppr xs)