diff options
Diffstat (limited to 'src/HaddockUtil.hs')
-rw-r--r-- | src/HaddockUtil.hs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/HaddockUtil.hs b/src/HaddockUtil.hs index 3e7660bb..80800559 100644 --- a/src/HaddockUtil.hs +++ b/src/HaddockUtil.hs @@ -10,6 +10,7 @@ module HaddockUtil ( -- * Misc utilities nameOfQName, collectNames, declBinders, declMainBinder, declSubBinders, splitTyConApp, restrictTo, declDoc, parseModuleHeader, freeTyCons, unbang, + addFieldDoc, addFieldDocs, addConDoc, addConDocs, -- * Filename utilities basename, dirname, splitFilename3, @@ -33,6 +34,7 @@ import System import RegexString import Binary import IOExts +import Monad -- ----------------------------------------------------------------------------- -- Some Utilities @@ -95,6 +97,23 @@ freeTyCons ty = go ty [] go (HsTyVar v) r = r go (HsTyDoc t _) r = go t r +-- ----------------------------------------------------------------------------- +-- Adding documentation to record fields (used in parsing). + +addFieldDoc (HsFieldDecl ns ty doc1) doc2 = + HsFieldDecl ns ty (doc1 `mplus` doc2) + +addFieldDocs [] doc = [] +addFieldDocs (x:xs) doc = addFieldDoc x doc : xs + +addConDoc (HsConDecl pos nm tvs ctxt typeList doc1) doc2 = + HsConDecl pos nm tvs ctxt typeList (doc1 `mplus` doc2) +addConDoc (HsRecDecl pos nm tvs ctxt fields doc1) doc2= + HsRecDecl pos nm tvs ctxt fields (doc1 `mplus` doc2) + +addConDocs [] doc = [] +addConDocs (x:xs) doc = addConDoc x doc : xs + -- --------------------------------------------------------------------------- -- Making abstract declarations |