diff options
Diffstat (limited to 'tests')
31 files changed, 6469 insertions, 0 deletions
diff --git a/tests/README b/tests/README new file mode 100644 index 00000000..b3080c74 --- /dev/null +++ b/tests/README @@ -0,0 +1,7 @@ +This is a little output test suit for Haddock. To add a test: + + 1 Create a module and add it to a new directory or an appropriate existing one + 2 Run runtests.hs (giving it the lib dir to GHC). + You should now have output/<dir>/<modulename>.html but the test will always + pass since there is no reference output to compare with + 3 To add reference output, you can copy <modulename>.html to <modulename>.html.ref diff --git a/tests/extensions/TypeOperators.hs b/tests/extensions/TypeOperators.hs new file mode 100644 index 00000000..aa0fbe8c --- /dev/null +++ b/tests/extensions/TypeOperators.hs @@ -0,0 +1,22 @@ +module TypeOperators ( + -- * stuff + (:-:), + (:+:), + Op, + O(..), + biO, + Flip(..) +) where + +data a :-: b + +data (a :+: b) c + +data a `Op` b + +newtype (g `O` f) a = O { unO :: g (f a) } + +biO :: (g `O` f) a +biO = undefined + +newtype Flip (~>) b a = Flip { unFlip :: a ~> b } diff --git a/tests/extensions/TypeOperators.html.ref b/tests/extensions/TypeOperators.html.ref new file mode 100644 index 00000000..7928c244 --- /dev/null +++ b/tests/extensions/TypeOperators.html.ref @@ -0,0 +1,398 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<!--Rendered using the Haskell Html Library v0.2--> +<HTML +><HEAD +><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8" +><TITLE +>TypeOperators</TITLE +><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css" +><SCRIPT SRC="haddock.js" TYPE="text/javascript" +></SCRIPT +></HEAD +><BODY +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="topbar" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD +><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" " +></TD +><TD CLASS="title" +></TD +><TD CLASS="topbut" +><A HREF="index.html" +>Contents</A +></TD +><TD CLASS="topbut" +><A HREF="doc-index.html" +>Index</A +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="modulebar" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD +><FONT SIZE="6" +>TypeOperators</FONT +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="section4" +><B +>Contents</B +></TD +></TR +><TR +><TD +><DL +><DT +><A HREF="#1" +>stuff +</A +></DT +></DL +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="section1" +>Synopsis</TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>data</SPAN +> a <A HREF="#t%3A%3A-%3A" +>:-:</A +> b</TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>data</SPAN +> (a <A HREF="#t%3A%3A%2B%3A" +>:+:</A +> b) c</TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>data</SPAN +> <A HREF="#t%3AOp" +>Op</A +> a b</TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>newtype</SPAN +> <A HREF="#t%3AO" +>O</A +> g f a = <A HREF="#v%3AO" +>O</A +> {<TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="recfield" +><A HREF="#v%3AunO" +>unO</A +> :: g (f a)</TD +></TR +></TABLE +>}</TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="decl" +><A HREF="#v%3AbiO" +>biO</A +> :: (g `<A HREF="TypeOperators.html#t%3AO" +>O</A +>` f) a</TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>newtype</SPAN +> <A HREF="#t%3AFlip" +>Flip</A +> (~>) b a = <A HREF="#v%3AFlip" +>Flip</A +> {<TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="recfield" +><A HREF="#v%3AunFlip" +>unFlip</A +> :: a ~> b</TD +></TR +></TABLE +>}</TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="section1" +><A NAME="1" +>stuff +</A +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>data</SPAN +> a <A NAME="t%3A%3A-%3A" +></A +><B +>:-:</B +> b </TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>data</SPAN +> (a <A NAME="t%3A%3A%2B%3A" +></A +><B +>:+:</B +> b) c </TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>data</SPAN +> <A NAME="t%3AOp" +></A +><B +>Op</B +> a b </TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>newtype</SPAN +> <A NAME="t%3AO" +></A +><B +>O</B +> g f a </TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="section4" +>Constructors</TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="5" CELLPADDING="0" +><TR +><TD CLASS="arg" +><A NAME="v%3AO" +></A +><B +>O</B +></TD +><TD CLASS="rdoc" +></TD +></TR +><TR +><TD CLASS="body" COLSPAN="2" +><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" +><TR +><TD CLASS="arg" +><A NAME="v%3AunO" +></A +><B +>unO</B +> :: g (f a)</TD +><TD CLASS="rdoc" +></TD +></TR +></TABLE +></TD +></TR +></TABLE +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><A NAME="v%3AbiO" +></A +><B +>biO</B +> :: (g `<A HREF="TypeOperators.html#t%3AO" +>O</A +>` f) a</TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>newtype</SPAN +> <A NAME="t%3AFlip" +></A +><B +>Flip</B +> (~>) b a </TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="section4" +>Constructors</TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="5" CELLPADDING="0" +><TR +><TD CLASS="arg" +><A NAME="v%3AFlip" +></A +><B +>Flip</B +></TD +><TD CLASS="rdoc" +></TD +></TR +><TR +><TD CLASS="body" COLSPAN="2" +><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" +><TR +><TD CLASS="arg" +><A NAME="v%3AunFlip" +></A +><B +>unFlip</B +> :: a ~> b</TD +><TD CLASS="rdoc" +></TD +></TR +></TABLE +></TD +></TR +></TABLE +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="botbar" +>Produced by <A HREF="http://www.haskell.org/haddock/" +>Haddock</A +> version 2.0</TD +></TR +></TABLE +></BODY +></HTML +> diff --git a/tests/pre-2.0-tests/A.hs b/tests/pre-2.0-tests/A.hs new file mode 100644 index 00000000..4a344a24 --- /dev/null +++ b/tests/pre-2.0-tests/A.hs @@ -0,0 +1,2 @@ +module A where +data A = A diff --git a/tests/pre-2.0-tests/A.html.ref b/tests/pre-2.0-tests/A.html.ref new file mode 100644 index 00000000..a58d21df --- /dev/null +++ b/tests/pre-2.0-tests/A.html.ref @@ -0,0 +1,126 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<!--Rendered using the Haskell Html Library v0.2--> +<HTML +><HEAD +><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8" +><TITLE +>A</TITLE +><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css" +><SCRIPT SRC="haddock.js" TYPE="text/javascript" +></SCRIPT +></HEAD +><BODY +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="topbar" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD +><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" " +></TD +><TD CLASS="title" +></TD +><TD CLASS="topbut" +><A HREF="index.html" +>Contents</A +></TD +><TD CLASS="topbut" +><A HREF="doc-index.html" +>Index</A +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="modulebar" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD +><FONT SIZE="6" +>A</FONT +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="section1" +>Documentation</TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>data</SPAN +> <A NAME="t%3AA" +></A +><B +>A</B +> </TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="section4" +>Constructors</TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" +><TR +><TD CLASS="arg" +><A NAME="v%3AA" +></A +><B +>A</B +></TD +><TD CLASS="rdoc" +></TD +></TR +></TABLE +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="botbar" +>Produced by <A HREF="http://www.haskell.org/haddock/" +>Haddock</A +> version 2.0</TD +></TR +></TABLE +></BODY +></HTML +> diff --git a/tests/pre-2.0-tests/B.hs b/tests/pre-2.0-tests/B.hs new file mode 100644 index 00000000..3a31507e --- /dev/null +++ b/tests/pre-2.0-tests/B.hs @@ -0,0 +1,2 @@ +module B ( module A ) where +import A diff --git a/tests/pre-2.0-tests/B.html.ref b/tests/pre-2.0-tests/B.html.ref new file mode 100644 index 00000000..3941c201 --- /dev/null +++ b/tests/pre-2.0-tests/B.html.ref @@ -0,0 +1,96 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<!--Rendered using the Haskell Html Library v0.2--> +<HTML +><HEAD +><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8" +><TITLE +>B</TITLE +><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css" +><SCRIPT SRC="haddock.js" TYPE="text/javascript" +></SCRIPT +></HEAD +><BODY +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="topbar" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD +><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" " +></TD +><TD CLASS="title" +></TD +><TD CLASS="topbut" +><A HREF="index.html" +>Contents</A +></TD +><TD CLASS="topbut" +><A HREF="doc-index.html" +>Index</A +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="modulebar" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD +><FONT SIZE="6" +>B</FONT +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="section1" +>Documentation</TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +>module <A HREF="A.html" +>A</A +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="botbar" +>Produced by <A HREF="http://www.haskell.org/haddock/" +>Haddock</A +> version 2.0</TD +></TR +></TABLE +></BODY +></HTML +> diff --git a/tests/pre-2.0-tests/Bug1.hs b/tests/pre-2.0-tests/Bug1.hs new file mode 100644 index 00000000..af1ed4d3 --- /dev/null +++ b/tests/pre-2.0-tests/Bug1.hs @@ -0,0 +1,6 @@ +module Bug1 where + +-- | We should have different anchors for constructors and types\/classes. This +-- hyperlink should point to the type constructor by default: 'T'. +data T = T + diff --git a/tests/pre-2.0-tests/Bug1.html.ref b/tests/pre-2.0-tests/Bug1.html.ref new file mode 100644 index 00000000..e2b9f4fc --- /dev/null +++ b/tests/pre-2.0-tests/Bug1.html.ref @@ -0,0 +1,160 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<!--Rendered using the Haskell Html Library v0.2--> +<HTML +><HEAD +><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8" +><TITLE +>Bug1</TITLE +><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css" +><SCRIPT SRC="haddock.js" TYPE="text/javascript" +></SCRIPT +></HEAD +><BODY +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="topbar" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD +><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" " +></TD +><TD CLASS="title" +></TD +><TD CLASS="topbut" +><A HREF="index.html" +>Contents</A +></TD +><TD CLASS="topbut" +><A HREF="doc-index.html" +>Index</A +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="modulebar" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD +><FONT SIZE="6" +>Bug1</FONT +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="section1" +>Synopsis</TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>data</SPAN +> <A HREF="#t%3AT" +>T</A +> = <A HREF="#v%3AT" +>T</A +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="section1" +>Documentation</TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>data</SPAN +> <A NAME="t%3AT" +></A +><B +>T</B +> </TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="ndoc" +>We should have different anchors for constructors and types/classes. This + hyperlink should point to the type constructor by default: <TT +><A HREF="Bug1.html#t%3AT" +>T</A +></TT +>. +</TD +></TR +><TR +><TD CLASS="section4" +>Constructors</TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" +><TR +><TD CLASS="arg" +><A NAME="v%3AT" +></A +><B +>T</B +></TD +><TD CLASS="rdoc" +></TD +></TR +></TABLE +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="botbar" +>Produced by <A HREF="http://www.haskell.org/haddock/" +>Haddock</A +> version 2.0</TD +></TR +></TABLE +></BODY +></HTML +> diff --git a/tests/pre-2.0-tests/Bug2.hs b/tests/pre-2.0-tests/Bug2.hs new file mode 100644 index 00000000..9121922e --- /dev/null +++ b/tests/pre-2.0-tests/Bug2.hs @@ -0,0 +1,4 @@ +module Bug2 ( x ) where +import B +x :: A +x = A diff --git a/tests/pre-2.0-tests/Bug2.html.ref b/tests/pre-2.0-tests/Bug2.html.ref new file mode 100644 index 00000000..6c9cdef0 --- /dev/null +++ b/tests/pre-2.0-tests/Bug2.html.ref @@ -0,0 +1,100 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<!--Rendered using the Haskell Html Library v0.2--> +<HTML +><HEAD +><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8" +><TITLE +>Bug2</TITLE +><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css" +><SCRIPT SRC="haddock.js" TYPE="text/javascript" +></SCRIPT +></HEAD +><BODY +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="topbar" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD +><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" " +></TD +><TD CLASS="title" +></TD +><TD CLASS="topbut" +><A HREF="index.html" +>Contents</A +></TD +><TD CLASS="topbut" +><A HREF="doc-index.html" +>Index</A +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="modulebar" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD +><FONT SIZE="6" +>Bug2</FONT +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="section1" +>Documentation</TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><A NAME="v%3Ax" +></A +><B +>x</B +> :: <A HREF="A.html#t%3AA" +>A</A +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="botbar" +>Produced by <A HREF="http://www.haskell.org/haddock/" +>Haddock</A +> version 2.0</TD +></TR +></TABLE +></BODY +></HTML +> diff --git a/tests/pre-2.0-tests/Bug3.hs b/tests/pre-2.0-tests/Bug3.hs new file mode 100644 index 00000000..67e57892 --- /dev/null +++ b/tests/pre-2.0-tests/Bug3.hs @@ -0,0 +1,6 @@ +module Bug3 where + +-- | /multi-line +-- emphasis/ +foo :: Int +foo = undefined diff --git a/tests/pre-2.0-tests/Bug3.html.ref b/tests/pre-2.0-tests/Bug3.html.ref new file mode 100644 index 00000000..faba373b --- /dev/null +++ b/tests/pre-2.0-tests/Bug3.html.ref @@ -0,0 +1,126 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<!--Rendered using the Haskell Html Library v0.2--> +<HTML +><HEAD +><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8" +><TITLE +>Bug3</TITLE +><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css" +><SCRIPT SRC="haddock.js" TYPE="text/javascript" +></SCRIPT +></HEAD +><BODY +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="topbar" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD +><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" " +></TD +><TD CLASS="title" +></TD +><TD CLASS="topbut" +><A HREF="index.html" +>Contents</A +></TD +><TD CLASS="topbut" +><A HREF="doc-index.html" +>Index</A +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="modulebar" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD +><FONT SIZE="6" +>Bug3</FONT +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="section1" +>Synopsis</TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="decl" +><A HREF="#v%3Afoo" +>foo</A +> :: Int</TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="section1" +>Documentation</TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><A NAME="v%3Afoo" +></A +><B +>foo</B +> :: Int</TD +></TR +><TR +><TD CLASS="doc" +><EM +>multi-line + emphasis</EM +> +</TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="botbar" +>Produced by <A HREF="http://www.haskell.org/haddock/" +>Haddock</A +> version 2.0</TD +></TR +></TABLE +></BODY +></HTML +> diff --git a/tests/pre-2.0-tests/Bug4.hs b/tests/pre-2.0-tests/Bug4.hs new file mode 100644 index 00000000..425a77aa --- /dev/null +++ b/tests/pre-2.0-tests/Bug4.hs @@ -0,0 +1,5 @@ +module Bug4 where +-- | don't use apostrophe's in the wrong place's +foo :: Int +foo = undefined + diff --git a/tests/pre-2.0-tests/Bug4.html.ref b/tests/pre-2.0-tests/Bug4.html.ref new file mode 100644 index 00000000..ec82a2c4 --- /dev/null +++ b/tests/pre-2.0-tests/Bug4.html.ref @@ -0,0 +1,123 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<!--Rendered using the Haskell Html Library v0.2--> +<HTML +><HEAD +><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8" +><TITLE +>Bug4</TITLE +><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css" +><SCRIPT SRC="haddock.js" TYPE="text/javascript" +></SCRIPT +></HEAD +><BODY +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="topbar" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD +><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" " +></TD +><TD CLASS="title" +></TD +><TD CLASS="topbut" +><A HREF="index.html" +>Contents</A +></TD +><TD CLASS="topbut" +><A HREF="doc-index.html" +>Index</A +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="modulebar" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD +><FONT SIZE="6" +>Bug4</FONT +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="section1" +>Synopsis</TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="decl" +><A HREF="#v%3Afoo" +>foo</A +> :: Int</TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="section1" +>Documentation</TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><A NAME="v%3Afoo" +></A +><B +>foo</B +> :: Int</TD +></TR +><TR +><TD CLASS="doc" +>don't use apostrophe's in the wrong place's +</TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="botbar" +>Produced by <A HREF="http://www.haskell.org/haddock/" +>Haddock</A +> version 2.0</TD +></TR +></TABLE +></BODY +></HTML +> diff --git a/tests/pre-2.0-tests/Bug6.hs b/tests/pre-2.0-tests/Bug6.hs new file mode 100644 index 00000000..498983df --- /dev/null +++ b/tests/pre-2.0-tests/Bug6.hs @@ -0,0 +1,23 @@ +-- | Exporting records. +module Bug6( A(A), B(B), b, C(C,c1,c2), D(D,d1), E(E) ) where + +-- | +-- This record is exported without its field +data A = A { a :: Int } + +-- | +-- .. with its field, but the field is named separately in the export list +-- (should still be visible as a field name) +data B = B { b :: Int } + +-- | +-- .. with fields names as subordinate names in the export +data C = C { c1 :: Int, c2 :: Int } + +-- | +-- .. with only some of the fields exported (we can't handle this one - +-- how do we render the declaration?) +data D = D { d1 :: Int, d2 :: Int } + +-- | a newtype with a field +newtype E = E { e :: Int } diff --git a/tests/pre-2.0-tests/Bug6.html.ref b/tests/pre-2.0-tests/Bug6.html.ref new file mode 100644 index 00000000..b804ac7a --- /dev/null +++ b/tests/pre-2.0-tests/Bug6.html.ref @@ -0,0 +1,492 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<!--Rendered using the Haskell Html Library v0.2--> +<HTML +><HEAD +><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8" +><TITLE +>Bug6</TITLE +><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css" +><SCRIPT SRC="haddock.js" TYPE="text/javascript" +></SCRIPT +></HEAD +><BODY +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="topbar" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD +><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" " +></TD +><TD CLASS="title" +></TD +><TD CLASS="topbut" +><A HREF="index.html" +>Contents</A +></TD +><TD CLASS="topbut" +><A HREF="doc-index.html" +>Index</A +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="modulebar" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD +><FONT SIZE="6" +>Bug6</FONT +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="section1" +>Description</TD +></TR +><TR +><TD CLASS="doc" +>Exporting records. +</TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="section1" +>Synopsis</TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>data</SPAN +> <A HREF="#t%3AA" +>A</A +> = <A HREF="#v%3AA" +>A</A +> Int</TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>data</SPAN +> <A HREF="#t%3AB" +>B</A +> = <A HREF="#v%3AB" +>B</A +> {<TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="recfield" +><A HREF="#v%3Ab" +>b</A +> :: Int</TD +></TR +></TABLE +>}</TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="decl" +><A HREF="#v%3Ab" +>b</A +> :: <A HREF="Bug6.html#t%3AB" +>B</A +> -> Int</TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>data</SPAN +> <A HREF="#t%3AC" +>C</A +> = <A HREF="#v%3AC" +>C</A +> {<TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="recfield" +><A HREF="#v%3Ac1" +>c1</A +> :: Int</TD +></TR +><TR +><TD CLASS="recfield" +><A HREF="#v%3Ac2" +>c2</A +> :: Int</TD +></TR +></TABLE +>}</TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>data</SPAN +> <A HREF="#t%3AD" +>D</A +> = <A HREF="#v%3AD" +>D</A +> Int Int</TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>newtype</SPAN +> <A HREF="#t%3AE" +>E</A +> = <A HREF="#v%3AE" +>E</A +> Int</TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="section1" +>Documentation</TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>data</SPAN +> <A NAME="t%3AA" +></A +><B +>A</B +> </TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="ndoc" +>This record is exported without its field +</TD +></TR +><TR +><TD CLASS="section4" +>Constructors</TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" +><TR +><TD CLASS="arg" +><A NAME="v%3AA" +></A +><B +>A</B +> Int</TD +><TD CLASS="rdoc" +></TD +></TR +></TABLE +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>data</SPAN +> <A NAME="t%3AB" +></A +><B +>B</B +> </TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="ndoc" +>.. with its field, but the field is named separately in the export list + (should still be visible as a field name) +</TD +></TR +><TR +><TD CLASS="section4" +>Constructors</TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="5" CELLPADDING="0" +><TR +><TD CLASS="arg" +><A NAME="v%3AB" +></A +><B +>B</B +></TD +><TD CLASS="rdoc" +></TD +></TR +><TR +><TD CLASS="body" COLSPAN="2" +><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" +><TR +><TD CLASS="arg" +><A NAME="v%3Ab" +></A +><B +>b</B +> :: Int</TD +><TD CLASS="rdoc" +></TD +></TR +></TABLE +></TD +></TR +></TABLE +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><A NAME="v%3Ab" +></A +><B +>b</B +> :: <A HREF="Bug6.html#t%3AB" +>B</A +> -> Int</TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>data</SPAN +> <A NAME="t%3AC" +></A +><B +>C</B +> </TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="ndoc" +>.. with fields names as subordinate names in the export +</TD +></TR +><TR +><TD CLASS="section4" +>Constructors</TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="5" CELLPADDING="0" +><TR +><TD CLASS="arg" +><A NAME="v%3AC" +></A +><B +>C</B +></TD +><TD CLASS="rdoc" +></TD +></TR +><TR +><TD CLASS="body" COLSPAN="2" +><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" +><TR +><TD CLASS="arg" +><A NAME="v%3Ac1" +></A +><B +>c1</B +> :: Int</TD +><TD CLASS="rdoc" +></TD +></TR +><TR +><TD CLASS="arg" +><A NAME="v%3Ac2" +></A +><B +>c2</B +> :: Int</TD +><TD CLASS="rdoc" +></TD +></TR +></TABLE +></TD +></TR +></TABLE +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>data</SPAN +> <A NAME="t%3AD" +></A +><B +>D</B +> </TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="ndoc" +>.. with only some of the fields exported (we can't handle this one - + how do we render the declaration?) +</TD +></TR +><TR +><TD CLASS="section4" +>Constructors</TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" +><TR +><TD CLASS="arg" +><A NAME="v%3AD" +></A +><B +>D</B +> Int Int</TD +><TD CLASS="rdoc" +></TD +></TR +></TABLE +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>newtype</SPAN +> <A NAME="t%3AE" +></A +><B +>E</B +> </TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="ndoc" +>a newtype with a field +</TD +></TR +><TR +><TD CLASS="section4" +>Constructors</TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" +><TR +><TD CLASS="arg" +><A NAME="v%3AE" +></A +><B +>E</B +> Int</TD +><TD CLASS="rdoc" +></TD +></TR +></TABLE +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="botbar" +>Produced by <A HREF="http://www.haskell.org/haddock/" +>Haddock</A +> version 2.0</TD +></TR +></TABLE +></BODY +></HTML +> diff --git a/tests/pre-2.0-tests/Bug7.hs b/tests/pre-2.0-tests/Bug7.hs new file mode 100644 index 00000000..8cf57914 --- /dev/null +++ b/tests/pre-2.0-tests/Bug7.hs @@ -0,0 +1,12 @@ +-- | This module caused a duplicate instance in the documentation for the Foo +-- type. +module Bug7 where + +-- | The Foo datatype +data Foo = Foo + +-- | The Bar class +class Bar x y + +-- | Just one instance +instance Bar Foo Foo diff --git a/tests/pre-2.0-tests/Bug7.html.ref b/tests/pre-2.0-tests/Bug7.html.ref new file mode 100644 index 00000000..86c61303 --- /dev/null +++ b/tests/pre-2.0-tests/Bug7.html.ref @@ -0,0 +1,252 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<!--Rendered using the Haskell Html Library v0.2--> +<HTML +><HEAD +><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8" +><TITLE +>Bug7</TITLE +><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css" +><SCRIPT SRC="haddock.js" TYPE="text/javascript" +></SCRIPT +></HEAD +><BODY +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="topbar" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD +><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" " +></TD +><TD CLASS="title" +></TD +><TD CLASS="topbut" +><A HREF="index.html" +>Contents</A +></TD +><TD CLASS="topbut" +><A HREF="doc-index.html" +>Index</A +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="modulebar" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD +><FONT SIZE="6" +>Bug7</FONT +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="section1" +>Description</TD +></TR +><TR +><TD CLASS="doc" +>This module caused a duplicate instance in the documentation for the Foo + type. +</TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="section1" +>Synopsis</TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>data</SPAN +> <A HREF="#t%3AFoo" +>Foo</A +> = <A HREF="#v%3AFoo" +>Foo</A +></TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>class</SPAN +> <A HREF="#t%3ABar" +>Bar</A +> x y </TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="section1" +>Documentation</TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>data</SPAN +> <A NAME="t%3AFoo" +></A +><B +>Foo</B +> </TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="ndoc" +>The Foo datatype +</TD +></TR +><TR +><TD CLASS="section4" +>Constructors</TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" +><TR +><TD CLASS="arg" +><A NAME="v%3AFoo" +></A +><B +>Foo</B +></TD +><TD CLASS="rdoc" +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="section4" +><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:Foo')" ALT="show/hide" +> Instances</TD +></TR +><TR +><TD CLASS="body" +><DIV ID="i:Foo" STYLE="display:block;" +><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" +><TR +><TD CLASS="decl" +><A HREF="Bug7.html#t%3ABar" +>Bar</A +> <A HREF="Bug7.html#t%3AFoo" +>Foo</A +> <A HREF="Bug7.html#t%3AFoo" +>Foo</A +></TD +></TR +></TABLE +></DIV +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>class</SPAN +> <A NAME="t%3ABar" +></A +><B +>Bar</B +> x y </TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="ndoc" +>The Bar class +</TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="section4" +><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:Bar')" ALT="show/hide" +> Instances</TD +></TR +><TR +><TD CLASS="body" +><DIV ID="i:Bar" STYLE="display:block;" +><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" +><TR +><TD CLASS="decl" +><A HREF="Bug7.html#t%3ABar" +>Bar</A +> <A HREF="Bug7.html#t%3AFoo" +>Foo</A +> <A HREF="Bug7.html#t%3AFoo" +>Foo</A +></TD +></TR +></TABLE +></DIV +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="botbar" +>Produced by <A HREF="http://www.haskell.org/haddock/" +>Haddock</A +> version 2.0</TD +></TR +></TABLE +></BODY +></HTML +> diff --git a/tests/pre-2.0-tests/Bug8.hs b/tests/pre-2.0-tests/Bug8.hs new file mode 100644 index 00000000..0f279c29 --- /dev/null +++ b/tests/pre-2.0-tests/Bug8.hs @@ -0,0 +1,17 @@ +{- Note that declarations without type signatures are not included in the + documentation. They could be, but that's a missing feature. -} + +module Bug8 where + +infix --> +infix ---> + +data Typ = Type (String,[Typ]) + | TFree (String, [String]) + +x --> y = Type("fun",[s,t]) +(--->) = flip $ foldr (-->) + +s = undefined +t = undefined +main = undefined diff --git a/tests/pre-2.0-tests/Bug8.html.ref b/tests/pre-2.0-tests/Bug8.html.ref new file mode 100644 index 00000000..a0de3438 --- /dev/null +++ b/tests/pre-2.0-tests/Bug8.html.ref @@ -0,0 +1,138 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<!--Rendered using the Haskell Html Library v0.2--> +<HTML +><HEAD +><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8" +><TITLE +>Bug8</TITLE +><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css" +><SCRIPT SRC="haddock.js" TYPE="text/javascript" +></SCRIPT +></HEAD +><BODY +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="topbar" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD +><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" " +></TD +><TD CLASS="title" +></TD +><TD CLASS="topbut" +><A HREF="index.html" +>Contents</A +></TD +><TD CLASS="topbut" +><A HREF="doc-index.html" +>Index</A +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="modulebar" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD +><FONT SIZE="6" +>Bug8</FONT +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="section1" +>Documentation</TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>data</SPAN +> <A NAME="t%3ATyp" +></A +><B +>Typ</B +> </TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="section4" +>Constructors</TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" +><TR +><TD CLASS="arg" +><A NAME="v%3AType" +></A +><B +>Type</B +> (String, [<A HREF="Bug8.html#t%3ATyp" +>Typ</A +>])</TD +><TD CLASS="rdoc" +></TD +></TR +><TR +><TD CLASS="arg" +><A NAME="v%3ATFree" +></A +><B +>TFree</B +> (String, [String])</TD +><TD CLASS="rdoc" +></TD +></TR +></TABLE +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="botbar" +>Produced by <A HREF="http://www.haskell.org/haddock/" +>Haddock</A +> version 2.0</TD +></TR +></TABLE +></BODY +></HTML +> diff --git a/tests/pre-2.0-tests/Hash.hs b/tests/pre-2.0-tests/Hash.hs new file mode 100644 index 00000000..7d6506f9 --- /dev/null +++ b/tests/pre-2.0-tests/Hash.hs @@ -0,0 +1,51 @@ +{- | + Implementation of fixed-size hash tables, with a type + class for constructing hash values for structured types. +-} +module Hash ( + -- * The @HashTable@ type + HashTable, + + -- ** Operations on @HashTable@s + new, insert, lookup, + + -- * The @Hash@ class + Hash(..), + ) where + +import Array +import Prelude hiding (lookup) + +-- | A hash table with keys of type @key@ and values of type @val@. +-- The type @key@ should be an instance of 'Eq'. +data HashTable key val = HashTable Int (Array Int [(key,val)]) + +-- | Builds a new hash table with a given size +new :: (Eq key, Hash key) => Int -> IO (HashTable key val) +new = undefined + +-- | Inserts a new element into the hash table +insert :: (Eq key, Hash key) => key -> val -> IO () +insert = undefined + +-- | Looks up a key in the hash table, returns @'Just' val@ if the key +-- was found, or 'Nothing' otherwise. +lookup :: Hash key => key -> IO (Maybe val) +lookup = undefined + +-- | A class of types which can be hashed. +class Hash a where + -- | hashes the value of type @a@ into an 'Int' + hash :: a -> Int + +instance Hash Int where + hash = id + +instance Hash Float where + hash = trunc + +instance (Hash a, Hash b) => Hash (a,b) where + hash (a,b) = hash a `xor` hash b + +trunc = undefined +xor = undefined diff --git a/tests/pre-2.0-tests/Hash.html.ref b/tests/pre-2.0-tests/Hash.html.ref new file mode 100644 index 00000000..0e2b6d20 --- /dev/null +++ b/tests/pre-2.0-tests/Hash.html.ref @@ -0,0 +1,451 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<!--Rendered using the Haskell Html Library v0.2--> +<HTML +><HEAD +><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8" +><TITLE +>Hash</TITLE +><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css" +><SCRIPT SRC="haddock.js" TYPE="text/javascript" +></SCRIPT +></HEAD +><BODY +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="topbar" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD +><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" " +></TD +><TD CLASS="title" +></TD +><TD CLASS="topbut" +><A HREF="index.html" +>Contents</A +></TD +><TD CLASS="topbut" +><A HREF="doc-index.html" +>Index</A +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="modulebar" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD +><FONT SIZE="6" +>Hash</FONT +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="section4" +><B +>Contents</B +></TD +></TR +><TR +><TD +><DL +><DT +><A HREF="#1" +>The <TT +>HashTable</TT +> type +</A +></DT +><DD +><DL +><DT +><A HREF="#2" +>Operations on <TT +>HashTable</TT +>s +</A +></DT +></DL +></DD +><DT +><A HREF="#3" +>The <TT +>Hash</TT +> class +</A +></DT +></DL +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="section1" +>Description</TD +></TR +><TR +><TD CLASS="doc" +>Implementation of fixed-size hash tables, with a type + class for constructing hash values for structured types. +</TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="section1" +>Synopsis</TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>data</SPAN +> <A HREF="#t%3AHashTable" +>HashTable</A +> key val</TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="decl" +><A HREF="#v%3Anew" +>new</A +> :: (Eq key, <A HREF="Hash.html#t%3AHash" +>Hash</A +> key) => Int -> IO (<A HREF="Hash.html#t%3AHashTable" +>HashTable</A +> key val)</TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="decl" +><A HREF="#v%3Ainsert" +>insert</A +> :: (Eq key, <A HREF="Hash.html#t%3AHash" +>Hash</A +> key) => key -> val -> IO ()</TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="decl" +><A HREF="#v%3Alookup" +>lookup</A +> :: <A HREF="Hash.html#t%3AHash" +>Hash</A +> key => key -> IO (Maybe val)</TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>class</SPAN +> <A HREF="#t%3AHash" +>Hash</A +> a <SPAN CLASS="keyword" +>where</SPAN +></TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="decl" +><A HREF="#v%3Ahash" +>hash</A +> :: a -> Int</TD +></TR +></TABLE +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="section1" +><A NAME="1" +>The <TT +>HashTable</TT +> type +</A +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>data</SPAN +> <A NAME="t%3AHashTable" +></A +><B +>HashTable</B +> key val </TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="ndoc" +>A hash table with keys of type <TT +>key</TT +> and values of type <TT +>val</TT +>. + The type <TT +>key</TT +> should be an instance of <TT +>Eq</TT +>. +</TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="section2" +><A NAME="2" +>Operations on <TT +>HashTable</TT +>s +</A +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><A NAME="v%3Anew" +></A +><B +>new</B +> :: (Eq key, <A HREF="Hash.html#t%3AHash" +>Hash</A +> key) => Int -> IO (<A HREF="Hash.html#t%3AHashTable" +>HashTable</A +> key val)</TD +></TR +><TR +><TD CLASS="doc" +>Builds a new hash table with a given size +</TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><A NAME="v%3Ainsert" +></A +><B +>insert</B +> :: (Eq key, <A HREF="Hash.html#t%3AHash" +>Hash</A +> key) => key -> val -> IO ()</TD +></TR +><TR +><TD CLASS="doc" +>Inserts a new element into the hash table +</TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><A NAME="v%3Alookup" +></A +><B +>lookup</B +> :: <A HREF="Hash.html#t%3AHash" +>Hash</A +> key => key -> IO (Maybe val)</TD +></TR +><TR +><TD CLASS="doc" +>Looks up a key in the hash table, returns <TT +><TT +>Just</TT +> val</TT +> if the key + was found, or <TT +>Nothing</TT +> otherwise. +</TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="section1" +><A NAME="3" +>The <TT +>Hash</TT +> class +</A +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>class</SPAN +> <A NAME="t%3AHash" +></A +><B +>Hash</B +> a <SPAN CLASS="keyword" +>where</SPAN +></TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="ndoc" +>A class of types which can be hashed. +</TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="section4" +>Methods</TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="decl" +><A NAME="v%3Ahash" +></A +><B +>hash</B +> :: a -> Int</TD +></TR +><TR +><TD CLASS="doc" +>hashes the value of type <TT +>a</TT +> into an <TT +>Int</TT +> +</TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="section4" +><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:Hash')" ALT="show/hide" +> Instances</TD +></TR +><TR +><TD CLASS="body" +><DIV ID="i:Hash" STYLE="display:block;" +><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" +><TR +><TD CLASS="decl" +><A HREF="Hash.html#t%3AHash" +>Hash</A +> Float</TD +></TR +><TR +><TD CLASS="decl" +><A HREF="Hash.html#t%3AHash" +>Hash</A +> Int</TD +></TR +><TR +><TD CLASS="decl" +>(<A HREF="Hash.html#t%3AHash" +>Hash</A +> a, <A HREF="Hash.html#t%3AHash" +>Hash</A +> b) => <A HREF="Hash.html#t%3AHash" +>Hash</A +> ((,) a b)</TD +></TR +></TABLE +></DIV +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="botbar" +>Produced by <A HREF="http://www.haskell.org/haddock/" +>Haddock</A +> version 2.0</TD +></TR +></TABLE +></BODY +></HTML +> diff --git a/tests/pre-2.0-tests/Hidden.hs b/tests/pre-2.0-tests/Hidden.hs new file mode 100644 index 00000000..ce93558c --- /dev/null +++ b/tests/pre-2.0-tests/Hidden.hs @@ -0,0 +1,4 @@ +{-# DOC_OPTIONS hide #-} +module Hidden where +hidden :: Int -> Int +hidden a = a diff --git a/tests/pre-2.0-tests/NoLayout.hs b/tests/pre-2.0-tests/NoLayout.hs new file mode 100644 index 00000000..ac8e58bb --- /dev/null +++ b/tests/pre-2.0-tests/NoLayout.hs @@ -0,0 +1,12 @@ + +-- Haddock comments are parsed as separate declarations so we +-- need to insert a ';' when using them with explicit layout. +-- This should probably be changed. + +module NoLayout where { + -- | the class 'C' + ; + g :: Int; + g = undefined + } + diff --git a/tests/pre-2.0-tests/NoLayout.html.ref b/tests/pre-2.0-tests/NoLayout.html.ref new file mode 100644 index 00000000..1440664b --- /dev/null +++ b/tests/pre-2.0-tests/NoLayout.html.ref @@ -0,0 +1,123 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<!--Rendered using the Haskell Html Library v0.2--> +<HTML +><HEAD +><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8" +><TITLE +>NoLayout</TITLE +><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css" +><SCRIPT SRC="haddock.js" TYPE="text/javascript" +></SCRIPT +></HEAD +><BODY +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="topbar" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD +><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" " +></TD +><TD CLASS="title" +></TD +><TD CLASS="topbut" +><A HREF="index.html" +>Contents</A +></TD +><TD CLASS="topbut" +><A HREF="doc-index.html" +>Index</A +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="modulebar" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD +><FONT SIZE="6" +>NoLayout</FONT +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="section1" +>Synopsis</TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="decl" +><A HREF="#v%3Ag" +>g</A +> :: Int</TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="section1" +>Documentation</TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><A NAME="v%3Ag" +></A +><B +>g</B +> :: Int</TD +></TR +><TR +><TD CLASS="doc" +>the class C +</TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="botbar" +>Produced by <A HREF="http://www.haskell.org/haddock/" +>Haddock</A +> version 2.0</TD +></TR +></TABLE +></BODY +></HTML +> diff --git a/tests/pre-2.0-tests/Test.hs b/tests/pre-2.0-tests/Test.hs new file mode 100644 index 00000000..230f32d8 --- /dev/null +++ b/tests/pre-2.0-tests/Test.hs @@ -0,0 +1,410 @@ +----------------------------------------------------------------------------- +-- | +-- Module : Test +-- Copyright : (c) Simon Marlow 2002 +-- License : BSD-style +-- +-- Maintainer : libraries@haskell.org +-- Stability : provisional +-- Portability : portable +-- +-- This module illustrates & tests most of the features of Haddock. +-- Testing references from the description: 'T', 'f', 'g', 'Visible.visible'. +-- +----------------------------------------------------------------------------- + +-- This is plain comment, ignored by Haddock. + +module Test ( + + -- Section headings are introduced with '-- *': + -- * Type declarations + + -- Subsection headings are introduced with '-- **' and so on. + -- ** Data types + T(..), T2, T3(..), T4(..), T5(..), T6(..), + N1(..), N2(..), N3(..), N4, N5(..), N6(..), N7(..), + + -- ** Records + R(..), R1(..), + + -- | test that we can export record selectors on their own: + p, q, u, + + -- * Class declarations + C(a,b), D(..), E, F(..), + + -- | Test that we can export a class method on its own: + a, + + -- * Function types + f, g, + + -- * Auxiliary stuff + + -- $aux1 + + -- $aux2 + + -- $aux3 + + -- $aux4 + + -- $aux5 + + -- $aux6 + + -- $aux7 + + -- $aux8 + + -- $aux9 + + -- $aux10 + + -- $aux11 + + -- $aux12 + + -- | This is some inline documentation in the export list + -- + -- > a code block using bird-tracks + -- > each line must begin with > (which isn't significant unless it + -- > is at the beginning of the line). + + -- * A hidden module + module Hidden, + + -- * A visible module + module Visible, + + {-| nested-style doc comments -} + + -- * Existential \/ Universal types + Ex(..), + + -- * Type signatures with argument docs + k, l, m, o, + + -- * A section + -- and without an intervening comma: + -- ** A subsection + +{-| + > a literal line + + $ a non /literal/ line $ +-} + + f' + ) where + +import Hidden +import Visible +import Data.Maybe + +bla = Nothing + +-- | This comment applies to the /following/ declaration +-- and it continues until the next non-comment line +data T a b + = A Int (Maybe Float) -- ^ This comment describes the 'A' constructor + | -- | This comment describes the 'B' constructor + B (T a b, T Int Float) -- ^ + +-- | An abstract data declaration +data T2 a b = T2 a b + +-- | A data declaration with no documentation annotations on the constructors +data T3 a b = A1 a | B1 b + +-- A data declaration with no documentation annotations at all +data T4 a b = A2 a | B2 b + +-- A data declaration documentation on the constructors only +data T5 a b + = A3 a -- ^ documents 'A3' + | B3 b -- ^ documents 'B3' + +-- | Testing alternative comment styles +data T6 + -- | This is the doc for 'A4' + = A4 + | B4 + | -- ^ This is the doc for 'B4' + + -- | This is the doc for 'C4' + C4 + +-- | A newtype +newtype N1 a = N1 a + +-- | A newtype with a fieldname +newtype N2 a b = N2 {n :: a b} + +-- | A newtype with a fieldname, documentation on the field +newtype N3 a b = N3 {n3 :: a b -- ^ this is the 'n3' field + } + +-- | An abstract newtype - we show this one as data rather than newtype because +-- the difference isn\'t visible to the programmer for an abstract type. +newtype N4 a b = N4 a + +newtype N5 a b = N5 {n5 :: a b -- ^ no docs on the datatype or the constructor + } + +newtype N6 a b = N6 {n6 :: a b + } + -- ^ docs on the constructor only + +-- | docs on the newtype and the constructor +newtype N7 a b = N7 {n7 :: a b + } + -- ^ The 'N7' constructor + + +class (D a) => C a where + -- |this is a description of the 'a' method + a :: IO a + b :: [a] + -- ^ this is a description of the 'b' method + c :: a -- c is hidden in the export list + +-- ^ This comment applies to the /previous/ declaration (the 'C' class) + +class D a where + d :: T a b + e :: (a,a) +-- ^ This is a class declaration with no separate docs for the methods + +instance D Int where + d = undefined + e = undefined + +-- instance with a qualified class name +instance Test.D Float where + d = undefined + e = undefined + +class E a where + ee :: a +-- ^ This is a class declaration with no methods (or no methods exported) + +-- This is a class declaration with no documentation at all +class F a where + ff :: a + +-- | This is the documentation for the 'R' record, which has four fields, +-- 'p', 'q', 'r', and 's'. +data R = + -- | This is the 'C1' record constructor, with the following fields: + C1 { p :: Int -- ^ This comment applies to the 'p' field + , q :: forall a . a->a -- ^ This comment applies to the 'q' field + , -- | This comment applies to both 'r' and 's' + r,s :: Int + } + | C2 { t :: T1 -> (T2 Int Int)-> (T3 Bool Bool) -> (T4 Float Float) -> T5 () (), + u,v :: Int + } + -- ^ This is the 'C2' record constructor, also with some fields: + +-- | Testing different record commenting styles +data R1 + -- | This is the 'C3' record constructor + = C3 { + -- | The 's1' record selector + s1 :: Int + -- | The 's2' record selector + , s2 :: Int + , s3 :: Int -- NOTE: In the original examples/Test.hs in Haddock, there is an extra "," here. + -- Since GHC doesn't allow that, I have removed it in this file. + -- ^ The 's3' record selector + } + +-- These section headers are only used when there is no export list to +-- give the structure of the documentation: + +-- * This is a section header (level 1) +-- ** This is a section header (level 2) +-- *** This is a section header (level 3) + +{-| +In a comment string we can refer to identifiers in scope with +single quotes like this: 'T', and we can refer to modules by +using double quotes: "Foo". We can add emphasis /like this/. + + * This is a bulleted list + + - This is the next item (different kind of bullet) + + (1) This is an ordered list + + 2. This is the next item (different kind of bullet) + +@ + This is a block of code, which can include other markup: 'R' + formatting + is + significant +@ + +> this is another block of code + +We can also include URLs in documentation: <http://www.haskell.org/>. +-} + +f :: C a => a -> Int + +-- | we can export foreign declarations too +foreign import ccall g :: Int -> IO CInt + +-- | this doc string has a parse error in it: \' +h :: Int +h = 42 + + +-- $aux1 This is some documentation that is attached to a name ($aux1) +-- rather than a source declaration. The documentation may be +-- referred to in the export list using its name. +-- +-- @ code block in named doc @ + +-- $aux2 This is some documentation that is attached to a name ($aux2) + +-- $aux3 +-- @ code block on its own in named doc @ + +-- $aux4 +-- +-- @ code block on its own in named doc (after newline) @ + +{- $aux5 a nested, named doc comment + + with a paragraph, + + @ and a code block @ +-} + +-- some tests for various arrangements of code blocks: + +{- $aux6 +>test +>test1 + +@ test2 + test3 +@ +-} + +{- $aux7 +@ +test1 +test2 +@ +-} + +{- $aux8 +>test3 +>test4 +-} + +{- $aux9 +@ +test1 +test2 +@ + +>test3 +>test4 +-} + +{- $aux10 +>test3 +>test4 + +@ +test1 +test2 +@ +-} + +-- This one is currently wrong (Haddock 0.4). The @...@ part is +-- interpreted as part of the bird-tracked code block. +{- $aux11 +aux11: + +>test3 +>test4 + +@ +test1 +test2 +@ +-} + +-- $aux12 +-- > foo +-- +-- > bar +-- + +-- | A data-type using existential\/universal types +data Ex a + = forall b . C b => Ex1 b + | forall b . Ex2 b + | forall b . C a => Ex3 b -- NOTE: I have added "forall b" here make GHC accept this file + | Ex4 (forall a . a -> a) + +-- | This is a function with documentation for each argument +k :: T () () -- ^ This argument has type 'T' + -> (T2 Int Int) -- ^ This argument has type 'T2 Int Int' + -> (T3 Bool Bool -> T4 Float Float) -- ^ This argument has type @T3 Bool Bool -> T4 Float Float@ + -> T5 () () -- ^ This argument has a very long description that should + -- hopefully cause some wrapping to happen when it is finally + -- rendered by Haddock in the generated HTML page. + -> IO () -- ^ This is the result type + +-- This function has arg docs but no docs for the function itself +l :: (Int, Int, Float) -- ^ takes a triple + -> Int -- ^ returns an 'Int' + +-- | This function has some arg docs +m :: R + -> N1 () -- ^ one of the arguments + -> IO Int -- ^ and the return value + +-- | This function has some arg docs but not a return value doc + +-- can't use the original name ('n') with GHC +newn :: R -- ^ one of the arguments, an 'R' + -> N1 () -- ^ one of the arguments + -> IO Int +newn = undefined + + +-- | A foreign import with argument docs +foreign import ccall unsafe + o :: Float -- ^ The input float + -> IO Float -- ^ The output float + +-- | We should be able to escape this: \#\#\# + +-- p :: Int +-- can't use the above original definition with GHC +newp :: Int +newp = undefined + +-- | a function with a prime can be referred to as 'f'' +-- but f' doesn't get link'd 'f\'' +f' :: Int + + +-- Add some definitions here so that this file can be compiled with GHC + +data T1 +f = undefined +f' = undefined +type CInt = Int +k = undefined +l = undefined +m = undefined diff --git a/tests/pre-2.0-tests/Test.html.ref b/tests/pre-2.0-tests/Test.html.ref new file mode 100644 index 00000000..738e76d1 --- /dev/null +++ b/tests/pre-2.0-tests/Test.html.ref @@ -0,0 +1,3134 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<!--Rendered using the Haskell Html Library v0.2--> +<HTML +><HEAD +><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8" +><TITLE +>Test</TITLE +><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css" +><SCRIPT SRC="haddock.js" TYPE="text/javascript" +></SCRIPT +></HEAD +><BODY +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="topbar" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD +><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" " +></TD +><TD CLASS="title" +></TD +><TD CLASS="topbut" +><A HREF="index.html" +>Contents</A +></TD +><TD CLASS="topbut" +><A HREF="doc-index.html" +>Index</A +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="modulebar" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD +><FONT SIZE="6" +>Test</FONT +></TD +><TD ALIGN="right" +><TABLE CLASS="narrow" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="infohead" +>Portability</TD +><TD CLASS="infoval" +>portable</TD +></TR +><TR +><TD CLASS="infohead" +>Stability</TD +><TD CLASS="infoval" +>provisional</TD +></TR +><TR +><TD CLASS="infohead" +>Maintainer</TD +><TD CLASS="infoval" +>libraries@haskell.org</TD +></TR +></TABLE +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="section4" +><B +>Contents</B +></TD +></TR +><TR +><TD +><DL +><DT +><A HREF="#1" +>Type declarations +</A +></DT +><DD +><DL +><DT +><A HREF="#2" +>Data types +</A +></DT +><DT +><A HREF="#3" +>Records +</A +></DT +></DL +></DD +><DT +><A HREF="#4" +>Class declarations +</A +></DT +><DT +><A HREF="#5" +>Function types +</A +></DT +><DT +><A HREF="#6" +>Auxiliary stuff +</A +></DT +><DT +><A HREF="#7" +>A hidden module +</A +></DT +><DT +><A HREF="#8" +>A visible module +</A +></DT +><DT +><A HREF="#9" +>Existential / Universal types +</A +></DT +><DT +><A HREF="#10" +>Type signatures with argument docs +</A +></DT +><DT +><A HREF="#11" +>A section +</A +></DT +><DD +><DL +><DT +><A HREF="#12" +>A subsection +</A +></DT +></DL +></DD +></DL +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="section1" +>Description</TD +></TR +><TR +><TD CLASS="doc" +>This module illustrates & tests most of the features of Haddock. + Testing references from the description: <TT +><A HREF="Test.html#t%3AT" +>T</A +></TT +>, <TT +><A HREF="Test.html#v%3Af" +>f</A +></TT +>, <TT +><A HREF="Test.html#v%3Ag" +>g</A +></TT +>, <TT +><A HREF="Visible.html#v%3Avisible" +>visible</A +></TT +>. +</TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="section1" +>Synopsis</TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="decl" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>data</SPAN +> <A HREF="#t%3AT" +>T</A +> a b </TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="decl" +>= <A HREF="#v%3AA" +>A</A +> Int Maybe Float</TD +></TR +><TR +><TD CLASS="decl" +>| <A HREF="#v%3AB" +>B</A +> (<A HREF="Test.html#t%3AT" +>T</A +> a b, <A HREF="Test.html#t%3AT" +>T</A +> Int Float)</TD +></TR +></TABLE +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>data</SPAN +> <A HREF="#t%3AT2" +>T2</A +> a b</TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="decl" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>data</SPAN +> <A HREF="#t%3AT3" +>T3</A +> a b </TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="decl" +>= <A HREF="#v%3AA1" +>A1</A +> a</TD +></TR +><TR +><TD CLASS="decl" +>| <A HREF="#v%3AB1" +>B1</A +> b</TD +></TR +></TABLE +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="decl" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>data</SPAN +> <A HREF="#t%3AT4" +>T4</A +> a b </TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="decl" +>= <A HREF="#v%3AA2" +>A2</A +> a</TD +></TR +><TR +><TD CLASS="decl" +>| <A HREF="#v%3AB2" +>B2</A +> b</TD +></TR +></TABLE +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="decl" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>data</SPAN +> <A HREF="#t%3AT5" +>T5</A +> a b </TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="decl" +>= <A HREF="#v%3AA3" +>A3</A +> a</TD +></TR +><TR +><TD CLASS="decl" +>| <A HREF="#v%3AB3" +>B3</A +> b</TD +></TR +></TABLE +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="decl" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>data</SPAN +> <A HREF="#t%3AT6" +>T6</A +> </TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="decl" +>= <A HREF="#v%3AA4" +>A4</A +></TD +></TR +><TR +><TD CLASS="decl" +>| <A HREF="#v%3AB4" +>B4</A +></TD +></TR +><TR +><TD CLASS="decl" +>| <A HREF="#v%3AC4" +>C4</A +></TD +></TR +></TABLE +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>newtype</SPAN +> <A HREF="#t%3AN1" +>N1</A +> a = <A HREF="#v%3AN1" +>N1</A +> a</TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>newtype</SPAN +> <A HREF="#t%3AN2" +>N2</A +> a b = <A HREF="#v%3AN2" +>N2</A +> {<TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="recfield" +><A HREF="#v%3An" +>n</A +> :: a b</TD +></TR +></TABLE +>}</TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>newtype</SPAN +> <A HREF="#t%3AN3" +>N3</A +> a b = <A HREF="#v%3AN3" +>N3</A +> {<TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="recfield" +><A HREF="#v%3An3" +>n3</A +> :: a b</TD +></TR +></TABLE +>}</TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>data</SPAN +> <A HREF="#t%3AN4" +>N4</A +> a b</TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>newtype</SPAN +> <A HREF="#t%3AN5" +>N5</A +> a b = <A HREF="#v%3AN5" +>N5</A +> {<TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="recfield" +><A HREF="#v%3An5" +>n5</A +> :: a b</TD +></TR +></TABLE +>}</TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>newtype</SPAN +> <A HREF="#t%3AN6" +>N6</A +> a b = <A HREF="#v%3AN6" +>N6</A +> {<TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="recfield" +><A HREF="#v%3An6" +>n6</A +> :: a b</TD +></TR +></TABLE +>}</TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>newtype</SPAN +> <A HREF="#t%3AN7" +>N7</A +> a b = <A HREF="#v%3AN7" +>N7</A +> {<TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="recfield" +><A HREF="#v%3An7" +>n7</A +> :: a b</TD +></TR +></TABLE +>}</TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="decl" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>data</SPAN +> <A HREF="#t%3AR" +>R</A +> </TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="decl" +>= <A HREF="#v%3AC1" +>C1</A +> {<TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="recfield" +><A HREF="#v%3Ap" +>p</A +> :: Int</TD +></TR +><TR +><TD CLASS="recfield" +><A HREF="#v%3Aq" +>q</A +> :: <SPAN CLASS="keyword" +>forall</SPAN +> a. a -> a</TD +></TR +><TR +><TD CLASS="recfield" +><A HREF="#v%3Ar" +>r</A +> :: Int</TD +></TR +><TR +><TD CLASS="recfield" +><A HREF="#v%3As" +>s</A +> :: Int</TD +></TR +></TABLE +>}</TD +></TR +><TR +><TD CLASS="decl" +>| <A HREF="#v%3AC2" +>C2</A +> {<TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="recfield" +><A HREF="#v%3At" +>t</A +> :: T1 -> (<A HREF="Test.html#t%3AT2" +>T2</A +> Int Int) -> (<A HREF="Test.html#t%3AT3" +>T3</A +> Bool Bool) -> (<A HREF="Test.html#t%3AT4" +>T4</A +> Float Float) -> <A HREF="Test.html#t%3AT5" +>T5</A +> () ()</TD +></TR +><TR +><TD CLASS="recfield" +><A HREF="#v%3Au" +>u</A +> :: Int</TD +></TR +><TR +><TD CLASS="recfield" +><A HREF="#v%3Av" +>v</A +> :: Int</TD +></TR +></TABLE +>}</TD +></TR +></TABLE +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>data</SPAN +> <A HREF="#t%3AR1" +>R1</A +> = <A HREF="#v%3AC3" +>C3</A +> {<TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="recfield" +><A HREF="#v%3As1" +>s1</A +> :: Int</TD +></TR +><TR +><TD CLASS="recfield" +><A HREF="#v%3As2" +>s2</A +> :: Int</TD +></TR +><TR +><TD CLASS="recfield" +><A HREF="#v%3As3" +>s3</A +> :: Int</TD +></TR +></TABLE +>}</TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="decl" +><A HREF="#v%3Ap" +>p</A +> :: <A HREF="Test.html#t%3AR" +>R</A +> -> Int</TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="decl" +><A HREF="#v%3Aq" +>q</A +> :: <A HREF="Test.html#t%3AR" +>R</A +> -> <SPAN CLASS="keyword" +>forall</SPAN +> a. a -> a</TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="decl" +><A HREF="#v%3Au" +>u</A +> :: <A HREF="Test.html#t%3AR" +>R</A +> -> Int</TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>class</SPAN +> <A HREF="Test.html#t%3AD" +>D</A +> a => <A HREF="#t%3AC" +>C</A +> a <SPAN CLASS="keyword" +>where</SPAN +></TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="decl" +><A HREF="#v%3Aa" +>a</A +> :: IO a</TD +></TR +><TR +><TD CLASS="decl" +><A HREF="#v%3Ab" +>b</A +> :: [a]</TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>class</SPAN +> <A HREF="#t%3AD" +>D</A +> a <SPAN CLASS="keyword" +>where</SPAN +></TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="decl" +><A HREF="#v%3Ad" +>d</A +> :: <A HREF="Test.html#t%3AT" +>T</A +> a b</TD +></TR +><TR +><TD CLASS="decl" +><A HREF="#v%3Ae" +>e</A +> :: (a, a)</TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>class</SPAN +> <A HREF="#t%3AE" +>E</A +> a </TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>class</SPAN +> <A HREF="#t%3AF" +>F</A +> a <SPAN CLASS="keyword" +>where</SPAN +></TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="decl" +><A HREF="#v%3Aff" +>ff</A +> :: a</TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="decl" +><A HREF="#v%3Aa" +>a</A +> :: <A HREF="Test.html#t%3AC" +>C</A +> a => IO a</TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="decl" +><A HREF="#v%3Af" +>f</A +> :: <A HREF="Test.html#t%3AC" +>C</A +> a => a -> Int</TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="decl" +><A HREF="#v%3Ag" +>g</A +> :: Int -> IO CInt</TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="decl" +><A HREF="#v%3Ahidden" +>hidden</A +> :: Int -> Int</TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="decl" +>module <A HREF="Visible.html" +>Visible</A +></TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="decl" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>data</SPAN +> <A HREF="#t%3AEx" +>Ex</A +> a </TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="decl" +>= <SPAN CLASS="keyword" +>forall</SPAN +> b . <A HREF="Test.html#t%3AC" +>C</A +> b => <A HREF="#v%3AEx1" +>Ex1</A +> b</TD +></TR +><TR +><TD CLASS="decl" +>| <SPAN CLASS="keyword" +>forall</SPAN +> b . <A HREF="#v%3AEx2" +>Ex2</A +> b</TD +></TR +><TR +><TD CLASS="decl" +>| <SPAN CLASS="keyword" +>forall</SPAN +> b . <A HREF="Test.html#t%3AC" +>C</A +> a => <A HREF="#v%3AEx3" +>Ex3</A +> b</TD +></TR +><TR +><TD CLASS="decl" +>| <A HREF="#v%3AEx4" +>Ex4</A +> <SPAN CLASS="keyword" +>forall</SPAN +> a. a -> a</TD +></TR +></TABLE +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="decl" +><A HREF="#v%3Ak" +>k</A +> :: <A HREF="Test.html#t%3AT" +>T</A +> () () -> <A HREF="Test.html#t%3AT2" +>T2</A +> Int Int -> <A HREF="Test.html#t%3AT3" +>T3</A +> Bool Bool -> <A HREF="Test.html#t%3AT4" +>T4</A +> Float Float -> <A HREF="Test.html#t%3AT5" +>T5</A +> () () -> IO ()</TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="decl" +><A HREF="#v%3Al" +>l</A +> :: (Int, Int, Float) -> Int</TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="decl" +><A HREF="#v%3Am" +>m</A +> :: <A HREF="Test.html#t%3AR" +>R</A +> -> <A HREF="Test.html#t%3AN1" +>N1</A +> () -> IO Int</TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="decl" +><A HREF="#v%3Ao" +>o</A +> :: Float -> IO Float</TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="decl" +><A HREF="#v%3Af%27" +>f'</A +> :: Int</TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="section1" +><A NAME="1" +>Type declarations +</A +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="section2" +><A NAME="2" +>Data types +</A +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>data</SPAN +> <A NAME="t%3AT" +></A +><B +>T</B +> a b </TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="ndoc" +>This comment applies to the <EM +>following</EM +> declaration + and it continues until the next non-comment line +</TD +></TR +><TR +><TD CLASS="section4" +>Constructors</TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" +><TR +><TD CLASS="arg" +><A NAME="v%3AA" +></A +><B +>A</B +> Int Maybe Float</TD +><TD CLASS="rdoc" +>This comment describes the <TT +><A HREF="Test.html#v%3AA" +>A</A +></TT +> constructor +</TD +></TR +><TR +><TD CLASS="arg" +><A NAME="v%3AB" +></A +><B +>B</B +> (<A HREF="Test.html#t%3AT" +>T</A +> a b, <A HREF="Test.html#t%3AT" +>T</A +> Int Float)</TD +><TD CLASS="rdoc" +>This comment describes the <TT +><A HREF="Test.html#v%3AB" +>B</A +></TT +> constructor +</TD +></TR +></TABLE +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>data</SPAN +> <A NAME="t%3AT2" +></A +><B +>T2</B +> a b </TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="ndoc" +>An abstract data declaration +</TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>data</SPAN +> <A NAME="t%3AT3" +></A +><B +>T3</B +> a b </TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="ndoc" +>A data declaration with no documentation annotations on the constructors +</TD +></TR +><TR +><TD CLASS="section4" +>Constructors</TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" +><TR +><TD CLASS="arg" +><A NAME="v%3AA1" +></A +><B +>A1</B +> a</TD +><TD CLASS="rdoc" +></TD +></TR +><TR +><TD CLASS="arg" +><A NAME="v%3AB1" +></A +><B +>B1</B +> b</TD +><TD CLASS="rdoc" +></TD +></TR +></TABLE +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>data</SPAN +> <A NAME="t%3AT4" +></A +><B +>T4</B +> a b </TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="section4" +>Constructors</TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" +><TR +><TD CLASS="arg" +><A NAME="v%3AA2" +></A +><B +>A2</B +> a</TD +><TD CLASS="rdoc" +></TD +></TR +><TR +><TD CLASS="arg" +><A NAME="v%3AB2" +></A +><B +>B2</B +> b</TD +><TD CLASS="rdoc" +></TD +></TR +></TABLE +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>data</SPAN +> <A NAME="t%3AT5" +></A +><B +>T5</B +> a b </TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="section4" +>Constructors</TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" +><TR +><TD CLASS="arg" +><A NAME="v%3AA3" +></A +><B +>A3</B +> a</TD +><TD CLASS="rdoc" +>documents <TT +><A HREF="Test.html#v%3AA3" +>A3</A +></TT +> +</TD +></TR +><TR +><TD CLASS="arg" +><A NAME="v%3AB3" +></A +><B +>B3</B +> b</TD +><TD CLASS="rdoc" +>documents <TT +><A HREF="Test.html#v%3AB3" +>B3</A +></TT +> +</TD +></TR +></TABLE +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>data</SPAN +> <A NAME="t%3AT6" +></A +><B +>T6</B +> </TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="ndoc" +>Testing alternative comment styles +</TD +></TR +><TR +><TD CLASS="section4" +>Constructors</TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" +><TR +><TD CLASS="arg" +><A NAME="v%3AA4" +></A +><B +>A4</B +></TD +><TD CLASS="rdoc" +>This is the doc for <TT +><A HREF="Test.html#v%3AA4" +>A4</A +></TT +> +</TD +></TR +><TR +><TD CLASS="arg" +><A NAME="v%3AB4" +></A +><B +>B4</B +></TD +><TD CLASS="rdoc" +>This is the doc for <TT +><A HREF="Test.html#v%3AB4" +>B4</A +></TT +> +</TD +></TR +><TR +><TD CLASS="arg" +><A NAME="v%3AC4" +></A +><B +>C4</B +></TD +><TD CLASS="rdoc" +>This is the doc for <TT +><A HREF="Test.html#v%3AC4" +>C4</A +></TT +> +</TD +></TR +></TABLE +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>newtype</SPAN +> <A NAME="t%3AN1" +></A +><B +>N1</B +> a </TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="ndoc" +>A newtype +</TD +></TR +><TR +><TD CLASS="section4" +>Constructors</TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" +><TR +><TD CLASS="arg" +><A NAME="v%3AN1" +></A +><B +>N1</B +> a</TD +><TD CLASS="rdoc" +></TD +></TR +></TABLE +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>newtype</SPAN +> <A NAME="t%3AN2" +></A +><B +>N2</B +> a b </TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="ndoc" +>A newtype with a fieldname +</TD +></TR +><TR +><TD CLASS="section4" +>Constructors</TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="5" CELLPADDING="0" +><TR +><TD CLASS="arg" +><A NAME="v%3AN2" +></A +><B +>N2</B +></TD +><TD CLASS="rdoc" +></TD +></TR +><TR +><TD CLASS="body" COLSPAN="2" +><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" +><TR +><TD CLASS="arg" +><A NAME="v%3An" +></A +><B +>n</B +> :: a b</TD +><TD CLASS="rdoc" +></TD +></TR +></TABLE +></TD +></TR +></TABLE +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>newtype</SPAN +> <A NAME="t%3AN3" +></A +><B +>N3</B +> a b </TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="ndoc" +>A newtype with a fieldname, documentation on the field +</TD +></TR +><TR +><TD CLASS="section4" +>Constructors</TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="5" CELLPADDING="0" +><TR +><TD CLASS="arg" +><A NAME="v%3AN3" +></A +><B +>N3</B +></TD +><TD CLASS="rdoc" +></TD +></TR +><TR +><TD CLASS="body" COLSPAN="2" +><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" +><TR +><TD CLASS="arg" +><A NAME="v%3An3" +></A +><B +>n3</B +> :: a b</TD +><TD CLASS="rdoc" +>this is the <TT +><A HREF="Test.html#v%3An3" +>n3</A +></TT +> field +</TD +></TR +></TABLE +></TD +></TR +></TABLE +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>data</SPAN +> <A NAME="t%3AN4" +></A +><B +>N4</B +> a b </TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="ndoc" +>An abstract newtype - we show this one as data rather than newtype because + the difference isn't visible to the programmer for an abstract type. +</TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>newtype</SPAN +> <A NAME="t%3AN5" +></A +><B +>N5</B +> a b </TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="section4" +>Constructors</TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="5" CELLPADDING="0" +><TR +><TD CLASS="arg" +><A NAME="v%3AN5" +></A +><B +>N5</B +></TD +><TD CLASS="rdoc" +></TD +></TR +><TR +><TD CLASS="body" COLSPAN="2" +><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" +><TR +><TD CLASS="arg" +><A NAME="v%3An5" +></A +><B +>n5</B +> :: a b</TD +><TD CLASS="rdoc" +>no docs on the datatype or the constructor +</TD +></TR +></TABLE +></TD +></TR +></TABLE +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>newtype</SPAN +> <A NAME="t%3AN6" +></A +><B +>N6</B +> a b </TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="section4" +>Constructors</TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="5" CELLPADDING="0" +><TR +><TD CLASS="arg" +><A NAME="v%3AN6" +></A +><B +>N6</B +></TD +><TD CLASS="rdoc" +>docs on the constructor only +</TD +></TR +><TR +><TD CLASS="body" COLSPAN="2" +><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" +><TR +><TD CLASS="arg" +><A NAME="v%3An6" +></A +><B +>n6</B +> :: a b</TD +><TD CLASS="rdoc" +></TD +></TR +></TABLE +></TD +></TR +></TABLE +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>newtype</SPAN +> <A NAME="t%3AN7" +></A +><B +>N7</B +> a b </TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="ndoc" +>docs on the newtype and the constructor +</TD +></TR +><TR +><TD CLASS="section4" +>Constructors</TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="5" CELLPADDING="0" +><TR +><TD CLASS="arg" +><A NAME="v%3AN7" +></A +><B +>N7</B +></TD +><TD CLASS="rdoc" +>The <TT +><A HREF="Test.html#t%3AN7" +>N7</A +></TT +> constructor +</TD +></TR +><TR +><TD CLASS="body" COLSPAN="2" +><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" +><TR +><TD CLASS="arg" +><A NAME="v%3An7" +></A +><B +>n7</B +> :: a b</TD +><TD CLASS="rdoc" +></TD +></TR +></TABLE +></TD +></TR +></TABLE +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="section2" +><A NAME="3" +>Records +</A +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>data</SPAN +> <A NAME="t%3AR" +></A +><B +>R</B +> </TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="ndoc" +>This is the documentation for the <TT +><A HREF="Test.html#t%3AR" +>R</A +></TT +> record, which has four fields, + <TT +><A HREF="Test.html#v%3Ap" +>p</A +></TT +>, <TT +><A HREF="Test.html#v%3Aq" +>q</A +></TT +>, <TT +><A HREF="Test.html#v%3Ar" +>r</A +></TT +>, and <TT +><A HREF="Test.html#v%3As" +>s</A +></TT +>. +</TD +></TR +><TR +><TD CLASS="section4" +>Constructors</TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="5" CELLPADDING="0" +><TR +><TD CLASS="arg" +><A NAME="v%3AC1" +></A +><B +>C1</B +></TD +><TD CLASS="rdoc" +>This is the <TT +><A HREF="Test.html#v%3AC1" +>C1</A +></TT +> record constructor, with the following fields: +</TD +></TR +><TR +><TD CLASS="body" COLSPAN="2" +><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" +><TR +><TD CLASS="arg" +><A NAME="v%3Ap" +></A +><B +>p</B +> :: Int</TD +><TD CLASS="rdoc" +>This comment applies to the <TT +><A HREF="Test.html#v%3Ap" +>p</A +></TT +> field +</TD +></TR +><TR +><TD CLASS="arg" +><A NAME="v%3Aq" +></A +><B +>q</B +> :: <SPAN CLASS="keyword" +>forall</SPAN +> a. a -> a</TD +><TD CLASS="rdoc" +>This comment applies to the <TT +><A HREF="Test.html#v%3Aq" +>q</A +></TT +> field +</TD +></TR +><TR +><TD CLASS="arg" +><A NAME="v%3Ar" +></A +><B +>r</B +> :: Int</TD +><TD CLASS="rdoc" +>This comment applies to both <TT +><A HREF="Test.html#v%3Ar" +>r</A +></TT +> and <TT +><A HREF="Test.html#v%3As" +>s</A +></TT +> +</TD +></TR +><TR +><TD CLASS="arg" +><A NAME="v%3As" +></A +><B +>s</B +> :: Int</TD +><TD CLASS="rdoc" +>This comment applies to both <TT +><A HREF="Test.html#v%3Ar" +>r</A +></TT +> and <TT +><A HREF="Test.html#v%3As" +>s</A +></TT +> +</TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="arg" +><A NAME="v%3AC2" +></A +><B +>C2</B +></TD +><TD CLASS="rdoc" +>This is the <TT +><A HREF="Test.html#v%3AC2" +>C2</A +></TT +> record constructor, also with some fields: +</TD +></TR +><TR +><TD CLASS="body" COLSPAN="2" +><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" +><TR +><TD CLASS="arg" +><A NAME="v%3At" +></A +><B +>t</B +> :: T1 -> (<A HREF="Test.html#t%3AT2" +>T2</A +> Int Int) -> (<A HREF="Test.html#t%3AT3" +>T3</A +> Bool Bool) -> (<A HREF="Test.html#t%3AT4" +>T4</A +> Float Float) -> <A HREF="Test.html#t%3AT5" +>T5</A +> () ()</TD +><TD CLASS="rdoc" +></TD +></TR +><TR +><TD CLASS="arg" +><A NAME="v%3Au" +></A +><B +>u</B +> :: Int</TD +><TD CLASS="rdoc" +></TD +></TR +><TR +><TD CLASS="arg" +><A NAME="v%3Av" +></A +><B +>v</B +> :: Int</TD +><TD CLASS="rdoc" +></TD +></TR +></TABLE +></TD +></TR +></TABLE +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>data</SPAN +> <A NAME="t%3AR1" +></A +><B +>R1</B +> </TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="ndoc" +>Testing different record commenting styles +</TD +></TR +><TR +><TD CLASS="section4" +>Constructors</TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="5" CELLPADDING="0" +><TR +><TD CLASS="arg" +><A NAME="v%3AC3" +></A +><B +>C3</B +></TD +><TD CLASS="rdoc" +>This is the <TT +><A HREF="Test.html#v%3AC3" +>C3</A +></TT +> record constructor +</TD +></TR +><TR +><TD CLASS="body" COLSPAN="2" +><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" +><TR +><TD CLASS="arg" +><A NAME="v%3As1" +></A +><B +>s1</B +> :: Int</TD +><TD CLASS="rdoc" +>The <TT +><A HREF="Test.html#v%3As1" +>s1</A +></TT +> record selector +</TD +></TR +><TR +><TD CLASS="arg" +><A NAME="v%3As2" +></A +><B +>s2</B +> :: Int</TD +><TD CLASS="rdoc" +>The <TT +><A HREF="Test.html#v%3As2" +>s2</A +></TT +> record selector +</TD +></TR +><TR +><TD CLASS="arg" +><A NAME="v%3As3" +></A +><B +>s3</B +> :: Int</TD +><TD CLASS="rdoc" +>The <TT +><A HREF="Test.html#v%3As3" +>s3</A +></TT +> record selector +</TD +></TR +></TABLE +></TD +></TR +></TABLE +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="doc" +>test that we can export record selectors on their own: +</TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><A NAME="v%3Ap" +></A +><B +>p</B +> :: <A HREF="Test.html#t%3AR" +>R</A +> -> Int</TD +></TR +><TR +><TD CLASS="doc" +>This comment applies to the <TT +><A HREF="Test.html#v%3Ap" +>p</A +></TT +> field +</TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><A NAME="v%3Aq" +></A +><B +>q</B +> :: <A HREF="Test.html#t%3AR" +>R</A +> -> <SPAN CLASS="keyword" +>forall</SPAN +> a. a -> a</TD +></TR +><TR +><TD CLASS="doc" +>This comment applies to the <TT +><A HREF="Test.html#v%3Aq" +>q</A +></TT +> field +</TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><A NAME="v%3Au" +></A +><B +>u</B +> :: <A HREF="Test.html#t%3AR" +>R</A +> -> Int</TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="section1" +><A NAME="4" +>Class declarations +</A +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>class</SPAN +> <A HREF="Test.html#t%3AD" +>D</A +> a => <A NAME="t%3AC" +></A +><B +>C</B +> a <SPAN CLASS="keyword" +>where</SPAN +></TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="ndoc" +>This comment applies to the <EM +>previous</EM +> declaration (the <TT +><A HREF="Test.html#t%3AC" +>C</A +></TT +> class) +</TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="section4" +>Methods</TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="decl" +><A NAME="v%3Aa" +></A +><B +>a</B +> :: IO a</TD +></TR +><TR +><TD CLASS="doc" +>this is a description of the <TT +><A HREF="Test.html#v%3Aa" +>a</A +></TT +> method +</TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="decl" +><A NAME="v%3Ab" +></A +><B +>b</B +> :: [a]</TD +></TR +><TR +><TD CLASS="doc" +>this is a description of the <TT +><A HREF="Test.html#v%3Ab" +>b</A +></TT +> method +</TD +></TR +></TABLE +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>class</SPAN +> <A NAME="t%3AD" +></A +><B +>D</B +> a <SPAN CLASS="keyword" +>where</SPAN +></TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="ndoc" +>This is a class declaration with no separate docs for the methods +</TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="section4" +>Methods</TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="decl" +><A NAME="v%3Ad" +></A +><B +>d</B +> :: <A HREF="Test.html#t%3AT" +>T</A +> a b</TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="decl" +><A NAME="v%3Ae" +></A +><B +>e</B +> :: (a, a)</TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="section4" +><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:D')" ALT="show/hide" +> Instances</TD +></TR +><TR +><TD CLASS="body" +><DIV ID="i:D" STYLE="display:block;" +><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" +><TR +><TD CLASS="decl" +><A HREF="Test.html#t%3AD" +>D</A +> Float</TD +></TR +><TR +><TD CLASS="decl" +><A HREF="Test.html#t%3AD" +>D</A +> Int</TD +></TR +></TABLE +></DIV +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>class</SPAN +> <A NAME="t%3AE" +></A +><B +>E</B +> a </TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="ndoc" +>This is a class declaration with no methods (or no methods exported) +</TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>class</SPAN +> <A NAME="t%3AF" +></A +><B +>F</B +> a <SPAN CLASS="keyword" +>where</SPAN +></TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="s8" +></TD +></TR +><TR +><TD CLASS="section4" +>Methods</TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="decl" +><A NAME="v%3Aff" +></A +><B +>ff</B +> :: a</TD +></TR +></TABLE +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="doc" +>Test that we can export a class method on its own: +</TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><A NAME="v%3Aa" +></A +><B +>a</B +> :: <A HREF="Test.html#t%3AC" +>C</A +> a => IO a</TD +></TR +><TR +><TD CLASS="doc" +>this is a description of the <TT +><A HREF="Test.html#v%3Aa" +>a</A +></TT +> method +</TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="section1" +><A NAME="5" +>Function types +</A +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><A NAME="v%3Af" +></A +><B +>f</B +> :: <A HREF="Test.html#t%3AC" +>C</A +> a => a -> Int</TD +></TR +><TR +><TD CLASS="doc" +><P +>In a comment string we can refer to identifiers in scope with +single quotes like this: <TT +><A HREF="Test.html#t%3AT" +>T</A +></TT +>, and we can refer to modules by +using double quotes: <A HREF="Foo.html" +>Foo</A +>. We can add emphasis <EM +>like this</EM +>. +</P +><UL +><LI +> This is a bulleted list +</LI +><LI +> This is the next item (different kind of bullet) +</LI +></UL +><OL +><LI +> This is an ordered list +</LI +></OL +><P +>2. This is the next item (different kind of bullet) +</P +><PRE +> + This is a block of code, which can include other markup: <TT +><A HREF="Test.html#t%3AR" +>R</A +></TT +> + formatting + is + significant +</PRE +><PRE +> this is another block of code +</PRE +><P +>We can also include URLs in documentation: <A HREF="http://www.haskell.org/" +>http://www.haskell.org/</A +>. +</P +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><A NAME="v%3Ag" +></A +><B +>g</B +> :: Int -> IO CInt</TD +></TR +><TR +><TD CLASS="doc" +>we can export foreign declarations too +</TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="section1" +><A NAME="6" +>Auxiliary stuff +</A +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="doc" +><P +>This is some documentation that is attached to a name ($aux1) + rather than a source declaration. The documentation may be + referred to in the export list using its name. +</P +><PRE +> code block in named doc </PRE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="doc" +>This is some documentation that is attached to a name ($aux2) +</TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="doc" +><PRE +> code block on its own in named doc </PRE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="doc" +><PRE +> code block on its own in named doc (after newline) </PRE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="doc" +><P +>a nested, named doc comment +</P +><P +>with a paragraph, +</P +><PRE +> and a code block </PRE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="doc" +><PRE +>test +test1 +</PRE +><PRE +> test2 + test3 +</PRE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="doc" +><PRE +> +test1 +test2 +</PRE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="doc" +><PRE +>test3 +test4 +</PRE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="doc" +><PRE +> +test1 +test2 +</PRE +><PRE +>test3 +test4 +</PRE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="doc" +><PRE +>test3 +test4 +</PRE +><PRE +> +test1 +test2 +</PRE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="doc" +><P +>aux11: +</P +><PRE +>test3 +test4 +</PRE +><PRE +> +test1 +test2 +</PRE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="doc" +><PRE +> foo +</PRE +><PRE +> bar +</PRE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="doc" +><P +>This is some inline documentation in the export list +</P +><PRE +> a code block using bird-tracks + each line must begin with > (which isn't significant unless it + is at the beginning of the line). +</PRE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="section1" +><A NAME="7" +>A hidden module +</A +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><A NAME="v%3Ahidden" +></A +><B +>hidden</B +> :: Int -> Int</TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="section1" +><A NAME="8" +>A visible module +</A +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +>module <A HREF="Visible.html" +>Visible</A +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="doc" +>nested-style doc comments +</TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="section1" +><A NAME="9" +>Existential / Universal types +</A +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><SPAN CLASS="keyword" +>data</SPAN +> <A NAME="t%3AEx" +></A +><B +>Ex</B +> a </TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="ndoc" +>A data-type using existential/universal types +</TD +></TR +><TR +><TD CLASS="section4" +>Constructors</TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0" +><TR +><TD CLASS="arg" +><SPAN CLASS="keyword" +>forall</SPAN +> b . <A HREF="Test.html#t%3AC" +>C</A +> b => <A NAME="v%3AEx1" +></A +><B +>Ex1</B +> b</TD +><TD CLASS="rdoc" +></TD +></TR +><TR +><TD CLASS="arg" +><SPAN CLASS="keyword" +>forall</SPAN +> b . <A NAME="v%3AEx2" +></A +><B +>Ex2</B +> b</TD +><TD CLASS="rdoc" +></TD +></TR +><TR +><TD CLASS="arg" +><SPAN CLASS="keyword" +>forall</SPAN +> b . <A HREF="Test.html#t%3AC" +>C</A +> a => <A NAME="v%3AEx3" +></A +><B +>Ex3</B +> b</TD +><TD CLASS="rdoc" +></TD +></TR +><TR +><TD CLASS="arg" +><A NAME="v%3AEx4" +></A +><B +>Ex4</B +> <SPAN CLASS="keyword" +>forall</SPAN +> a. a -> a</TD +><TD CLASS="rdoc" +></TD +></TR +></TABLE +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="section1" +><A NAME="10" +>Type signatures with argument docs +</A +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><A NAME="v%3Ak" +></A +><B +>k</B +></TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="arg" +>:: <A HREF="Test.html#t%3AT" +>T</A +> () ()</TD +><TD CLASS="rdoc" +>This argument has type <TT +><A HREF="Test.html#t%3AT" +>T</A +></TT +> +</TD +></TR +><TR +><TD CLASS="arg" +>-> <A HREF="Test.html#t%3AT2" +>T2</A +> Int Int</TD +><TD CLASS="rdoc" +>This argument has type 'T2 Int Int' +</TD +></TR +><TR +><TD CLASS="arg" +>-> <A HREF="Test.html#t%3AT3" +>T3</A +> Bool Bool -> <A HREF="Test.html#t%3AT4" +>T4</A +> Float Float</TD +><TD CLASS="rdoc" +>This argument has type <TT +>T3 Bool Bool -> T4 Float Float</TT +> +</TD +></TR +><TR +><TD CLASS="arg" +>-> <A HREF="Test.html#t%3AT5" +>T5</A +> () ()</TD +><TD CLASS="rdoc" +>This argument has a very long description that should + hopefully cause some wrapping to happen when it is finally + rendered by Haddock in the generated HTML page. +</TD +></TR +><TR +><TD CLASS="arg" +>-> IO ()</TD +><TD CLASS="rdoc" +>This is the result type +</TD +></TR +><TR +><TD CLASS="ndoc" COLSPAN="2" +>This is a function with documentation for each argument +</TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><A NAME="v%3Al" +></A +><B +>l</B +></TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="arg" +>:: (Int, Int, Float)</TD +><TD CLASS="rdoc" +>takes a triple +</TD +></TR +><TR +><TD CLASS="arg" +>-> Int</TD +><TD CLASS="rdoc" +>returns an <TT +>Int</TT +> +</TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><A NAME="v%3Am" +></A +><B +>m</B +></TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="arg" +>:: <A HREF="Test.html#t%3AR" +>R</A +></TD +><TD CLASS="rdoc" +></TD +></TR +><TR +><TD CLASS="arg" +>-> <A HREF="Test.html#t%3AN1" +>N1</A +> ()</TD +><TD CLASS="rdoc" +>one of the arguments +</TD +></TR +><TR +><TD CLASS="arg" +>-> IO Int</TD +><TD CLASS="rdoc" +>and the return value +</TD +></TR +><TR +><TD CLASS="ndoc" COLSPAN="2" +>This function has some arg docs +</TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><A NAME="v%3Ao" +></A +><B +>o</B +></TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="arg" +>:: Float</TD +><TD CLASS="rdoc" +>The input float +</TD +></TR +><TR +><TD CLASS="arg" +>-> IO Float</TD +><TD CLASS="rdoc" +>The output float +</TD +></TR +><TR +><TD CLASS="ndoc" COLSPAN="2" +>A foreign import with argument docs +</TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="section1" +><A NAME="11" +>A section +</A +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="section2" +><A NAME="12" +>A subsection +</A +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="doc" +><PRE +> a literal line +</PRE +><P +>$ a non <EM +>literal</EM +> line $ +</P +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><A NAME="v%3Af%27" +></A +><B +>f'</B +> :: Int</TD +></TR +><TR +><TD CLASS="doc" +>a function with a prime can be referred to as <TT +><A HREF="Test.html#v%3Af%27" +>f'</A +></TT +> + but f' doesn't get link'd 'f\'' +</TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="botbar" +>Produced by <A HREF="http://www.haskell.org/haddock/" +>Haddock</A +> version 2.0</TD +></TR +></TABLE +></BODY +></HTML +> diff --git a/tests/pre-2.0-tests/Visible.hs b/tests/pre-2.0-tests/Visible.hs new file mode 100644 index 00000000..cad71931 --- /dev/null +++ b/tests/pre-2.0-tests/Visible.hs @@ -0,0 +1,3 @@ +module Visible where +visible :: Int -> Int +visible a = a diff --git a/tests/pre-2.0-tests/Visible.html.ref b/tests/pre-2.0-tests/Visible.html.ref new file mode 100644 index 00000000..2b440ecd --- /dev/null +++ b/tests/pre-2.0-tests/Visible.html.ref @@ -0,0 +1,98 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<!--Rendered using the Haskell Html Library v0.2--> +<HTML +><HEAD +><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8" +><TITLE +>Visible</TITLE +><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css" +><SCRIPT SRC="haddock.js" TYPE="text/javascript" +></SCRIPT +></HEAD +><BODY +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="topbar" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD +><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" " +></TD +><TD CLASS="title" +></TD +><TD CLASS="topbut" +><A HREF="index.html" +>Contents</A +></TD +><TD CLASS="topbut" +><A HREF="doc-index.html" +>Index</A +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="modulebar" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD +><FONT SIZE="6" +>Visible</FONT +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="section1" +>Documentation</TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><A NAME="v%3Avisible" +></A +><B +>visible</B +> :: Int -> Int</TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="botbar" +>Produced by <A HREF="http://www.haskell.org/haddock/" +>Haddock</A +> version 2.0</TD +></TR +></TABLE +></BODY +></HTML +> diff --git a/tests/runtests.hs b/tests/runtests.hs new file mode 100644 index 00000000..18375b97 --- /dev/null +++ b/tests/runtests.hs @@ -0,0 +1,66 @@ +import System.Cmd +import System.Environment +import System.FilePath +import System.Exit +import System.Directory +import Data.List +import Control.Monad +import Text.Printf +import Text.Regex + +main = do + args <- getArgs + when (null args) $ error "You must give the path to the GHC lib dir with -B" + putStrLn "Running tests..." + let libdir = head args + walkDirs libdir "." + putStrLn "All tests passed!" + + +haddockEq file1 file2 = (stripLinks file1) == (stripLinks file2) + where + stripLinks f = subRegex (mkRegexWithOpts "<A HREF=[^>]*>" False False) f "<A HREF=\"\">" + + +allModules dir = do + contents <- getDirectoryContents dir + return $ filter ((==) ".hs" . takeExtension) contents + + +check modules = do + forM_ modules $ \mod -> do + let outfile = "output" </> (dropExtension mod ++ ".html") + let reffile = dropExtension mod ++ ".html.ref" + b <- doesFileExist reffile + if b + then do + copyFile reffile ("output" </> reffile) + out <- readFile outfile + ref <- readFile reffile + if not $ haddockEq out ref + then do + putStrLn $ "Output for " ++ mod ++ " has changed! Exiting." + exitFailure + else do + putStrLn $ "Pass: " ++ mod + else do + putStrLn $ "Pass: " ++ mod ++ " (no .ref file)" + + +walkDirs libdir basedir = do + contents <- getDirectoryContents basedir + dirs <- filterM doesDirectoryExist . + map (basedir </>) . + filter (`notElem` [".", "..", "output"]) $ contents + mapM_ (testDir libdir) dirs + + +testDir libdir dir = do + mods <- allModules dir + let mods' = map (dir </>) mods + let outdir = "output" </> dir + createDirectoryIfMissing True outdir + code <- system $ printf "haddock -B %s -o %s -h -g -fglasgow-exts %s" libdir outdir (unwords mods') + unless (code == ExitSuccess) $ error "Haddock run failed! Exiting." + check mods' + walkDirs libdir dir |