diff options
author | Alec Theriault <alec.theriault@gmail.com> | 2018-07-20 04:50:00 -0700 |
---|---|---|
committer | Alexander Biehl <alexbiehl@gmail.com> | 2018-07-20 13:50:00 +0200 |
commit | f3e76a50eec28d17ddd0fe8e965c15c19c4ef3cf (patch) | |
tree | 8e32e6e12b45ce35be502e3b67fbb061175a18b2 | |
parent | 8ac6ac1097f2ec2bc9a7f9bdd765abf71164bfcb (diff) |
Misc tests (#858)
* More tests
* spliced types
* constructor/pattern argument docs
* strictness marks on fields with argument docs
* latex test cases need seperate directory
* Accept tests
-rw-r--r-- | html-test/ref/Bug574.html | 86 | ||||
-rw-r--r-- | html-test/ref/ConstructorArgs.html | 720 | ||||
-rw-r--r-- | html-test/ref/GadtConstructorArgs.html | 192 | ||||
-rw-r--r-- | html-test/src/Bug745.hs | 8 | ||||
-rw-r--r-- | html-test/src/ConstructorArgs.hs | 56 | ||||
-rw-r--r-- | html-test/src/GadtConstructorArgs.hs | 13 | ||||
-rw-r--r-- | latex-test/ref/ConstructorArgs/ConstructorArgs.tex | 69 | ||||
-rw-r--r-- | latex-test/ref/ConstructorArgs/haddock.sty | 57 | ||||
-rw-r--r-- | latex-test/ref/ConstructorArgs/main.tex | 11 | ||||
-rw-r--r-- | latex-test/ref/GadtConstructorArgs/GadtConstructorArgs.tex | 25 | ||||
-rw-r--r-- | latex-test/ref/GadtConstructorArgs/haddock.sty | 57 | ||||
-rw-r--r-- | latex-test/ref/GadtConstructorArgs/main.tex | 11 | ||||
-rw-r--r-- | latex-test/src/ConstructorArgs/ConstructorArgs.hs | 56 | ||||
-rw-r--r-- | latex-test/src/GadtConstructorArgs/GadtConstructorArgs.hs | 13 |
14 files changed, 1374 insertions, 0 deletions
diff --git a/html-test/ref/Bug574.html b/html-test/ref/Bug574.html new file mode 100644 index 00000000..ed0a5e15 --- /dev/null +++ b/html-test/ref/Bug574.html @@ -0,0 +1,86 @@ +<html xmlns="http://www.w3.org/1999/xhtml" +><head + ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" + /><title + >Bug574</title + ><link href="#" rel="stylesheet" type="text/css" title="Ocean" + /><link rel="stylesheet" type="text/css" href="#" + /><script src="haddock-bundle.min.js" async="async" type="text/javascript" + ></script + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></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" + ></p + ></div + ><div id="content" + ><div id="module-header" + ><table class="info" + ><tr + ><th + >Safe Haskell</th + ><td + >None</td + ></tr + ></table + ><p class="caption" + >Bug574</p + ></div + ><div id="synopsis" + ><details id="syn" + ><summary + >Synopsis</summary + ><ul class="details-toggle" data-details-id="syn" + ><li class="src short" + ><a href="#" + >foo</a + > :: <a href="#" title="Data.Int" + >Int</a + > -> <a href="#" title="Data.Int" + >Int</a + > -> <a href="#" title="Data.Int" + >Int</a + ></li + ></ul + ></details + ></div + ><div id="interface" + ><h1 + >Documentation</h1 + ><div class="top" + ><p class="src" + ><a id="v:foo" class="def" + >foo</a + > :: <a href="#" title="Data.Int" + >Int</a + > -> <a href="#" title="Data.Int" + >Int</a + > -> <a href="#" title="Data.Int" + >Int</a + > <a href="#" class="selflink" + >#</a + ></p + ><div class="doc" + ><p + >Somthing with a spliced type</p + ></div + ></div + ></div + ></div + ><div id="footer" + ></div + ></body + ></html +>
\ No newline at end of file diff --git a/html-test/ref/ConstructorArgs.html b/html-test/ref/ConstructorArgs.html new file mode 100644 index 00000000..9aad9c86 --- /dev/null +++ b/html-test/ref/ConstructorArgs.html @@ -0,0 +1,720 @@ +<html xmlns="http://www.w3.org/1999/xhtml" +><head + ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" + /><title + >ConstructorArgs</title + ><link href="#" rel="stylesheet" type="text/css" title="Ocean" + /><link rel="stylesheet" type="text/css" href="#" + /><script src="haddock-bundle.min.js" async="async" type="text/javascript" + ></script + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></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" + ></p + ></div + ><div id="content" + ><div id="module-header" + ><table class="info" + ><tr + ><th + >Safe Haskell</th + ><td + >Safe</td + ></tr + ></table + ><p class="caption" + >ConstructorArgs</p + ></div + ><div id="synopsis" + ><details id="syn" + ><summary + >Synopsis</summary + ><ul class="details-toggle" data-details-id="syn" + ><li class="src short" + ><span class="keyword" + >data</span + > <a href="#" + >Foo</a + ><ul class="subs" + ><li + >= <a href="#" + >Rec</a + > { <ul class="subs" + ><li + ><a href="#" + >x</a + > :: <a href="#" title="Data.String" + >String</a + ></li + ><li + ><a href="#" + >y</a + > :: <a href="#" title="Data.String" + >String</a + ></li + ></ul + > }</li + ><li + >| <a href="#" + >Baz</a + > <a href="#" title="Data.Int" + >Int</a + > <a href="#" title="Data.String" + >String</a + ></li + ><li + >| <a href="#" + >Boa</a + > !<a href="#" title="Data.Int" + >Int</a + > !<a href="#" title="Data.String" + >String</a + ></li + ><li + >| <a href="#" title="Data.Int" + >Int</a + > <a href="#" + >:|</a + > <a href="#" title="Data.String" + >String</a + ></li + ><li + >| <a href="#" title="Data.Int" + >Int</a + > <a href="#" + >:*</a + > <a href="#" title="Data.String" + >String</a + ></li + ></ul + ></li + ><li class="src short" + ><span class="keyword" + >data</span + > <a href="#" + >Boo</a + > <span class="keyword" + >where</span + ><ul class="subs" + ><li + ><a href="#" + >Foo</a + > :: <a href="#" title="Data.Int" + >Int</a + > -> <a href="#" title="Data.String" + >String</a + > -> <a href="#" title="ConstructorArgs" + >Boo</a + ></li + ><li + ><a href="#" + >Foa</a + > :: <a href="#" title="Data.Int" + >Int</a + > -> <a href="#" title="ConstructorArgs" + >Boo</a + ></li + ><li + ><span class="keyword" + >pattern</span + > <a href="#" + >Fo</a + > :: <a href="#" title="Data.Int" + >Int</a + > -> <a href="#" title="Data.String" + >String</a + > -> <a href="#" title="ConstructorArgs" + >Boo</a + ></li + ><li + ><span class="keyword" + >pattern</span + > <a href="#" + >Fo'</a + > :: <a href="#" title="ConstructorArgs" + >Boo</a + ></li + ></ul + ></li + ><li class="src short" + ><span class="keyword" + >pattern</span + > <a href="#" + >Bo</a + > :: <a href="#" title="Data.Int" + >Int</a + > -> <a href="#" title="Data.String" + >String</a + > -> <a href="#" title="ConstructorArgs" + >Boo</a + ></li + ><li class="src short" + ><span class="keyword" + >pattern</span + > <a href="#" + >Bo'</a + > :: <a href="#" title="Data.Int" + >Int</a + > -> <a href="#" title="Data.String" + >String</a + > -> <a href="#" title="ConstructorArgs" + >Boo</a + ></li + ></ul + ></details + ></div + ><div id="interface" + ><h1 + >Documentation</h1 + ><div class="top" + ><p class="src" + ><span class="keyword" + >data</span + > <a id="t:Foo" class="def" + >Foo</a + > <span class="fixity" + >infixr 1</span + ><span class="rightedge" + ></span + > <a href="#" class="selflink" + >#</a + ></p + ><div class="subs constructors" + ><p class="caption" + >Constructors</p + ><table + ><tr + ><td class="src" + ><a id="v:Rec" class="def" + >Rec</a + ></td + ><td class="doc" + ><p + >doc on a record</p + ></td + ></tr + ><tr + ><td colspan="2" + ><div class="subs fields" + ><p class="caption" + >Fields</p + ><ul + ><li + ><dfn class="src" + ><a id="v:x" class="def" + >x</a + > :: <a href="#" title="Data.String" + >String</a + ></dfn + ><div class="doc" + ><p + >doc on the <code + ><a href="#" title="Data.String" + >String</a + ></code + > field of <code + ><a href="#" title="ConstructorArgs" + >Rec</a + ></code + ></p + ></div + ></li + ><li + ><dfn class="src" + ><a id="v:y" class="def" + >y</a + > :: <a href="#" title="Data.String" + >String</a + ></dfn + ><div class="doc" + ><p + >doc on the <code + ><a href="#" title="Data.String" + >String</a + ></code + > field of <code + ><a href="#" title="ConstructorArgs" + >Rec</a + ></code + ></p + ></div + ></li + ></ul + ></div + ></td + ></tr + ><tr + ><td class="src" + ><a id="v:Baz" class="def" + >Baz</a + > <a href="#" title="Data.Int" + >Int</a + > <a href="#" title="Data.String" + >String</a + ></td + ><td class="doc" + ><p + >old prefix doc style</p + ></td + ></tr + ><tr + ><td class="src" + ><a id="v:Boa" class="def" + >Boa</a + > <span class="fixity" + >infixr 2</span + ><span class="rightedge" + ></span + ></td + ><td class="doc" + ><p + >doc on the <code + ><a href="#" title="ConstructorArgs" + >Boa</a + ></code + > constrictor</p + ></td + ></tr + ><tr + ><td colspan="2" + ><div class="subs fields" + ><p class="caption" + >Fields</p + ><ul + ><li + ><dfn class="src" + >!<a href="#" title="Data.Int" + >Int</a + ></dfn + ><div class="doc" + ><p + >doc on the <code + ><a href="#" title="Data.Int" + >Int</a + ></code + > field of <code + ><a href="#" title="ConstructorArgs" + >Boa</a + ></code + ></p + ></div + ></li + ><li + ><dfn class="src" + >!<a href="#" title="Data.String" + >String</a + ></dfn + ><div class="doc" + ><p + >doc on the <code + ><a href="#" title="Data.String" + >String</a + ></code + > field of <code + ><a href="#" title="ConstructorArgs" + >Boa</a + ></code + ></p + ></div + ></li + ></ul + ></div + ></td + ></tr + ><tr + ><td class="src" + ><a href="#" title="Data.Int" + >Int</a + > <a id="v::-124-" class="def" + >:|</a + > <a href="#" title="Data.String" + >String</a + ></td + ><td class="doc" + ><p + >old infix doc style</p + ></td + ></tr + ><tr + ><td class="src" + ><a id="v::-42-" class="def" + >(:*)</a + > <span class="fixity" + >infixr 3</span + ><span class="rightedge" + ></span + ></td + ><td class="doc" + ><p + >doc on the <code + ><a href="#" title="ConstructorArgs" + >:*</a + ></code + > constructor</p + ></td + ></tr + ><tr + ><td colspan="2" + ><div class="subs fields" + ><p class="caption" + >Fields</p + ><ul + ><li + ><dfn class="src" + ><a href="#" title="Data.Int" + >Int</a + ></dfn + ><div class="doc" + ><p + >doc on the <code + ><a href="#" title="Data.Int" + >Int</a + ></code + > field of the <code + ><a href="#" title="ConstructorArgs" + >:*</a + ></code + > constructor</p + ></div + ></li + ><li + ><dfn class="src" + ><a href="#" title="Data.String" + >String</a + ></dfn + ><div class="doc" + ><p + >doc on the <code + ><a href="#" title="Data.String" + >String</a + ></code + > field of the <code + ><a href="#" title="ConstructorArgs" + >:*</a + ></code + > constructor</p + ></div + ></li + ></ul + ></div + ></td + ></tr + ></table + ></div + ></div + ><div class="top" + ><p class="src" + ><span class="keyword" + >data</span + > <a id="t:Boo" class="def" + >Boo</a + > <span class="keyword" + >where</span + > <span class="fixity" + >infixr 4</span + ><span class="rightedge" + ></span + > <a href="#" class="selflink" + >#</a + ></p + ><div class="subs constructors" + ><p class="caption" + >Constructors</p + ><table + ><tr + ><td class="src" + ><a id="v:Foo" class="def" + >Foo</a + > <span class="fixity" + >infixr 1</span + ><span class="rightedge" + ></span + ></td + ><td class="doc" + ><p + >Info about a <code + ><a href="#" title="ConstructorArgs" + >Foo</a + ></code + ></p + ></td + ></tr + ><tr + ><td colspan="2" + ><div class="subs fields" + ><p class="caption" + >Fields</p + ><ul + ><li + ><dfn class="src" + >:: <a href="#" title="Data.Int" + >Int</a + ></dfn + ><div class="doc" + ><p + ><code + ><a href="#" title="Data.Int" + >Int</a + ></code + > field of <code + ><a href="#" title="ConstructorArgs" + >Foo</a + ></code + ></p + ></div + ></li + ><li + ><dfn class="src" + >-> <a href="#" title="Data.String" + >String</a + ></dfn + ><div class="doc" + ><p + ><code + ><a href="#" title="Data.String" + >String</a + ></code + > field of <code + ><a href="#" title="ConstructorArgs" + >Foo</a + ></code + ></p + ></div + ></li + ><li + ><dfn class="src" + >-> <a href="#" title="ConstructorArgs" + >Boo</a + ></dfn + ><div class="doc" + ><p + >Make a <code + ><a href="#" title="ConstructorArgs" + >Boo</a + ></code + ></p + ></div + ></li + ></ul + ></div + ></td + ></tr + ><tr + ><td class="src" + ><a id="v:Foa" class="def" + >Foa</a + > :: <a href="#" title="Data.Int" + >Int</a + > -> <a href="#" title="ConstructorArgs" + >Boo</a + ></td + ><td class="doc" + ><p + >no argument docs GADT</p + ></td + ></tr + ></table + ></div + ><div class="subs bundled-patterns" + ><p class="caption" + >Bundled Patterns</p + ><table + ><tr + ><td class="src" + ><span class="keyword" + >pattern</span + > <a id="v:Fo" class="def" + >Fo</a + > <span class="fixity" + >infixr 5</span + ><span class="rightedge" + ></span + ></td + ><td class="doc" + ><p + >Info about bundled <code + ><a href="#" title="ConstructorArgs" + >Fo</a + ></code + ></p + ></td + ></tr + ><tr + ><td colspan="2" + ><div class="subs fields" + ><p class="caption" + >Fields</p + ><ul + ><li + ><dfn class="src" + >:: <a href="#" title="Data.Int" + >Int</a + ></dfn + ><div class="doc" + ><p + >an <code + ><a href="#" title="Data.Int" + >Int</a + ></code + ></p + ></div + ></li + ><li + ><dfn class="src" + >-> <a href="#" title="Data.String" + >String</a + ></dfn + ><div class="doc" + ><p + >a <code + ><a href="#" title="Data.String" + >String</a + ></code + ></p + ></div + ></li + ><li + ><dfn class="src" + >-> <a href="#" title="ConstructorArgs" + >Boo</a + ></dfn + ><div class="doc" + ><p + >a <code + ><a href="#" title="ConstructorArgs" + >Boo</a + ></code + ></p + ></div + ></li + ></ul + ></div + ></td + ></tr + ><tr + ><td class="src" + ><span class="keyword" + >pattern</span + > <a id="v:Fo-39-" class="def" + >Fo'</a + > :: <a href="#" title="ConstructorArgs" + >Boo</a + ></td + ><td class="doc" + ><p + >Bundled and no argument docs</p + ></td + ></tr + ></table + ></div + ></div + ><div class="top" + ><p class="src" + ><span class="keyword" + >pattern</span + > <a id="v:Bo" class="def" + >Bo</a + > <span class="fixity" + >infixr 6</span + ><span class="rightedge" + ></span + > <a href="#" class="selflink" + >#</a + ></p + ><div class="subs arguments" + ><p class="caption" + >Arguments</p + ><table + ><tr + ><td class="src" + >:: <a href="#" title="Data.Int" + >Int</a + ></td + ><td class="doc" + ><p + >an <code + ><a href="#" title="Data.Int" + >Int</a + ></code + ></p + ></td + ></tr + ><tr + ><td class="src" + >-> <a href="#" title="Data.String" + >String</a + ></td + ><td class="doc" + ><p + >a <code + ><a href="#" title="Data.String" + >String</a + ></code + ></p + ></td + ></tr + ><tr + ><td class="src" + >-> <a href="#" title="ConstructorArgs" + >Boo</a + ></td + ><td class="doc" + ><p + >a <code + ><a href="#" title="ConstructorArgs" + >Boo</a + ></code + > pattern</p + ></td + ></tr + ></table + ></div + ><div class="doc" + ><p + >Info about not-bundled <code + ><a href="#" title="ConstructorArgs" + >Bo</a + ></code + ></p + ></div + ></div + ><div class="top" + ><p class="src" + ><span class="keyword" + >pattern</span + > <a id="v:Bo-39-" class="def" + >Bo'</a + > :: <a href="#" title="Data.Int" + >Int</a + > -> <a href="#" title="Data.String" + >String</a + > -> <a href="#" title="ConstructorArgs" + >Boo</a + > <a href="#" class="selflink" + >#</a + ></p + ><div class="doc" + ><p + >Not bunded and no argument docs</p + ></div + ></div + ></div + ></div + ><div id="footer" + ></div + ></body + ></html +>
\ No newline at end of file diff --git a/html-test/ref/GadtConstructorArgs.html b/html-test/ref/GadtConstructorArgs.html new file mode 100644 index 00000000..7497de83 --- /dev/null +++ b/html-test/ref/GadtConstructorArgs.html @@ -0,0 +1,192 @@ +<html xmlns="http://www.w3.org/1999/xhtml" +><head + ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" + /><title + >GadtConstructorArgs</title + ><link href="#" rel="stylesheet" type="text/css" title="Ocean" + /><link rel="stylesheet" type="text/css" href="#" + /><script src="haddock-bundle.min.js" async="async" type="text/javascript" + ></script + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></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" + ></p + ></div + ><div id="content" + ><div id="module-header" + ><table class="info" + ><tr + ><th + >Safe Haskell</th + ><td + >Safe</td + ></tr + ></table + ><p class="caption" + >GadtConstructorArgs</p + ></div + ><div id="interface" + ><h1 + >Documentation</h1 + ><div class="top" + ><p class="src" + ><span class="keyword" + >data</span + > <a id="t:Boo" class="def" + >Boo</a + > <span class="keyword" + >where</span + > <a href="#" class="selflink" + >#</a + ></p + ><div class="subs constructors" + ><p class="caption" + >Constructors</p + ><table + ><tr + ><td class="src" + ><a id="v:Fot" class="def" + >Fot</a + ></td + ><td class="doc empty" + ></td + ></tr + ><tr + ><td colspan="2" + ><div class="subs fields" + ><p class="caption" + >Fields</p + ><ul + ><li + ><dfn class="src" + >:: { <a id="v:x" class="def" + >x</a + > :: <a href="#" title="Data.Int" + >Int</a + ></dfn + ><div class="doc" + ><p + >an <code + ><a href="#" title="GadtConstructorArgs" + >x</a + ></code + ></p + ></div + ></li + ><li + ><dfn class="src" + >, <a id="v:y" class="def" + >y</a + > :: <a href="#" title="Data.Int" + >Int</a + ></dfn + ><div class="doc" + ><p + >a <code + ><a href="#" title="GadtConstructorArgs" + >y</a + ></code + ></p + ></div + ></li + ><li + ><dfn class="src" + >} -> <a href="#" title="GadtConstructorArgs" + >Boo</a + ></dfn + ><div class="doc empty" + ></div + ></li + ></ul + ></div + ></td + ></tr + ><tr + ><td class="src" + ><a id="v:Fob" class="def" + >Fob</a + ></td + ><td class="doc" + ><p + >Record GADT with docs</p + ></td + ></tr + ><tr + ><td colspan="2" + ><div class="subs fields" + ><p class="caption" + >Fields</p + ><ul + ><li + ><dfn class="src" + >:: { <a id="v:w" class="def" + >w</a + > :: <a href="#" title="Data.Int" + >Int</a + ></dfn + ><div class="doc" + ><p + >a <code + ><a href="#" title="GadtConstructorArgs" + >w</a + ></code + ></p + ></div + ></li + ><li + ><dfn class="src" + >, <a id="v:z" class="def" + >z</a + > :: <a href="#" title="Data.Int" + >Int</a + ></dfn + ><div class="doc" + ><p + >a <code + ><a href="#" title="GadtConstructorArgs" + >z</a + ></code + ></p + ></div + ></li + ><li + ><dfn class="src" + >} -> <a href="#" title="GadtConstructorArgs" + >Boo</a + ></dfn + ><div class="doc" + ><p + >a <code + ><a href="#" title="GadtConstructorArgs" + >Boo</a + ></code + ></p + ></div + ></li + ></ul + ></div + ></td + ></tr + ></table + ></div + ></div + ></div + ></div + ><div id="footer" + ></div + ></body + ></html +>
\ No newline at end of file diff --git a/html-test/src/Bug745.hs b/html-test/src/Bug745.hs new file mode 100644 index 00000000..f26562c1 --- /dev/null +++ b/html-test/src/Bug745.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE TemplateHaskell, QuasiQuotes #-} + +module Bug574 where +-- See https://github.com/haskell/haddock/issues/574 + +-- | Somthing with a spliced type +foo :: Int -> $(let i = [t| Int |] in [t| $i -> $i |]) +foo x y = x + y diff --git a/html-test/src/ConstructorArgs.hs b/html-test/src/ConstructorArgs.hs new file mode 100644 index 00000000..6b0da711 --- /dev/null +++ b/html-test/src/ConstructorArgs.hs @@ -0,0 +1,56 @@ +{-# LANGUAGE GADTs, PatternSynonyms #-} + +module ConstructorArgs (Foo(..), Boo(Foo, Foa, Fo, Fo'), pattern Bo, pattern Bo') where + +data Foo + = Rec -- ^ doc on a record + { x :: String -- ^ doc on the `String` field of `Rec` + , y :: String -- ^ doc on the `String` field of `Rec` + } + | Baz Int String -- ^ old prefix doc style + | Boa -- ^ doc on the `Boa` constrictor + !Int -- ^ doc on the `Int` field of `Boa` + !String -- ^ doc on the `String` field of `Boa` + | Int :| String -- ^ old infix doc style + | Int -- ^ doc on the `Int` field of the `:*` constructor + :* -- ^ doc on the `:*` constructor + String -- ^ doc on the `String` field of the `:*` constructor + +infixr 1 `Foo` +infixr 2 `Boa` +infixr 3 :* + +data Boo where + -- | Info about a 'Foo' + Foo :: Int -- ^ `Int` field of `Foo` + -> String -- ^ `String` field of `Foo` + -> Boo -- ^ Make a `Boo` + + -- | no argument docs GADT + Foa :: Int -> Boo + +infixr 4 `Boo` + +-- | Info about bundled 'Fo' +pattern Fo :: Int -- ^ an 'Int' + -> String -- ^ a 'String' + -> Boo -- ^ a 'Boo' +pattern Fo x y = Foo x y + +-- | Bundled and no argument docs +pattern Fo' :: Boo +pattern Fo' = Foo 1 "hi" + +infixr 5 `Fo` + +-- | Info about not-bundled 'Bo' +pattern Bo :: Int -- ^ an 'Int' + -> String -- ^ a 'String' + -> Boo -- ^ a 'Boo' pattern +pattern Bo x y = Foo x y + +-- | Not bunded and no argument docs +pattern Bo' :: Int -> String -> Boo +pattern Bo' x y = Foo x y + +infixr 6 `Bo` diff --git a/html-test/src/GadtConstructorArgs.hs b/html-test/src/GadtConstructorArgs.hs new file mode 100644 index 00000000..79ffb4d3 --- /dev/null +++ b/html-test/src/GadtConstructorArgs.hs @@ -0,0 +1,13 @@ +{-# LANGUAGE GADTs, PatternSynonyms #-} + +module GadtConstructorArgs (Boo(..)) where + +data Boo where + Fot :: { x :: Int -- ^ an 'x' + , y :: Int -- ^ a 'y' + } -> Boo + + -- | Record GADT with docs + Fob :: { w :: Int -- ^ a 'w' + , z :: Int -- ^ a 'z' + } -> Boo -- ^ a 'Boo' diff --git a/latex-test/ref/ConstructorArgs/ConstructorArgs.tex b/latex-test/ref/ConstructorArgs/ConstructorArgs.tex new file mode 100644 index 00000000..44304f47 --- /dev/null +++ b/latex-test/ref/ConstructorArgs/ConstructorArgs.tex @@ -0,0 +1,69 @@ +\haddockmoduleheading{ConstructorArgs} +\label{module:ConstructorArgs} +\haddockbeginheader +{\haddockverb\begin{verbatim} +module ConstructorArgs ( + Foo((:|), Rec, Baz, Boa, (:*), x, y), Boo(Foo, Foa, Fo, Fo'), pattern Bo, + pattern Bo' + ) where\end{verbatim}} +\haddockendheader + +\begin{haddockdesc} +\item[\begin{tabular}{@{}l} +data\ Foo +\end{tabular}]\haddockbegindoc +\enspace \emph{Constructors}\par +\haddockbeginconstrs +\haddockdecltt{=} & \haddockdecltt{Rec} & doc on a record \\ + & \haddocktt{\qquad \{} \haddockdecltt{x :: String} & doc on the \haddockid{String} field of \haddockid{Rec} \\ + & \haddocktt{\qquad ,} \haddockdecltt{y :: String} & doc on the \haddockid{String} field of \haddockid{Rec} \\ & \haddocktt{\qquad \}} \\ +\haddockdecltt{|} & \haddockdecltt{Baz Int String} & old prefix doc style \\ +\haddockdecltt{|} & \haddockdecltt{Boa} & doc on the \haddockid{Boa} constrictor \\ + & \qquad \haddockdecltt{!Int} & doc on the \haddockid{Int} field of \haddockid{Boa} \\ + & \qquad \haddockdecltt{!String} & doc on the \haddockid{String} field of \haddockid{Boa} \\ +\haddockdecltt{|} & \haddockdecltt{Int :| String} & old infix doc style \\ +\haddockdecltt{|} & \haddockdecltt{(:*)} & doc on the \haddockid{:*} constructor \\ + & \qquad \haddockdecltt{Int} & doc on the \haddockid{Int} field of the \haddockid{:*} constructor \\ + & \qquad \haddockdecltt{String} & doc on the \haddockid{String} field of the \haddockid{:*} constructor \\ +\end{tabulary}\par +\end{haddockdesc} +\begin{haddockdesc} +\item[\begin{tabular}{@{}l} +data\ Boo\ where +\end{tabular}]\haddockbegindoc +\enspace \emph{Constructors}\par +\haddockbeginconstrs +& \haddockdecltt{Foo} & Info about a \haddockid{Foo} \\ + & \qquad \haddockdecltt{::} \enspace \haddockdecltt{Int} & \haddockid{Int} field of \haddockid{Foo} \\ + & \qquad \haddockdecltt{->} \enspace \haddockdecltt{String} & \haddockid{String} field of \haddockid{Foo} \\ + & \qquad \haddockdecltt{->} \enspace \haddockdecltt{Boo} & Make a \haddockid{Boo} \\ +& \haddockdecltt{Foa :: Int -> Boo} & no argument docs GADT \\ +\end{tabulary}\par +\enspace \emph{Bundled Patterns}\par +\haddockbeginconstrs +& \haddockdecltt{pattern Fo} & Info about bundled \haddockid{Fo} \\ + & \qquad \haddockdecltt{::} \enspace \haddockdecltt{Int} & an \haddockid{Int} \\ + & \qquad \haddockdecltt{->} \enspace \haddockdecltt{String} & a \haddockid{String} \\ + & \qquad \haddockdecltt{->} \enspace \haddockdecltt{Boo} & a \haddockid{Boo} \\ +& \haddockdecltt{pattern Fo' :: Boo} & Bundled and no argument docs \\ +\end{tabulary}\par +\end{haddockdesc} +\begin{haddockdesc} +\item[\begin{tabular}{@{}l} +pattern\ Bo +\end{tabular}]\haddockbegindoc +\haddockbeginargs +\haddockdecltt{::} & \haddockdecltt{Int} & an \haddockid{Int} \\ +\haddockdecltt{->} & \haddockdecltt{String} & a \haddockid{String} \\ +\haddockdecltt{->} & \haddockdecltt{Boo} & a \haddockid{Boo} pattern \\ +\end{tabulary}\par +Info about not-bundled \haddockid{Bo}\par + +\end{haddockdesc} +\begin{haddockdesc} +\item[\begin{tabular}{@{}l} +pattern\ Bo'\ ::\ Int\ ->\ String\ ->\ Boo +\end{tabular}]\haddockbegindoc +Not bunded and no argument docs\par + +\end{haddockdesc}
\ No newline at end of file diff --git a/latex-test/ref/ConstructorArgs/haddock.sty b/latex-test/ref/ConstructorArgs/haddock.sty new file mode 100644 index 00000000..6e031a98 --- /dev/null +++ b/latex-test/ref/ConstructorArgs/haddock.sty @@ -0,0 +1,57 @@ +% Default Haddock style definitions. To use your own style, invoke +% Haddock with the option --latex-style=mystyle. + +\usepackage{tabulary} % see below + +% make hyperlinks in the PDF, and add an expandabale index +\usepackage[pdftex,bookmarks=true]{hyperref} + +\newenvironment{haddocktitle} + {\begin{center}\bgroup\large\bfseries} + {\egroup\end{center}} +\newenvironment{haddockprologue}{\vspace{1in}}{} + +\newcommand{\haddockmoduleheading}[1]{\chapter{\texttt{#1}}} + +\newcommand{\haddockbeginheader}{\hrulefill} +\newcommand{\haddockendheader}{\noindent\hrulefill} + +% a little gap before the ``Methods'' header +\newcommand{\haddockpremethods}{\vspace{2ex}} + +% inserted before \\begin{verbatim} +\newcommand{\haddockverb}{\small} + +% an identifier: add an index entry +\newcommand{\haddockid}[1]{\haddocktt{#1}\index{#1@\texttt{#1}}} + +% The tabulary environment lets us have a column that takes up ``the +% rest of the space''. Unfortunately it doesn't allow +% the \end{tabulary} to be in the expansion of a macro, it must appear +% literally in the document text, so Haddock inserts +% the \end{tabulary} itself. +\newcommand{\haddockbeginconstrs}{\begin{tabulary}{\linewidth}{@{}llJ@{}}} +\newcommand{\haddockbeginargs}{\begin{tabulary}{\linewidth}{@{}llJ@{}}} + +\newcommand{\haddocktt}[1]{{\small \texttt{#1}}} +\newcommand{\haddockdecltt}[1]{{\small\bfseries \texttt{#1}}} + +\makeatletter +\newenvironment{haddockdesc} + {\list{}{\labelwidth\z@ \itemindent-\leftmargin + \let\makelabel\haddocklabel}} + {\endlist} +\newcommand*\haddocklabel[1]{\hspace\labelsep\haddockdecltt{#1}} +\makeatother + +% after a declaration, start a new line for the documentation. +% Otherwise, the documentation starts right after the declaration, +% because we're using the list environment and the declaration is the +% ``label''. I tried making this newline part of the label, but +% couldn't get that to work reliably (the space seemed to stretch +% sometimes). +\newcommand{\haddockbegindoc}{\hfill\\[1ex]} + +% spacing between paragraphs and no \parindent looks better +\parskip=10pt plus2pt minus2pt +\setlength{\parindent}{0cm} diff --git a/latex-test/ref/ConstructorArgs/main.tex b/latex-test/ref/ConstructorArgs/main.tex new file mode 100644 index 00000000..80f639c5 --- /dev/null +++ b/latex-test/ref/ConstructorArgs/main.tex @@ -0,0 +1,11 @@ +\documentclass{book} +\usepackage{haddock} +\begin{document} +\begin{titlepage} +\begin{haddocktitle} + +\end{haddocktitle} +\end{titlepage} +\tableofcontents +\input{ConstructorArgs} +\end{document}
\ No newline at end of file diff --git a/latex-test/ref/GadtConstructorArgs/GadtConstructorArgs.tex b/latex-test/ref/GadtConstructorArgs/GadtConstructorArgs.tex new file mode 100644 index 00000000..7aaf5512 --- /dev/null +++ b/latex-test/ref/GadtConstructorArgs/GadtConstructorArgs.tex @@ -0,0 +1,25 @@ +\haddockmoduleheading{GadtConstructorArgs} +\label{module:GadtConstructorArgs} +\haddockbeginheader +{\haddockverb\begin{verbatim} +module GadtConstructorArgs ( + Boo(Fot, Fob, x, y, w, z) + ) where\end{verbatim}} +\haddockendheader + +\begin{haddockdesc} +\item[\begin{tabular}{@{}l} +data\ Boo\ where +\end{tabular}]\haddockbegindoc +\enspace \emph{Constructors}\par +\haddockbeginconstrs +& \haddockdecltt{Fot} & \\ + & \qquad \haddockdecltt{:: \{} \enspace \haddockdecltt{x :: Int} & an \haddockid{x} \\ + & \qquad \haddockdecltt{\ \ \ \ ,} \enspace \haddockdecltt{y :: Int} & a \haddockid{y} \\ + & \qquad \haddockdecltt{\ \ \ \ \} ->} \enspace \haddockdecltt{Boo} & \\ +& \haddockdecltt{Fob} & Record GADT with docs \\ + & \qquad \haddockdecltt{:: \{} \enspace \haddockdecltt{w :: Int} & a \haddockid{w} \\ + & \qquad \haddockdecltt{\ \ \ \ ,} \enspace \haddockdecltt{z :: Int} & a \haddockid{z} \\ + & \qquad \haddockdecltt{\ \ \ \ \} ->} \enspace \haddockdecltt{Boo} & a \haddockid{Boo} \\ +\end{tabulary}\par +\end{haddockdesc}
\ No newline at end of file diff --git a/latex-test/ref/GadtConstructorArgs/haddock.sty b/latex-test/ref/GadtConstructorArgs/haddock.sty new file mode 100644 index 00000000..6e031a98 --- /dev/null +++ b/latex-test/ref/GadtConstructorArgs/haddock.sty @@ -0,0 +1,57 @@ +% Default Haddock style definitions. To use your own style, invoke +% Haddock with the option --latex-style=mystyle. + +\usepackage{tabulary} % see below + +% make hyperlinks in the PDF, and add an expandabale index +\usepackage[pdftex,bookmarks=true]{hyperref} + +\newenvironment{haddocktitle} + {\begin{center}\bgroup\large\bfseries} + {\egroup\end{center}} +\newenvironment{haddockprologue}{\vspace{1in}}{} + +\newcommand{\haddockmoduleheading}[1]{\chapter{\texttt{#1}}} + +\newcommand{\haddockbeginheader}{\hrulefill} +\newcommand{\haddockendheader}{\noindent\hrulefill} + +% a little gap before the ``Methods'' header +\newcommand{\haddockpremethods}{\vspace{2ex}} + +% inserted before \\begin{verbatim} +\newcommand{\haddockverb}{\small} + +% an identifier: add an index entry +\newcommand{\haddockid}[1]{\haddocktt{#1}\index{#1@\texttt{#1}}} + +% The tabulary environment lets us have a column that takes up ``the +% rest of the space''. Unfortunately it doesn't allow +% the \end{tabulary} to be in the expansion of a macro, it must appear +% literally in the document text, so Haddock inserts +% the \end{tabulary} itself. +\newcommand{\haddockbeginconstrs}{\begin{tabulary}{\linewidth}{@{}llJ@{}}} +\newcommand{\haddockbeginargs}{\begin{tabulary}{\linewidth}{@{}llJ@{}}} + +\newcommand{\haddocktt}[1]{{\small \texttt{#1}}} +\newcommand{\haddockdecltt}[1]{{\small\bfseries \texttt{#1}}} + +\makeatletter +\newenvironment{haddockdesc} + {\list{}{\labelwidth\z@ \itemindent-\leftmargin + \let\makelabel\haddocklabel}} + {\endlist} +\newcommand*\haddocklabel[1]{\hspace\labelsep\haddockdecltt{#1}} +\makeatother + +% after a declaration, start a new line for the documentation. +% Otherwise, the documentation starts right after the declaration, +% because we're using the list environment and the declaration is the +% ``label''. I tried making this newline part of the label, but +% couldn't get that to work reliably (the space seemed to stretch +% sometimes). +\newcommand{\haddockbegindoc}{\hfill\\[1ex]} + +% spacing between paragraphs and no \parindent looks better +\parskip=10pt plus2pt minus2pt +\setlength{\parindent}{0cm} diff --git a/latex-test/ref/GadtConstructorArgs/main.tex b/latex-test/ref/GadtConstructorArgs/main.tex new file mode 100644 index 00000000..dc1a1aa3 --- /dev/null +++ b/latex-test/ref/GadtConstructorArgs/main.tex @@ -0,0 +1,11 @@ +\documentclass{book} +\usepackage{haddock} +\begin{document} +\begin{titlepage} +\begin{haddocktitle} + +\end{haddocktitle} +\end{titlepage} +\tableofcontents +\input{GadtConstructorArgs} +\end{document}
\ No newline at end of file diff --git a/latex-test/src/ConstructorArgs/ConstructorArgs.hs b/latex-test/src/ConstructorArgs/ConstructorArgs.hs new file mode 100644 index 00000000..6b0da711 --- /dev/null +++ b/latex-test/src/ConstructorArgs/ConstructorArgs.hs @@ -0,0 +1,56 @@ +{-# LANGUAGE GADTs, PatternSynonyms #-} + +module ConstructorArgs (Foo(..), Boo(Foo, Foa, Fo, Fo'), pattern Bo, pattern Bo') where + +data Foo + = Rec -- ^ doc on a record + { x :: String -- ^ doc on the `String` field of `Rec` + , y :: String -- ^ doc on the `String` field of `Rec` + } + | Baz Int String -- ^ old prefix doc style + | Boa -- ^ doc on the `Boa` constrictor + !Int -- ^ doc on the `Int` field of `Boa` + !String -- ^ doc on the `String` field of `Boa` + | Int :| String -- ^ old infix doc style + | Int -- ^ doc on the `Int` field of the `:*` constructor + :* -- ^ doc on the `:*` constructor + String -- ^ doc on the `String` field of the `:*` constructor + +infixr 1 `Foo` +infixr 2 `Boa` +infixr 3 :* + +data Boo where + -- | Info about a 'Foo' + Foo :: Int -- ^ `Int` field of `Foo` + -> String -- ^ `String` field of `Foo` + -> Boo -- ^ Make a `Boo` + + -- | no argument docs GADT + Foa :: Int -> Boo + +infixr 4 `Boo` + +-- | Info about bundled 'Fo' +pattern Fo :: Int -- ^ an 'Int' + -> String -- ^ a 'String' + -> Boo -- ^ a 'Boo' +pattern Fo x y = Foo x y + +-- | Bundled and no argument docs +pattern Fo' :: Boo +pattern Fo' = Foo 1 "hi" + +infixr 5 `Fo` + +-- | Info about not-bundled 'Bo' +pattern Bo :: Int -- ^ an 'Int' + -> String -- ^ a 'String' + -> Boo -- ^ a 'Boo' pattern +pattern Bo x y = Foo x y + +-- | Not bunded and no argument docs +pattern Bo' :: Int -> String -> Boo +pattern Bo' x y = Foo x y + +infixr 6 `Bo` diff --git a/latex-test/src/GadtConstructorArgs/GadtConstructorArgs.hs b/latex-test/src/GadtConstructorArgs/GadtConstructorArgs.hs new file mode 100644 index 00000000..79ffb4d3 --- /dev/null +++ b/latex-test/src/GadtConstructorArgs/GadtConstructorArgs.hs @@ -0,0 +1,13 @@ +{-# LANGUAGE GADTs, PatternSynonyms #-} + +module GadtConstructorArgs (Boo(..)) where + +data Boo where + Fot :: { x :: Int -- ^ an 'x' + , y :: Int -- ^ a 'y' + } -> Boo + + -- | Record GADT with docs + Fob :: { w :: Int -- ^ a 'w' + , z :: Int -- ^ a 'z' + } -> Boo -- ^ a 'Boo' |