[commit: haddock] ghc-head, ghc-head1, headdock-library-1.4.5, ie_avails, master, pr/cabal-desc, v2.18, 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: Make per-argument docs for class methods work again (#648) (af3e6c7)

git at git.haskell.org git at git.haskell.org
Mon Nov 20 21:08:47 UTC 2017


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

On branches: ghc-head,ghc-head1,headdock-library-1.4.5,ie_avails,master,pr/cabal-desc,v2.18,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
Link       : http://git.haskell.org/haddock.git/commitdiff/af3e6c7c027389df18b15ee9a9d72ffc97dc1852

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

commit af3e6c7c027389df18b15ee9a9d72ffc97dc1852
Author: Alex Biehl <alexbiehl at gmail.com>
Date:   Thu Jun 29 19:54:49 2017 +0200

    Make per-argument docs for class methods work again (#648)
    
    * Make per-argument docs for class methods work again
    
    * Test case


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

af3e6c7c027389df18b15ee9a9d72ffc97dc1852
 CHANGES.md                                   |  6 ++--
 haddock-api/src/Haddock/Interface/Create.hs  |  5 ++--
 html-test/ref/{Ticket61.html => Bug647.html} | 42 ++++++++++++++++++++++------
 html-test/src/Bug647.hs                      |  6 ++++
 4 files changed, 47 insertions(+), 12 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index 628b096..1cbaf62 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -1,9 +1,11 @@
 ## Changes in version 2.18.0
 
- * Support user defined signatures on pattern synonyms
-
  * Synopsis is working again (#599)
 
+ * Per-argument documentation on class methods working again (#647)
+
+ * Support user defined signatures on pattern synonyms
+
  * Support for bundled pattern synonyms (#494, #551, #626)
 
 ## Changes in version 2.17.4
diff --git a/haddock-api/src/Haddock/Interface/Create.hs b/haddock-api/src/Haddock/Interface/Create.hs
index 50643e2..9227c37 100644
--- a/haddock-api/src/Haddock/Interface/Create.hs
+++ b/haddock-api/src/Haddock/Interface/Create.hs
@@ -429,8 +429,9 @@ typeDocs :: HsDecl Name -> Map Int HsDocString
 typeDocs d =
   let docs = go 0 in
   case d of
-    SigD (TypeSig _ ty)   -> docs (unLoc (hsSigWcType ty))
-    SigD (PatSynSig _ ty) -> docs (unLoc (hsSigType ty))
+    SigD (TypeSig _ ty)      -> docs (unLoc (hsSigWcType ty))
+    SigD (ClassOpSig _ _ ty) -> docs (unLoc (hsSigType ty))
+    SigD (PatSynSig _ ty)    -> docs (unLoc (hsSigType ty))
     ForD (ForeignImport _ ty _ _)   -> docs (unLoc (hsSigType ty))
     TyClD (SynDecl { tcdRhs = ty }) -> docs (unLoc ty)
     _ -> M.empty
diff --git a/html-test/ref/Ticket61.html b/html-test/ref/Bug647.html
similarity index 73%
copy from html-test/ref/Ticket61.html
copy to html-test/ref/Bug647.html
index cfc2e7f..086840a 100644
--- a/html-test/ref/Ticket61.html
+++ b/html-test/ref/Bug647.html
@@ -2,7 +2,7 @@
 ><head
   ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"
      /><title
-    >Ticket61</title
+    >Bug647</title
     ><link href="#" rel="stylesheet" type="text/css" title="Ocean"
      /><script src="haddock-util.js" type="text/javascript"
     ></script
@@ -40,7 +40,7 @@ window.onload = function () {pageLoad();};
 	    ></tr
 	  ></table
 	><p class="caption"
-	>Ticket61</p
+	>Bug647</p
 	></div
       ><div id="interface"
       ><h1
@@ -49,8 +49,8 @@ window.onload = function () {pageLoad();};
 	><p class="src"
 	  ><span class="keyword"
 	    >class</span
-	    > <a id="t:C" class="def"
-	    >C</a
+	    > <a id="t:Bug647" class="def"
+	    >Bug647</a
 	    > a <span class="keyword"
 	    >where</span
 	    > <a href="#" class="selflink"
@@ -70,12 +70,38 @@ window.onload = function () {pageLoad();};
 	    ><p class="src"
 	    ><a id="v:f" class="def"
 	      >f</a
-	      > :: a <a href="#" class="selflink"
+	      > <a href="#" class="selflink"
 	      >#</a
 	      ></p
-	    ><div class="doc"
-	    ><p
-	      >A comment about f</p
+	    ><div class="subs arguments"
+	    ><p class="caption"
+	      >Arguments</p
+	      ><table
+	      ><tr
+		><td class="src"
+		  >:: a</td
+		  ><td class="doc"
+		  ><p
+		    >doc for arg1</p
+		    ></td
+		  ></tr
+		><tr
+		><td class="src"
+		  >-> a</td
+		  ><td class="doc"
+		  ><p
+		    >doc for arg2</p
+		    ></td
+		  ></tr
+		><tr
+		><td class="src"
+		  >-> a</td
+		  ><td class="doc"
+		  ><p
+		    >doc for arg3</p
+		    ></td
+		  ></tr
+		></table
 	      ></div
 	    ></div
 	  ></div
diff --git a/html-test/src/Bug647.hs b/html-test/src/Bug647.hs
new file mode 100644
index 0000000..4143092
--- /dev/null
+++ b/html-test/src/Bug647.hs
@@ -0,0 +1,6 @@
+module Bug647 where
+
+class Bug647 a where
+	f :: a -- ^ doc for arg1
+	  -> a -- ^ doc for arg2
+	  -> a -- ^ doc for arg3
\ No newline at end of file



More information about the ghc-commits mailing list