diff options
author | Alec Theriault <alec.theriault@gmail.com> | 2019-03-08 13:23:37 -0800 |
---|---|---|
committer | Alec Theriault <alec.theriault@gmail.com> | 2019-03-09 11:22:55 -0800 |
commit | abb448ff120d6f09b6d070806de1d0eb334bc23b (patch) | |
tree | 85ae5ea96f3c8b990ae5a2a7dac01230a33c1507 /html-test | |
parent | 50cf001765123a6c787795dda50aaefa5f2beed7 (diff) |
Better support for default methods in classes
* default methods now get rendered differently
* default associated types get rendered
* fix a forgotten `s/TypeSig/ClassOpSig/` refactor in LaTeX backend
* LaTeX backend now renders default method signatures
NB: there is still no way to document default class members and the
NB: LaTeX backend still crashes on associated types
Diffstat (limited to 'html-test')
-rw-r--r-- | html-test/ref/DefaultAssociatedTypes.html | 158 | ||||
-rw-r--r-- | html-test/ref/DefaultSignatures.html | 182 | ||||
-rw-r--r-- | html-test/src/DefaultAssociatedTypes.hs | 14 | ||||
-rw-r--r-- | html-test/src/DefaultSignatures.hs | 19 |
4 files changed, 373 insertions, 0 deletions
diff --git a/html-test/ref/DefaultAssociatedTypes.html b/html-test/ref/DefaultAssociatedTypes.html new file mode 100644 index 00000000..d456815f --- /dev/null +++ b/html-test/ref/DefaultAssociatedTypes.html @@ -0,0 +1,158 @@ +<html xmlns="http://www.w3.org/1999/xhtml" +><head + ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" + /><meta name="viewport" content="width=device-width, initial-scale=1" + /><title + >DefaultAssociatedTypes</title + ><link href="#" rel="stylesheet" type="text/css" title="Linuwial" + /><link rel="stylesheet" type="text/css" href="#" + /><link rel="stylesheet" type="text/css" href="#" + /><script src="haddock-bundle.min.js" async="async" type="text/javascript" + ></script + ><script type="text/x-mathjax-config" + >MathJax.Hub.Config({ tex2jax: { processClass: "mathjax", ignoreClass: ".*" } });</script + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script + ></head + ><body + ><div id="package-header" + ><span class="caption empty" + ></span + ><ul class="links" id="page-menu" + ><li + ><a href="#" + >Contents</a + ></li + ><li + ><a href="#" + >Index</a + ></li + ></ul + ></div + ><div id="content" + ><div id="module-header" + ><table class="info" + ><tr + ><th + >Safe Haskell</th + ><td + >Safe</td + ></tr + ></table + ><p class="caption" + >DefaultAssociatedTypes</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" + >class</span + > <a href="#" + >Foo</a + > a <span class="keyword" + >where</span + ><ul class="subs" + ><li + ><span class="keyword" + >type</span + > <a href="#" + >Qux</a + > a :: *</li + ><li + ><a href="#" + >bar</a + >, <a href="#" + >baz</a + > :: a -> <a href="#" title="Data.String" + >String</a + ></li + ></ul + ></li + ></ul + ></details + ></div + ><div id="interface" + ><h1 + >Documentation</h1 + ><div class="top" + ><p class="src" + ><span class="keyword" + >class</span + > <a id="t:Foo" class="def" + >Foo</a + > a <span class="keyword" + >where</span + > <a href="#" class="selflink" + >#</a + ></p + ><div class="doc" + ><p + >Documentation for Foo.</p + ></div + ><div class="subs associated-types" + ><p class="caption" + >Associated Types</p + ><p class="src" + ><span class="keyword" + >type</span + > <a id="t:Qux" class="def" + >Qux</a + > a :: * <a href="#" class="selflink" + >#</a + ></p + ><div class="doc" + ><p + >Doc for Qux</p + ></div + > <div class="subs default" + ><p class="caption" + ></p + ><p class="src" + ><span class="keyword" + >type</span + > <a id="t:Qux" class="def" + >Qux</a + > a = [a] <a href="#" class="selflink" + >#</a + ></p + ></div + ></div + ><div class="subs methods" + ><p class="caption" + >Methods</p + ><p class="src" + ><a id="v:bar" class="def" + >bar</a + > :: a -> <a href="#" title="Data.String" + >String</a + > <a href="#" class="selflink" + >#</a + ></p + ><div class="doc" + ><p + >Documentation for bar and baz.</p + ></div + ><p class="src" + ><a id="v:baz" class="def" + >baz</a + > :: a -> <a href="#" title="Data.String" + >String</a + > <a href="#" class="selflink" + >#</a + ></p + ><div class="doc" + ><p + >Documentation for bar and baz.</p + ></div + ></div + ></div + ></div + ></div + ><div id="footer" + ></div + ></body + ></html +>
\ No newline at end of file diff --git a/html-test/ref/DefaultSignatures.html b/html-test/ref/DefaultSignatures.html new file mode 100644 index 00000000..4bf261f7 --- /dev/null +++ b/html-test/ref/DefaultSignatures.html @@ -0,0 +1,182 @@ +<html xmlns="http://www.w3.org/1999/xhtml" +><head + ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" + /><meta name="viewport" content="width=device-width, initial-scale=1" + /><title + >DefaultSignatures</title + ><link href="#" rel="stylesheet" type="text/css" title="Linuwial" + /><link rel="stylesheet" type="text/css" href="#" + /><link rel="stylesheet" type="text/css" href="#" + /><script src="haddock-bundle.min.js" async="async" type="text/javascript" + ></script + ><script type="text/x-mathjax-config" + >MathJax.Hub.Config({ tex2jax: { processClass: "mathjax", ignoreClass: ".*" } });</script + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script + ></head + ><body + ><div id="package-header" + ><span class="caption empty" + ></span + ><ul class="links" id="page-menu" + ><li + ><a href="#" + >Contents</a + ></li + ><li + ><a href="#" + >Index</a + ></li + ></ul + ></div + ><div id="content" + ><div id="module-header" + ><table class="info" + ><tr + ><th + >Safe Haskell</th + ><td + >Safe</td + ></tr + ></table + ><p class="caption" + >DefaultSignatures</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" + >class</span + > <a href="#" + >Foo</a + > a <span class="keyword" + >where</span + ><ul class="subs" + ><li + ><a href="#" + >bar</a + >, <a href="#" + >baz</a + > :: a -> <a href="#" title="Data.String" + >String</a + ></li + ><li + ><a href="#" + >baz'</a + > :: <a href="#" title="Data.String" + >String</a + > -> a</li + ></ul + ></li + ></ul + ></details + ></div + ><div id="interface" + ><h1 + >Documentation</h1 + ><div class="top" + ><p class="src" + ><span class="keyword" + >class</span + > <a id="t:Foo" class="def" + >Foo</a + > a <span class="keyword" + >where</span + > <a href="#" class="selflink" + >#</a + ></p + ><div class="doc" + ><p + >Documentation for Foo.</p + ></div + ><div class="subs minimal" + ><p class="caption" + >Minimal complete definition</p + ><p class="src" + ><a href="#" title="DefaultSignatures" + >baz</a + ></p + ></div + ><div class="subs methods" + ><p class="caption" + >Methods</p + ><p class="src" + ><a id="v:bar" class="def" + >bar</a + > :: a -> <a href="#" title="Data.String" + >String</a + > <a href="#" class="selflink" + >#</a + ></p + ><div class="doc" + ><p + >Documentation for bar and baz.</p + ></div + > <div class="subs default" + ><p class="caption" + ></p + ><p class="src" + ><span class="keyword" + >default</span + > <a id="v:bar" class="def" + >bar</a + > :: <a href="#" title="Text.Show" + >Show</a + > a => a -> <a href="#" title="Data.String" + >String</a + > <a href="#" class="selflink" + >#</a + ></p + ></div + ><p class="src" + ><a id="v:baz" class="def" + >baz</a + > :: a -> <a href="#" title="Data.String" + >String</a + > <a href="#" class="selflink" + >#</a + ></p + ><div class="doc" + ><p + >Documentation for bar and baz.</p + ></div + ><p class="src" + ><a id="v:baz-39-" class="def" + >baz'</a + > :: <a href="#" title="Data.String" + >String</a + > -> a <a href="#" class="selflink" + >#</a + ></p + ><div class="doc" + ><p + >Documentation for baz'.</p + ></div + > <div class="subs default" + ><p class="caption" + ></p + ><p class="src" + ><span class="keyword" + >default</span + > <a id="v:baz-39-" class="def" + >baz'</a + > :: <a href="#" title="Text.Read" + >Read</a + > a => <a href="#" title="Data.String" + >String</a + > -> a <a href="#" class="selflink" + >#</a + ></p + ></div + ></div + ></div + ></div + ></div + ><div id="footer" + ></div + ></body + ></html +>
\ No newline at end of file diff --git a/html-test/src/DefaultAssociatedTypes.hs b/html-test/src/DefaultAssociatedTypes.hs new file mode 100644 index 00000000..6ad197d3 --- /dev/null +++ b/html-test/src/DefaultAssociatedTypes.hs @@ -0,0 +1,14 @@ +{-# LANGUAGE DefaultSignatures, TypeFamilies #-} + +module DefaultAssociatedTypes where + +-- | Documentation for Foo. +class Foo a where + -- | Documentation for bar and baz. + bar, baz :: a -> String + + -- | Doc for Qux + type Qux a :: * + + -- | Doc for default Qux + type Qux a = [a] diff --git a/html-test/src/DefaultSignatures.hs b/html-test/src/DefaultSignatures.hs new file mode 100644 index 00000000..52d68a96 --- /dev/null +++ b/html-test/src/DefaultSignatures.hs @@ -0,0 +1,19 @@ +{-# LANGUAGE DefaultSignatures #-} + +module DefaultSignatures where + +-- | Documentation for Foo. +class Foo a where + -- | Documentation for bar and baz. + bar, baz :: a -> String + + -- | Documentation for the default signature of bar. + default bar :: Show a => a -> String + bar = show + + -- | Documentation for baz'. + baz' :: String -> a + + -- | Documentation for the default signature of baz'. + default baz' :: Read a => String -> a + baz' = read |