[project @ 2000-03-01 15:20:54 by panne]
[ghc-hetmet.git] / ghc / compiler / hsSyn / HsSyn.lhs
index fb63e87..42731cc 100644 (file)
@@ -22,7 +22,7 @@ module HsSyn (
        module HsMatches,
        module HsPat,
        module HsTypes,
-       Fixity, NewOrData, IfaceFlavour,
+       Fixity, NewOrData, 
 
        collectTopBinders, collectMonoBinders
      ) where
@@ -39,20 +39,20 @@ import HsMatches
 import HsPat
 import HsTypes
 import HsCore
-import BasicTypes      ( Fixity, Version, NewOrData, IfaceFlavour )
+import BasicTypes      ( Fixity, Version, NewOrData )
 
 -- others:
 import Outputable
 import SrcLoc          ( SrcLoc )
 import Bag
-import Name            ( Module, NamedThing, pprModule )
+import Module          ( ModuleName, pprModuleName )
 \end{code}
 
 All we actually declare here is the top-level structure for a module.
 \begin{code}
 data HsModule name pat
   = HsModule
-       Module                  -- module name
+       ModuleName              -- module name
        (Maybe Version)         -- source interface version number
        (Maybe [IE name])       -- export list; Nothing => export everything
                                -- Just [] => export *nothing* (???)
@@ -62,27 +62,34 @@ data HsModule name pat
                                -- 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}
 
 \begin{code}
-instance (NamedThing name, Outputable name, Outputable pat)
+instance (Outputable name, Outputable pat)
        => 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"), pprModule name, ptext SLIT("where")]
+             Nothing -> pp_header (ptext SLIT("where"))
              Just es -> vcat [
-                           hsep [ptext SLIT("module"), pprModule name, lparen],
-                           nest 8 (interpp'SP es),
+                           pp_header lparen,
+                           nest 8 (fsep (punctuate comma (map ppr es))),
                            nest 4 (ptext SLIT(") where"))
                          ],
            pp_nonnull imports,
            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)