From af7f8c0379dc19ee831e25b64c9e94e733f331be Mon Sep 17 00:00:00 2001 From: simonmar Date: Mon, 9 Aug 2004 11:55:07 +0000 Subject: [haddock @ 2004-08-09 11:55:05 by simonmar] Add support for a short description for each module, which is included in the contents. The short description should be given in a "Description: " field of the header. Included in this patch are changes that make the format of the header a little more flexible. From the comments: -- all fields in the header are optional and have the form -- -- [spaces1][field name][spaces] ":" -- [text]"\n" ([spaces2][space][text]"\n" | [spaces]"\n")* -- where each [spaces2] should have [spaces1] as a prefix. -- -- Thus for the key "Description", -- -- > Description : this is a -- > rather long -- > -- > description -- > -- > The module comment starts here -- -- the value will be "this is a .. description" and the rest will begin -- at "The module comment". The header fields must be in the following order: Module, Description, Copyright, License, Maintainer, Stability, Portability. Patches submitted by: George Russell , with a few small changes be me, mostly to merge with other recent changes. ToDo: document the module header. --- src/HsSyn.lhs | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'src/HsSyn.lhs') diff --git a/src/HsSyn.lhs b/src/HsSyn.lhs index 664c9601..82f89da9 100644 --- a/src/HsSyn.lhs +++ b/src/HsSyn.lhs @@ -1,5 +1,5 @@ % ----------------------------------------------------------------------------- -% $Id: HsSyn.lhs,v 1.21 2004/08/02 20:31:13 panne Exp $ +% $Id: HsSyn.lhs,v 1.22 2004/08/09 11:55:07 simonmar Exp $ % % (c) The GHC Team, 1997-2002 % @@ -30,6 +30,8 @@ module HsSyn ( unit_tycon_qname, fun_tycon_qname, list_tycon_qname, tuple_tycon_qname, unit_tycon, fun_tycon, list_tycon, tuple_tycon, + emptyModuleInfo, + hsIdentifierStr, hsAnchorNameStr, hsNameStr, GenDoc(..), Doc, DocMarkup(..), @@ -81,16 +83,26 @@ instance Show HsIdentifier where data HsModule = HsModule Module (Maybe [HsExportSpec]) [HsImportDecl] [HsDecl] (Maybe String) -- the doc options - (Maybe ModuleInfo) -- the info (portability etc.) - (Maybe Doc) -- the module doc + ModuleInfo -- the info (portability etc.) + (Maybe Doc) -- the module doc. deriving Show data ModuleInfo = ModuleInfo - { portability :: String, - stability :: String, - maintainer :: String } + { description :: Maybe Doc, + portability :: Maybe String, + stability :: Maybe String, + maintainer :: Maybe String + } deriving Show +emptyModuleInfo :: ModuleInfo +emptyModuleInfo = ModuleInfo { + description = Nothing, + portability = Nothing, + stability = Nothing, + maintainer = Nothing + } + -- Export/Import Specifications data HsExportSpec -- cgit v1.2.3