aboutsummaryrefslogtreecommitdiff
path: root/src/HaddockHtml.hs
diff options
context:
space:
mode:
authorsimonmar <unknown>2002-04-26 11:18:57 +0000
committersimonmar <unknown>2002-04-26 11:18:57 +0000
commit31c53d79c85274012725480b8d78d341f3affe06 (patch)
tree6c005e5816372d8a6455713debe6b3f0290ecf8c /src/HaddockHtml.hs
parentbbd5fbab2ffebe759f20765a4dbd519b2d1381d8 (diff)
[haddock @ 2002-04-26 11:18:56 by simonmar]
- support for fundeps (partially contributed by Brett Letner - thanks Brett). - make it build with GHC 4.08.2
Diffstat (limited to 'src/HaddockHtml.hs')
-rw-r--r--src/HaddockHtml.hs22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/HaddockHtml.hs b/src/HaddockHtml.hs
index 994b17e1..327d931e 100644
--- a/src/HaddockHtml.hs
+++ b/src/HaddockHtml.hs
@@ -445,7 +445,7 @@ doDecl doc_map summary decl = do_decl decl
do_decl decl@(HsDataDecl loc ctx nm args cons drv)
= ppHsDataDecl doc_map summary False{-not newtype-} decl
- do_decl decl@(HsClassDecl _ _ _)
+ do_decl decl@(HsClassDecl _ _ _ _)
= ppHsClassDecl doc_map summary decl
do_decl (HsDocGroup lev str)
@@ -580,9 +580,15 @@ ppHsBangType (HsUnBangedTy ty) = ppHsAType ty
-- -----------------------------------------------------------------------------
-- Class declarations
-ppClassHdr ty = keyword "class" <+> ppHsType ty
+ppClassHdr ty fds =
+ keyword "class" <+> ppHsType ty <+>
+ if null fds then noHtml else
+ char '|' <+> hsep (punctuate comma (map fundep fds))
+ where
+ fundep (vars1,vars2) = hsep (map ppHsName vars1) <+> toHtml "->" <+>
+ hsep (map ppHsName vars2)
-ppShortClassDecl doc_map summary decl@(HsClassDecl loc ty decls) =
+ppShortClassDecl doc_map summary decl@(HsClassDecl loc ty fds decls) =
if null decls
then declBox hdr
else td << (
@@ -596,10 +602,10 @@ ppShortClassDecl doc_map summary decl@(HsClassDecl loc ty decls) =
))
where
Just c = declMainBinder decl
- hdr | not summary = linkTarget c +++ ppClassHdr ty
- | otherwise = ppClassHdr ty
+ hdr | not summary = linkTarget c +++ ppClassHdr ty fds
+ | otherwise = ppClassHdr ty fds
-ppHsClassDecl doc_map summary decl@(HsClassDecl loc ty decls)
+ppHsClassDecl doc_map summary decl@(HsClassDecl loc ty fds decls)
| summary || (isNothing doc && all decl_has_no_doc kept_decls)
= ppShortClassDecl doc_map summary decl
@@ -611,8 +617,8 @@ ppHsClassDecl doc_map summary decl@(HsClassDecl loc ty decls)
Just c = declMainBinder decl
header
- | null decls = declBox (linkTarget c +++ ppClassHdr ty)
- | otherwise = declBox (linkTarget c +++ ppClassHdr ty <+>
+ | null decls = declBox (linkTarget c +++ ppClassHdr ty fds)
+ | otherwise = declBox (linkTarget c +++ ppClassHdr ty fds <+>
keyword "where")
classdoc