aboutsummaryrefslogtreecommitdiff
path: root/haddock-api/src
diff options
context:
space:
mode:
authorƁukasz Hanuszczak <lukasz.hanuszczak@gmail.com>2015-07-29 12:25:54 +0200
committerMateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk>2015-08-21 18:22:32 +0100
commit73f4a18d0b29dd209a5f1172c8ed662be11d5690 (patch)
tree2286bafbe79b04d182bfcde2eab9b2d042e9e9cd /haddock-api/src
parent0c34ec0ae515d88437e04a49ca0131205be096e5 (diff)
Make instance details section contain associated types information.
Diffstat (limited to 'haddock-api/src')
-rw-r--r--haddock-api/src/Haddock/Backends/Xhtml/Decl.hs13
-rw-r--r--haddock-api/src/Haddock/Backends/Xhtml/Layout.hs11
2 files changed, 18 insertions, 6 deletions
diff --git a/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs b/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs
index abcf3eaf..6fb36e29 100644
--- a/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs
+++ b/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs
@@ -537,12 +537,14 @@ ppInstHead links splice unicode qual mdoc origin no (InstHead {..}) =
ClassInst { .. } ->
( subInstHead iid $ ppContextNoLocs clsiCtx unicode qual <+> typ
, mdoc
- , [subInstMethods iid sigs]
+ , [subInstDetails iid ats sigs]
)
where
iid = instanceId origin no ihdClsName
sigs = ppInstanceSigs links splice unicode qual
clsiTyVars ihdTypes clsiSigs
+ ats = ppInstanceAssocTys links splice unicode qual
+ clsiAssocTys
TypeInst rhs ->
(ptype, mdoc, [])
where
@@ -562,6 +564,15 @@ ppInstHead links splice unicode qual mdoc origin no (InstHead {..}) =
typ = ppAppNameTypes ihdClsName ihdKinds ihdTypes unicode qual
+ppInstanceAssocTys :: LinksInfo -> Splice -> Unicode -> Qualification
+ -> [FamilyDecl DocName]
+ -> [Html]
+ppInstanceAssocTys links splice unicode qual =
+ map ppTyFam'
+ where
+ ppTyFam' fam = ppTyFamHeader False True fam unicode qual
+
+
ppInstanceSigs :: LinksInfo -> Splice -> Unicode -> Qualification
-> LHsTyVarBndrs DocName -> [HsType DocName] -> [Sig DocName]
-> [Html]
diff --git a/haddock-api/src/Haddock/Backends/Xhtml/Layout.hs b/haddock-api/src/Haddock/Backends/Xhtml/Layout.hs
index 117f8fc8..074b6801 100644
--- a/haddock-api/src/Haddock/Backends/Xhtml/Layout.hs
+++ b/haddock-api/src/Haddock/Backends/Xhtml/Layout.hs
@@ -31,7 +31,7 @@ module Haddock.Backends.Xhtml.Layout (
subConstructors,
subEquations,
subFields,
- subInstances, subInstHead, subInstMethods,
+ subInstances, subInstHead, subInstDetails,
subMethods,
subMinimal,
@@ -210,13 +210,14 @@ subInstHead iid hdr =
expander = thediv ! collapseControl (instAnchorId iid) False "instance"
-subInstMethods :: String -- ^ Instance unique id (for anchor generation)
+subInstDetails :: String -- ^ Instance unique id (for anchor generation)
+ -> [Html] -- ^ Associated type contents
-> [Html] -- ^ Method contents (pretty-printed signatures)
-> Html
-subInstMethods iid mets =
- section << subMethods mets
+subInstDetails iid ats mets =
+ section << (subAssociatedTypes ats <+> subMethods mets)
where
- section = thediv ! collapseSection (instAnchorId iid) False "methods"
+ section = thediv ! collapseSection (instAnchorId iid) False "inst-details"
instAnchorId :: String -> String