diff options
Diffstat (limited to 'src/HaddockTypes.hs')
-rw-r--r-- | src/HaddockTypes.hs | 53 |
1 files changed, 22 insertions, 31 deletions
diff --git a/src/HaddockTypes.hs b/src/HaddockTypes.hs index d8295b39..52cea181 100644 --- a/src/HaddockTypes.hs +++ b/src/HaddockTypes.hs @@ -7,12 +7,12 @@ -- module HaddockTypes ( - ExportItem2(..), - ModuleMap2, + ExportItem(..), + ModuleMap, DocMap, HaddockModule(..), DocOption(..), - InstHead2, + InstHead, DocName(..), DocMarkup(..) ) where @@ -30,34 +30,35 @@ data DocOption -- exported by this module. deriving (Eq, Show) -data ExportItem2 name - = ExportDecl2 +data ExportItem name + = ExportDecl Name -- ^ The original name (LHsDecl name) -- ^ A declaration (Maybe (HsDoc name)) -- ^ Maybe a doc comment - [InstHead2 name] -- ^ Instances relevant to this declaration + [InstHead name] -- ^ Instances relevant to this declaration - | ExportNoDecl2 -- ^ An exported entity for which we have no + | ExportNoDecl -- ^ An exported entity for which we have no -- documentation (perhaps because it resides in -- another package) Name -- ^ The original name name -- ^ Where to link to [name] -- ^ Subordinate names - | ExportGroup2 -- ^ A section heading + | ExportGroup -- ^ A section heading Int -- ^ section level (1, 2, 3, ... ) String -- ^ Section "id" (for hyperlinks) (HsDoc name) -- ^ Section heading text - | ExportDoc2 -- ^ Some documentation + | ExportDoc -- ^ Some documentation (HsDoc name) - | ExportModule2 -- ^ A cross-reference to another module + | ExportModule -- ^ A cross-reference to another module Module -type InstHead2 name = ([HsPred name], name, [HsType name]) -type ModuleMap2 = Map Module HaddockModule -type DocMap = Map Name (HsDoc DocName) +type InstHead name = ([HsPred name], name, [HsType name]) +type ModuleMap = Map Module HaddockModule +type DocMap = Map Name (HsDoc DocName) + data DocName = Link Name | NoLink Name instance Outputable DocName where @@ -67,42 +68,34 @@ instance Outputable DocName where data HaddockModule = HM { -- | A value to identify the module - hmod_mod :: Module, -- | The original filename for this module - hmod_orig_filename :: FilePath, -- | Textual information about the module - hmod_info :: HaddockModInfo Name, -- | The documentation header for this module - hmod_doc :: Maybe (HsDoc Name), -- | The renamed documentation header for this module - hmod_rn_doc :: Maybe (HsDoc DocName), -- | The Haddock options for this module (prune, ignore-exports, etc) - hmod_options :: [DocOption], hmod_exported_decl_map :: Map Name (LHsDecl Name), hmod_doc_map :: Map Name (HsDoc Name), hmod_rn_doc_map :: Map Name (HsDoc DocName), - hmod_export_items :: [ExportItem2 Name], - hmod_rn_export_items :: [ExportItem2 DocName], + hmod_export_items :: [ExportItem Name], + hmod_rn_export_items :: [ExportItem DocName], -- | All the names that are defined in this module - hmod_locals :: [Name], -- | All the names that are exported by this module - hmod_exports :: [Name], -- | All the visible names exported by this module @@ -112,13 +105,11 @@ data HaddockModule = HM { -- that it can't be from another package. -- Basically, a visible name is a name that will show up in the documentation -- for this module. - hmod_visible_exports :: [Name], hmod_sub_map :: Map Name [Name], -- | The instances exported by this module - hmod_instances :: [Instance] } @@ -139,12 +130,12 @@ data DocMarkup id a = Markup { markupAName :: String -> a } -instance (Outputable a, OutputableBndr a) => Outputable (ExportItem2 a) where - ppr (ExportDecl2 n decl doc instns) = text "ExportDecl" <+> ppr n <+> ppr decl <+> ppr doc <+> ppr instns - ppr (ExportNoDecl2 n1 n2 ns) = text "ExportNoDecl (org name, link name, sub names)" <+> ppr n1 <+> ppr n2 <+> ppr ns - ppr (ExportGroup2 lev id doc) = text "ExportGroup (lev, id, doc)" <+> ppr lev <+> ppr doc - ppr (ExportDoc2 doc) = text "ExportDoc" <+> ppr doc - ppr (ExportModule2 mod) = text "ExportModule" <+> ppr mod +instance (Outputable a, OutputableBndr a) => Outputable (ExportItem a) where + ppr (ExportDecl n decl doc instns) = text "ExportDecl" <+> ppr n <+> ppr decl <+> ppr doc <+> ppr instns + ppr (ExportNoDecl n1 n2 ns) = text "ExportNoDecl (org name, link name, sub names)" <+> ppr n1 <+> ppr n2 <+> ppr ns + ppr (ExportGroup lev id doc) = text "ExportGroup (lev, id, doc)" <+> ppr lev <+> ppr doc + ppr (ExportDoc doc) = text "ExportDoc" <+> ppr doc + ppr (ExportModule mod) = text "ExportModule" <+> ppr mod instance OutputableBndr DocName where pprBndr _ d = ppr d |