[commit: haddock] v2.14: Print kind signatures on GADTs (72d5d54)
git at git.haskell.org
git at git.haskell.org
Tue Apr 1 18:08:41 UTC 2014
Repository : ssh://git@git.haskell.org/haddock
On branch : v2.14
Link : http://git.haskell.org/haddock.git/commitdiff/72d5d5490a324d3599085a009ce2d45a076988b6
>---------------------------------------------------------------
commit 72d5d5490a324d3599085a009ce2d45a076988b6
Author: Mateusz Kowalczyk <fuuzetsu at fuuzetsu.co.uk>
Date: Tue Apr 1 18:44:47 2014 +0100
Print kind signatures on GADTs
>---------------------------------------------------------------
72d5d5490a324d3599085a009ce2d45a076988b6
CHANGES | 4 ++
html-test/ref/AdvanceTypes.html | 2 +-
html-test/ref/{Ticket253_2.html => Bug85.html} | 86 +++++++++++++++---------
html-test/src/Bug85.hs | 15 +++++
src/Haddock/Backends/Xhtml/Decl.hs | 16 +++--
5 files changed, 85 insertions(+), 38 deletions(-)
diff --git a/CHANGES b/CHANGES
index 7929160..d587201 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,7 @@
+Changes in version 2.14.2
+
+ * Print kind signatures GADTs (#85)
+
Changes in version 2.14.1
* Render * and -> with their UnicodeSyntax equivalents if -U is enabled
diff --git a/html-test/ref/AdvanceTypes.html b/html-test/ref/AdvanceTypes.html
index 489b6e1..b594321 100644
--- a/html-test/ref/AdvanceTypes.html
+++ b/html-test/ref/AdvanceTypes.html
@@ -50,7 +50,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_AdvanceTypes.html");};
>data</span
> <a name="t:Pattern" class="def"
>Pattern</a
- > <span class="keyword"
+ > :: [*] -> * <span class="keyword"
>where</span
></p
><div class="subs constructors"
diff --git a/html-test/ref/Ticket253_2.html b/html-test/ref/Bug85.html
similarity index 58%
copy from html-test/ref/Ticket253_2.html
copy to html-test/ref/Bug85.html
index d00380f..09a83dc 100644
--- a/html-test/ref/Ticket253_2.html
+++ b/html-test/ref/Bug85.html
@@ -3,13 +3,13 @@
><head
><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"
/><title
- >Ticket253_2</title
+ >Bug85</title
><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean"
/><script src="haddock-util.js" type="text/javascript"
></script
><script type="text/javascript"
>//<![CDATA[
-window.onload = function () {pageLoad();setSynopsis("mini_Ticket253_2.html");};
+window.onload = function () {pageLoad();setSynopsis("mini_Bug85.html");};
//]]>
</script
></head
@@ -39,41 +39,35 @@ window.onload = function () {pageLoad();setSynopsis("mini_Ticket253_2.html");};
></tr
></table
><p class="caption"
- >Ticket253_2</p
- ></div
- ><div id="synopsis"
- ><p id="control.syn" class="caption expander" onclick="toggleSection('syn')"
- >Synopsis</p
- ><ul id="section.syn" class="hide" onclick="toggleSection('syn')"
- ><li class="src short"
- ><a href=""
- >bar</a
- > :: <a href=""
- >Int</a
- ></li
- ><li class="src short"
- ><span class="keyword"
- >data</span
- > <a href=""
- >Baz</a
- > = <a href=""
- >Baz</a
- ></li
- ></ul
+ >Bug85</p
></div
><div id="interface"
><h1
>Documentation</h1
><div class="top"
><p class="src"
- ><a name="v:bar" class="def"
- >bar</a
- > :: <a href=""
- >Int</a
+ ><span class="keyword"
+ >data</span
+ > <a name="t:Foo" class="def"
+ >Foo</a
+ > :: (* -> *) -> * -> * <span class="keyword"
+ >where</span
></p
- ><div class="doc"
- ><p
- >Comment</p
+ ><div class="subs constructors"
+ ><p class="caption"
+ >Constructors</p
+ ><table
+ ><tr
+ ><td class="src"
+ ><a name="v:Bar" class="def"
+ >Bar</a
+ > :: f x -> <a href=""
+ >Foo</a
+ > f (f x)</td
+ ><td class="doc empty"
+ > </td
+ ></tr
+ ></table
></div
></div
><div class="top"
@@ -82,6 +76,8 @@ window.onload = function () {pageLoad();setSynopsis("mini_Ticket253_2.html");};
>data</span
> <a name="t:Baz" class="def"
>Baz</a
+ > :: * <span class="keyword"
+ >where</span
></p
><div class="subs constructors"
><p class="caption"
@@ -89,7 +85,9 @@ window.onload = function () {pageLoad();setSynopsis("mini_Ticket253_2.html");};
><table
><tr
><td class="src"
- ><a name="v:Baz" class="def"
+ ><a name="v:Baz-39-" class="def"
+ >Baz'</a
+ > :: <a href=""
>Baz</a
></td
><td class="doc empty"
@@ -98,6 +96,32 @@ window.onload = function () {pageLoad();setSynopsis("mini_Ticket253_2.html");};
></table
></div
></div
+ ><div class="top"
+ ><p class="src"
+ ><span class="keyword"
+ >data</span
+ > <a name="t:Qux" class="def"
+ >Qux</a
+ > <span class="keyword"
+ >where</span
+ ></p
+ ><div class="subs constructors"
+ ><p class="caption"
+ >Constructors</p
+ ><table
+ ><tr
+ ><td class="src"
+ ><a name="v:Quux" class="def"
+ >Quux</a
+ > :: <a href=""
+ >Qux</a
+ ></td
+ ><td class="doc empty"
+ > </td
+ ></tr
+ ></table
+ ></div
+ ></div
></div
></div
><div id="footer"
diff --git a/html-test/src/Bug85.hs b/html-test/src/Bug85.hs
new file mode 100644
index 0000000..9c5b768
--- /dev/null
+++ b/html-test/src/Bug85.hs
@@ -0,0 +1,15 @@
+{-# LANGUAGE GADTs, KindSignatures #-}
+{-# OPTIONS_HADDOCK use-unicode #-}
+module Bug85 where
+
+-- explicitly stated non-trivial kind
+data Foo :: (* -> *) -> * -> * where
+ Bar :: f x -> Foo f (f x)
+
+-- Just kind * but explicitly written
+data Baz :: * where
+ Baz' :: Baz
+
+-- No kind signature written down at all
+data Qux where
+ Quux :: Qux
diff --git a/src/Haddock/Backends/Xhtml/Decl.hs b/src/Haddock/Backends/Xhtml/Decl.hs
index 2dc1e0e..8884f69 100644
--- a/src/Haddock/Backends/Xhtml/Decl.hs
+++ b/src/Haddock/Backends/Xhtml/Decl.hs
@@ -39,7 +39,6 @@ import GHC.Exts
import Name
import BooleanFormula
-
ppDecl :: Bool -> LinksInfo -> LHsDecl DocName
-> DocForDecl DocName -> [DocInstance DocName] -> [(DocName, Fixity)]
-> [(DocName, DocForDecl DocName)] -> Splice -> Unicode -> Qualification -> Html
@@ -312,7 +311,6 @@ ppDataBinderWithVars :: Bool -> TyClDecl DocName -> Html
ppDataBinderWithVars summ decl =
ppAppDocNameNames summ (tcdName decl) (tyvarNames $ tcdTyVars decl)
-
--------------------------------------------------------------------------------
-- * Type applications
--------------------------------------------------------------------------------
@@ -726,17 +724,23 @@ ppShortField summary unicode qual (ConDeclField (L _ name) ltype _)
-- | Print the LHS of a data\/newtype declaration.
-- Currently doesn't handle 'data instance' decls or kind signatures
ppDataHeader :: Bool -> TyClDecl DocName -> Unicode -> Qualification -> Html
-ppDataHeader summary decl@(DataDecl { tcdDataDefn = HsDataDefn { dd_ND = nd
- , dd_ctxt = ctxt } })
+ppDataHeader summary decl@(DataDecl { tcdDataDefn =
+ HsDataDefn { dd_ND = nd
+ , dd_ctxt = ctxt
+ , dd_kindSig = ks } })
unicode qual
= -- newtype or data
- (case nd of { NewType -> keyword "newtype"; DataType -> keyword "data" }) <+>
+ (case nd of { NewType -> keyword "newtype"; DataType -> keyword "data" })
+ <+>
-- context
ppLContext ctxt unicode qual <+>
-- T a b c ..., or a :+: b
ppDataBinderWithVars summary decl
-ppDataHeader _ _ _ _ = error "ppDataHeader: illegal argument"
+ <+> case ks of
+ Nothing -> mempty
+ Just (L _ x) -> dcolon unicode <+> ppKind unicode qual x
+ppDataHeader _ _ _ _ = error "ppDataHeader: illegal argument"
--------------------------------------------------------------------------------
-- * Types and contexts
More information about the ghc-commits
mailing list