aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES2
-rw-r--r--html-test/ref/AdvanceTypes.html2
-rw-r--r--html-test/ref/Bug85.html135
-rw-r--r--html-test/src/Bug85.hs15
-rw-r--r--src/Haddock/Backends/Xhtml/Decl.hs16
5 files changed, 163 insertions, 7 deletions
diff --git a/CHANGES b/CHANGES
index be2de824..31851e5d 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,8 @@ Changes in version 2.15.0
* Always read in prologue files as UTF8 (#286 and Cabal #1721)
+ * 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 ab37fe61..b918a220 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"
+ > :: [*] -&gt; * <span class="keyword"
>where</span
></p
><div class="subs constructors"
diff --git a/html-test/ref/Bug85.html b/html-test/ref/Bug85.html
new file mode 100644
index 00000000..bb1f03a3
--- /dev/null
+++ b/html-test/ref/Bug85.html
@@ -0,0 +1,135 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+><head
+ ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"
+ /><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_Bug85.html");};
+//]]>
+</script
+ ></head
+ ><body
+ ><div id="package-header"
+ ><ul class="links" id="page-menu"
+ ><li
+ ><a href=""
+ >Contents</a
+ ></li
+ ><li
+ ><a href=""
+ >Index</a
+ ></li
+ ></ul
+ ><p class="caption empty"
+ >&nbsp;</p
+ ></div
+ ><div id="content"
+ ><div id="module-header"
+ ><table class="info"
+ ><tr
+ ><th
+ >Safe Haskell</th
+ ><td
+ >Safe-Inferred</td
+ ></tr
+ ></table
+ ><p class="caption"
+ >Bug85</p
+ ></div
+ ><div id="interface"
+ ><h1
+ >Documentation</h1
+ ><div class="top"
+ ><p class="src"
+ ><span class="keyword"
+ >data</span
+ > <a name="t:Foo" class="def"
+ >Foo</a
+ > :: (* -&gt; *) -&gt; * -&gt; * <span class="keyword"
+ >where</span
+ ></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 -&gt; <a href=""
+ >Foo</a
+ > f (f x)</td
+ ><td class="doc empty"
+ >&nbsp;</td
+ ></tr
+ ></table
+ ></div
+ ></div
+ ><div class="top"
+ ><p class="src"
+ ><span class="keyword"
+ >data</span
+ > <a name="t:Baz" class="def"
+ >Baz</a
+ > :: * <span class="keyword"
+ >where</span
+ ></p
+ ><div class="subs constructors"
+ ><p class="caption"
+ >Constructors</p
+ ><table
+ ><tr
+ ><td class="src"
+ ><a name="v:Baz-39-" class="def"
+ >Baz'</a
+ > :: <a href=""
+ >Baz</a
+ ></td
+ ><td class="doc empty"
+ >&nbsp;</td
+ ></tr
+ ></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"
+ >&nbsp;</td
+ ></tr
+ ></table
+ ></div
+ ></div
+ ></div
+ ></div
+ ><div id="footer"
+ ><p
+ >Produced by <a href=""
+ >Haddock</a
+ > version 2.15.0</p
+ ></div
+ ></body
+ ></html
+>
diff --git a/html-test/src/Bug85.hs b/html-test/src/Bug85.hs
new file mode 100644
index 00000000..9c5b768b
--- /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 2dc1e0e7..8884f69f 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