From af3e6c7c027389df18b15ee9a9d72ffc97dc1852 Mon Sep 17 00:00:00 2001 From: Alex Biehl Date: Thu, 29 Jun 2017 19:54:49 +0200 Subject: Make per-argument docs for class methods work again (#648) * Make per-argument docs for class methods work again * Test case --- CHANGES.md | 6 +- haddock-api/src/Haddock/Interface/Create.hs | 5 +- html-test/ref/Bug647.html | 114 ++++++++++++++++++++++++++++ html-test/src/Bug647.hs | 6 ++ 4 files changed, 127 insertions(+), 4 deletions(-) create mode 100644 html-test/ref/Bug647.html create mode 100644 html-test/src/Bug647.hs diff --git a/CHANGES.md b/CHANGES.md index 628b0968..1cbaf62e 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 50643e2a..9227c378 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/Bug647.html b/html-test/ref/Bug647.html new file mode 100644 index 00000000..086840ab --- /dev/null +++ b/html-test/ref/Bug647.html @@ -0,0 +1,114 @@ +Bug647

Safe HaskellSafe

Bug647

Documentation

class Bug647 a where #

Minimal complete definition

f

Methods

f #

Arguments

:: a

doc for arg1

-> a

doc for arg2

-> a

doc for arg3

\ No newline at end of file diff --git a/html-test/src/Bug647.hs b/html-test/src/Bug647.hs new file mode 100644 index 00000000..4143092a --- /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 -- cgit v1.2.3