From a90130c4e9199a3f3255a12c1ad24b013df687e0 Mon Sep 17 00:00:00 2001
From: simonmar <unknown>
Date: Mon, 13 May 2002 15:19:03 +0000
Subject: [haddock @ 2002-05-13 15:19:03 by simonmar] Cope with datatypes which
 have documentation on the constructor but not the type itself, and records
 which have documentation on the fields but not the constructor.  (Thanks to
 Ross Paterson for pointing out the bugs).

---
 src/HaddockHtml.hs | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/HaddockHtml.hs b/src/HaddockHtml.hs
index 5a16b669..2bd6b102 100644
--- a/src/HaddockHtml.hs
+++ b/src/HaddockHtml.hs
@@ -501,7 +501,10 @@ ppHsDataDecl doc_map summary is_newty decl@(HsDataDecl loc ctx nm args cons drv)
         = td << vanillaTable << (header </> datadoc </> constrs)
   where
 	header = declBox (ppHsDataHeader False is_newty nm args)
-	datadoc = docBox (markup htmlMarkup (fromJust doc))
+
+	datadoc 
+	  | isJust doc = docBox (markup htmlMarkup (fromJust doc))
+	  | otherwise  = Html.emptyTable
 
 	constr_hdr = tda [ theclass "section4" ] << toHtml "Constructors"
 
@@ -560,7 +563,11 @@ ppHsFullConstr doc_map (HsRecDecl pos nm tvs ctxt fields maybe_doc) =
    )
 
   where hdr = declBox (ppHsConstrHdr tvs ctxt +++ ppHsBinder False nm)
-	constr_doc = docBox (markup htmlMarkup (fromJust doc))
+
+	constr_doc	
+	  | isJust doc = docBox (markup htmlMarkup (fromJust doc))
+	  | otherwise  = Html.emptyTable
+
 	fields_html = 
 	   td << 
 	      table ! [width "100%", cellpadding 0, cellspacing 8] << (
-- 
cgit v1.2.3