From: panne Date: Wed, 16 Feb 2000 12:57:39 +0000 (+0000) Subject: [project @ 2000-02-16 12:57:39 by panne] X-Git-Tag: Approximately_9120_patches~5127 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=e8481f60d4fab668f061eabe74244e44fe2e4ea9;p=ghc-hetmet.git [project @ 2000-02-16 12:57:39 by panne] Fixed pretty printing of DEPRECATED --- diff --git a/ghc/compiler/hsSyn/HsBinds.lhs b/ghc/compiler/hsSyn/HsBinds.lhs index 049baac..2e048ec 100644 --- a/ghc/compiler/hsSyn/HsBinds.lhs +++ b/ghc/compiler/hsSyn/HsBinds.lhs @@ -329,7 +329,7 @@ ppr_sig (SpecInstSig ty _) ppr_sig (FixSig fix_sig) = ppr fix_sig ppr_sig (DeprecSig n txt) - = hsep [text "{-# DEPRECATED", ppr n, ppr txt, text "#-}"] + = hsep [text "{-# DEPRECATED", ppr n, doubleQuotes(ppr txt), text "#-}"] ppr_phase Nothing = empty ppr_phase (Just n) = int n diff --git a/ghc/compiler/hsSyn/HsSyn.lhs b/ghc/compiler/hsSyn/HsSyn.lhs index 3c73d8d..3435071 100644 --- a/ghc/compiler/hsSyn/HsSyn.lhs +++ b/ghc/compiler/hsSyn/HsSyn.lhs @@ -73,13 +73,10 @@ instance (Outputable name, Outputable pat) ppr (HsModule name iface_version exports imports decls deprec src_loc) = vcat [ - case deprec of - Nothing -> empty - Just dt -> hsep [ptext SLIT("{-# DEPRECATED"), ppr dt, ptext SLIT("#-}")], 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")) ], @@ -87,6 +84,16 @@ instance (Outputable name, Outputable pat) pp_nonnull decls ] where + pp_header rest = case deprec of + Nothing -> pp_modname <+> rest + Just dt -> vcat [ + pp_modname, + hsep [ptext SLIT("{-# DEPRECATED"), doubleQuotes (ppr dt), ptext SLIT("#-}")], + rest + ] + + pp_modname = ptext SLIT("module") <+> pprModuleName name + pp_nonnull [] = empty pp_nonnull xs = vcat (map ppr xs)