aboutsummaryrefslogtreecommitdiff
path: root/src/Haddock/Backends/Xhtml
diff options
context:
space:
mode:
authorMark Lentczner <markl@glyphic.com>2010-06-11 23:27:46 +0000
committerMark Lentczner <markl@glyphic.com>2010-06-11 23:27:46 +0000
commit2fb3ec9518d221e2f8cb822efa1ab26d12f5bcd8 (patch)
tree8e7fc6e19a1e7c258db0dd60d1761c4b1df8392a /src/Haddock/Backends/Xhtml
parent24a137306dfc62f32b292cefaabb91da52a6bf3e (diff)
factored out ppInstances
Diffstat (limited to 'src/Haddock/Backends/Xhtml')
-rw-r--r--src/Haddock/Backends/Xhtml/Decl.hs46
1 files changed, 16 insertions, 30 deletions
diff --git a/src/Haddock/Backends/Xhtml/Decl.hs b/src/Haddock/Backends/Xhtml/Decl.hs
index 6f66ece8..3a401cce 100644
--- a/src/Haddock/Backends/Xhtml/Decl.hs
+++ b/src/Haddock/Backends/Xhtml/Decl.hs
@@ -175,17 +175,7 @@ ppTyFam summary associated links loc mbDoc decl unicode
header_ = topDeclElem links loc docname (ppTyFamHeader summary associated decl unicode)
- instId = collapseId (getName docname)
-
- instancesBit
- | associated || null instances = noHtml
- | otherwise =
- instHdr instId +++
- collapsed thediv instId (
- spacedTable1 << (
- aboves (map (ppDocInstance unicode) instances)
- )
- )
+ instancesBit = ppInstances instances docname unicode
-- TODO: get the instances
instances = []
@@ -402,18 +392,23 @@ ppClassDecl summary links instances loc mbDoc subdocs
, let doc = lookupAnySubdoc n subdocs ]
)
- instId = collapseId (getName nm)
- instancesBit
- | null instances = noHtml
- | otherwise =
- instHdr instId +++
- collapsed thediv instId (
- spacedTable1 << aboves (map (ppDocInstance unicode) instances)
- )
-
+ instancesBit = ppInstances instances nm unicode
+
ppClassDecl _ _ _ _ _ _ _ _ = error "declaration type not supported by ppShortClassDecl"
+
+ppInstances :: [DocInstance DocName] -> DocName -> Bool -> Html
+ppInstances instances baseName unicode
+ | null instances = noHtml
+ | otherwise =
+ instHdr instId +++
+ collapsed thediv instId (
+ spacedTable1 << aboves (map (ppDocInstance unicode) instances)
+ )
+ where
+ instId = collapseId (getName baseName)
+
-- | Print a possibly commented instance. The instance header is printed inside
-- an 'argBox'. The comment is printed to the right of the box in normal comment
-- style.
@@ -495,16 +490,7 @@ ppDataDecl summary links instances subdocs loc mbDoc dataDecl unicode
aboves (map (ppSideBySideConstr subdocs unicode) cons)
)
- instId = collapseId (getName docname)
-
- instancesBit
- | null instances = noHtml
- | otherwise
- = instHdr instId +++
- collapsed thediv instId (
- spacedTable1 << aboves (map (ppDocInstance unicode) instances
- )
- )
+ instancesBit = ppInstances instances docname unicode
isRecCon :: Located (ConDecl a) -> Bool