[commit: haddock] 2.17.3.1-spanfix, alexbiehl-patch-1, ghc-8.0, ghc-8.0-facebook, ghc-head, ghc-head1, haddock-quick, headdock-library-1.4.5, ie_avails, issue-303, master, pr-filter-maps, pr/cabal-desc, travis, v2.17, v2.17.3, v2.18, wip-located-module-as, wip/D2418, wip/T12105, wip/T12105-2, wip/T12942, wip/T13163, wip/T14529, wip/T3384, wip/embelleshed-rdr, wip/new-tree-one-param, wip/rae, wip/remove-frames, wip/remove-frames1, wip/revert-ttg-2017-11-20, wip/ttg-2017-10-13, wip/ttg-2017-10-31, wip/ttg-2017-11-06, wip/ttg2-2017-11-10, wip/ttg3-2017-11-12, wip/ttg4-constraints-2017-11-13, wip/ttg6-unrevert-2017-11-22: Collapse type/data family instances by default (035f2f1)

git at git.haskell.org git at git.haskell.org
Tue Nov 28 11:45:13 UTC 2017


Repository : ssh://git@git.haskell.org/haddock

On branches: 2.17.3.1-spanfix,alexbiehl-patch-1,ghc-8.0,ghc-8.0-facebook,ghc-head,ghc-head1,haddock-quick,headdock-library-1.4.5,ie_avails,issue-303,master,pr-filter-maps,pr/cabal-desc,travis,v2.17,v2.17.3,v2.18,wip-located-module-as,wip/D2418,wip/T12105,wip/T12105-2,wip/T12942,wip/T13163,wip/T14529,wip/T3384,wip/embelleshed-rdr,wip/new-tree-one-param,wip/rae,wip/remove-frames,wip/remove-frames1,wip/revert-ttg-2017-11-20,wip/ttg-2017-10-13,wip/ttg-2017-10-31,wip/ttg-2017-11-06,wip/ttg2-2017-11-10,wip/ttg3-2017-11-12,wip/ttg4-constraints-2017-11-13,wip/ttg6-unrevert-2017-11-22
Link       : http://git.haskell.org/haddock.git/commitdiff/035f2f18448d6f81a16d80e8b2ae8025616f8d41

>---------------------------------------------------------------

commit 035f2f18448d6f81a16d80e8b2ae8025616f8d41
Author: RyanGlScott <ryan.gl.scott at gmail.com>
Date:   Thu Feb 11 15:42:42 2016 -0500

    Collapse type/data family instances by default
    
    (cherry picked from commit 2da130a8db8f995c119b544fad807533236cf088)


>---------------------------------------------------------------

035f2f18448d6f81a16d80e8b2ae8025616f8d41
 haddock-api/src/Haddock/Backends/Xhtml/Decl.hs   | 15 ++++++++++-----
 haddock-api/src/Haddock/Backends/Xhtml/Layout.hs | 18 +++++++++++++-----
 2 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs b/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs
index b354658..660a847 100644
--- a/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs
+++ b/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs
@@ -607,20 +607,25 @@ ppInstHead links splice unicode qual mdoc origin orphan no ihd@(InstHead {..}) =
             , [subInstDetails iid ats sigs]
             )
           where
-            iid = instanceId origin no orphan ihd
             sigs = ppInstanceSigs links splice unicode qual clsiSigs
             ats = ppInstanceAssocTys links splice unicode qual clsiAssocTys
         TypeInst rhs ->
-            (ptype, mdoc, [])
+            ( subInstHead iid ptype
+            , mdoc
+            , [subFamInstDetails iid prhs]
+            )
           where
-            ptype = keyword "type" <+> typ <+> prhs
+            ptype = keyword "type" <+> typ
             prhs = maybe noHtml (\t -> equals <+> ppType unicode qual t) rhs
         DataInst dd ->
-            (pdata, mdoc, [])
+            ( subInstHead iid pdata
+            , mdoc
+            , [subFamInstDetails iid pdecl])
           where
-            pdata = keyword "data" <+> typ <+> pdecl
+            pdata = keyword "data" <+> typ
             pdecl = ppShortDataDecl False True dd unicode qual
   where
+    iid = instanceId origin no orphan ihd
     typ = ppAppNameTypes ihdClsName ihdKinds ihdTypes unicode qual
 
 
diff --git a/haddock-api/src/Haddock/Backends/Xhtml/Layout.hs b/haddock-api/src/Haddock/Backends/Xhtml/Layout.hs
index 26aeaff..19de935 100644
--- a/haddock-api/src/Haddock/Backends/Xhtml/Layout.hs
+++ b/haddock-api/src/Haddock/Backends/Xhtml/Layout.hs
@@ -31,7 +31,8 @@ module Haddock.Backends.Xhtml.Layout (
   subConstructors,
   subEquations,
   subFields,
-  subInstances, subOrphanInstances, subInstHead, subInstDetails,
+  subInstances, subOrphanInstances,
+  subInstHead, subInstDetails, subFamInstDetails,
   subMethods,
   subMinimal,
 
@@ -179,7 +180,6 @@ subAssociatedTypes = divSubDecls "associated-types" "Associated Types" . subBloc
 subConstructors :: Qualification -> [SubDecl] -> Html
 subConstructors qual = divSubDecls "constructors" "Constructors" . subTable qual
 
-
 subFields :: Qualification -> [SubDecl] -> Html
 subFields qual = divSubDecls "fields" "Fields" . subDlist qual
 
@@ -226,10 +226,18 @@ subInstDetails :: String -- ^ Instance unique id (for anchor generation)
                -> [Html] -- ^ Method contents (pretty-printed signatures)
                -> Html
 subInstDetails iid ats mets =
-    section << (subAssociatedTypes ats <+> subMethods mets)
-  where
-    section = thediv ! collapseSection (instAnchorId iid) False "inst-details"
+    subInstSection iid << (subAssociatedTypes ats <+> subMethods mets)
+
+subFamInstDetails :: String -- ^ Instance unique id (for anchor generation)
+                  -> Html   -- ^ Type or data family instance
+                  -> Html
+subFamInstDetails iid fi =
+    subInstSection iid << declElem fi
 
+subInstSection :: String -- ^ Instance unique id (for anchor generation)
+               -> Html
+               -> Html
+subInstSection iid = thediv ! collapseSection (instAnchorId iid) False "inst-details"
 
 instAnchorId :: String -> String
 instAnchorId iid = makeAnchorId $ "i:" ++ iid



More information about the ghc-commits mailing list