diff options
Diffstat (limited to 'tests/html-tests')
63 files changed, 6308 insertions, 0 deletions
diff --git a/tests/html-tests/README b/tests/html-tests/README new file mode 100644 index 00000000..fd906b2b --- /dev/null +++ b/tests/html-tests/README @@ -0,0 +1,28 @@ + +This is a testsuite for Haddock that uses the concept of "golden files". That +is, it compares output files against a set of reference files. + +To add a new test: + + 1) Create a module in the "tests" directory. + + 2) Run runtests.hs. You should now have output/<modulename>.html. The test + passes since there is no reference file to compare with. + + 3) To make a reference file from the output file, do + runhaskell copy.hs <modulename> + +Tips and tricks: + +You can + runhaskell copy.hs + +to copy all output files into reference files. + +You can + runhaskell runtests.hs all + +to continue despite a failing test. + +You can pass extra options to haddock like so + runhaskell runtests.hs --title="All Tests" all diff --git a/tests/html-tests/copy.hs b/tests/html-tests/copy.hs new file mode 100644 index 00000000..fa18fe9c --- /dev/null +++ b/tests/html-tests/copy.hs @@ -0,0 +1,30 @@ +import System.Cmd +import System.Environment +import System.FilePath +import System.Exit +import System.Directory +import Data.List +import Control.Monad +import Text.Regex + + +main = do + args <- getArgs + dir <- getCurrentDirectory + contents <- getDirectoryContents (dir </> "output") + if not $ null args + then + mapM copy [ "output" </> file | file <- contents, ".html" `isSuffixOf` file, takeBaseName file `elem` args ] + else + mapM copy [ "output" </> file | file <- contents, ".html" `isSuffixOf` file ] + + +copy file = do + let new = "tests" </> takeFileName file <.> ".ref" + print file + print new + contents <- readFile file + writeFile new (stripLinks contents) + + +stripLinks f = subRegex (mkRegexWithOpts "<A HREF=[^>]*>" False False) f "<A HREF=\"\">" diff --git a/tests/html-tests/runtests.hs b/tests/html-tests/runtests.hs new file mode 100644 index 00000000..05bc28c5 --- /dev/null +++ b/tests/html-tests/runtests.hs @@ -0,0 +1,115 @@ +import System.Cmd +import System.Environment +import System.FilePath +import System.Exit +import System.Directory +import System.Process +import Data.List +import Control.Monad +import Text.Printf +import Text.Regex +import Distribution.Simple.Utils +import Distribution.Simple.Program +import Distribution.Verbosity +import Data.Maybe + + +haddockBase = ".." </> ".." +haddockPath = haddockBase </> "dist" </> "build" </> "haddock" </> "haddock" + + +main = do + test + putStrLn "All tests passed!" + + +test = do + x <- doesFileExist haddockPath + when (not x) $ die "you need to run 'cabal build' successfully first" + + contents <- getDirectoryContents "tests" + args <- getArgs + let (opts, spec) = span ("-" `isPrefixOf`) args + let mods = + case spec of + x:_ | x /= "all" -> [x ++ ".hs"] + _ -> filter ((==) ".hs" . takeExtension) contents + + let outdir = "output" + let mods' = map ("tests" </>) mods + putStrLn "" + putStrLn "Haddock version: " + h1 <- runProcess haddockPath ["--version"] Nothing + (Just [("haddock_datadir", haddockBase)]) Nothing Nothing Nothing + waitForProcess h1 + putStrLn "" + putStrLn "GHC version: " + h2 <- runProcess haddockPath ["--ghc-version"] Nothing + (Just [("haddock_datadir", haddockBase)]) Nothing Nothing Nothing + waitForProcess h2 + putStrLn "" + + -- TODO: use Distribution.* to get the packages instead + libdir <- rawSystemStdout normal haddockPath ["--print-ghc-libdir"] + let librariesPath = ".."</>".."</>"share"</>"doc"</>"ghc"</>"html"</>"libraries" + + let mkDep name version = + let path = init libdir </> librariesPath </> name ++ "-" ++ version + in "-i " ++ path ++ "," ++ path </> name ++ ".haddock" + + let base = mkDep "base" "4.3.0.0" + process = mkDep "process" "1.0.1.4" + ghcprim = mkDep "ghc-prim" "0.2.0.0" + + putStrLn "Running tests..." + handle <- runProcess haddockPath + (["-w", "-o", outdir, "-h", "--pretty-html", "--optghc=-fglasgow-exts" + , "--optghc=-w", base, process, ghcprim] ++ opts ++ mods') + Nothing (Just [("haddock_datadir", haddockBase)]) Nothing + Nothing Nothing + + code <- waitForProcess handle + when (code /= ExitSuccess) $ error "Haddock run failed! Exiting." + check mods (if not (null args) && args !! 0 == "all" then False else True) + + +check modules strict = do + forM_ modules $ \mod -> do + let outfile = "output" </> (dropExtension mod ++ ".html") + let reffile = "tests" </> dropExtension mod ++ ".html.ref" + b <- doesFileExist reffile + if b + then do + copyFile reffile ("output" </> takeFileName reffile) + out <- readFile outfile + ref <- readFile reffile + if not $ haddockEq out ref + then do + putStrLn $ "Output for " ++ mod ++ " has changed! Exiting with diff:" + let ref' = stripLinks ref + out' = stripLinks out + let reffile' = "output" </> takeFileName reffile ++ ".nolinks" + outfile' = "output" </> takeFileName outfile ++ ".nolinks" + writeFile reffile' ref' + writeFile outfile' out' + b <- programOnPath "colordiff" + if b + then system $ "colordiff " ++ reffile' ++ " " ++ outfile' + else system $ "diff " ++ reffile' ++ " " ++ outfile' + if strict then exitFailure else return () + else do + putStrLn $ "Pass: " ++ mod + else do + putStrLn $ "Pass: " ++ mod ++ " (no .ref file)" + + +haddockEq file1 file2 = stripLinks file1 == stripLinks file2 + + +stripLinks f = subRegex (mkRegexWithOpts "<A HREF=[^>]*>" False False) f "<A HREF=\"\">" + + +programOnPath p = do + result <- findProgramLocation silent p + return (isJust result) + diff --git a/tests/html-tests/tests/A.hs b/tests/html-tests/tests/A.hs new file mode 100644 index 00000000..4a344a24 --- /dev/null +++ b/tests/html-tests/tests/A.hs @@ -0,0 +1,2 @@ +module A where +data A = A diff --git a/tests/html-tests/tests/A.html.ref b/tests/html-tests/tests/A.html.ref new file mode 100644 index 00000000..8f0e3765 --- /dev/null +++ b/tests/html-tests/tests/A.html.ref @@ -0,0 +1,68 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" +><head + ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" + /><title + >A</title + ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" + /><script src="haddock-util.js" type="text/javascript" + ></script + ><script type="text/javascript" + >//<![CDATA[ +window.onload = function () {pageLoad();setSynopsis("mini_A.html");}; +//]]> +</script + ></head + ><body + ><div id="package-header" + ><ul class="links" id="page-menu" + ><li + ><A HREF="">Contents</a + ></li + ><li + ><A HREF="">Index</a + ></li + ></ul + ><p class="caption" class="empty" + > </p + ></div + ><div id="content" + ><div id="module-header" + ><p class="caption" + >A</p + ></div + ><div id="interface" + ><h1 + >Documentation</h1 + ><div class="top" + ><p class="src" + ><span class="keyword" + >data</span + > <a name="t:A" class="def" + >A</a + > </p + ><div class="subs constructors" + ><p class="caption" + >Constructors</p + ><table + ><tr + ><td class="src" + ><a name="v:A" class="def" + >A</a + ></td + ><td class="doc empty" + > </td + ></tr + ></table + ></div + ></div + ></div + ></div + ><div id="footer" + ><p + >Produced by <A HREF="">Haddock</a + > version 2.8.2</p + ></div + ></body + ></html +> diff --git a/tests/html-tests/tests/B.hs b/tests/html-tests/tests/B.hs new file mode 100644 index 00000000..3a31507e --- /dev/null +++ b/tests/html-tests/tests/B.hs @@ -0,0 +1,2 @@ +module B ( module A ) where +import A diff --git a/tests/html-tests/tests/B.html.ref b/tests/html-tests/tests/B.html.ref new file mode 100644 index 00000000..abb08d45 --- /dev/null +++ b/tests/html-tests/tests/B.html.ref @@ -0,0 +1,51 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" +><head + ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" + /><title + >B</title + ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" + /><script src="haddock-util.js" type="text/javascript" + ></script + ><script type="text/javascript" + >//<![CDATA[ +window.onload = function () {pageLoad();setSynopsis("mini_B.html");}; +//]]> +</script + ></head + ><body + ><div id="package-header" + ><ul class="links" id="page-menu" + ><li + ><A HREF="">Contents</a + ></li + ><li + ><A HREF="">Index</a + ></li + ></ul + ><p class="caption" class="empty" + > </p + ></div + ><div id="content" + ><div id="module-header" + ><p class="caption" + >B</p + ></div + ><div id="interface" + ><h1 + >Documentation</h1 + ><div class="top" + ><p class="src" + >module <A HREF="">A</a + ></p + ></div + ></div + ></div + ><div id="footer" + ><p + >Produced by <A HREF="">Haddock</a + > version 2.8.2</p + ></div + ></body + ></html +> diff --git a/tests/html-tests/tests/Bug1.hs b/tests/html-tests/tests/Bug1.hs new file mode 100644 index 00000000..af1ed4d3 --- /dev/null +++ b/tests/html-tests/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/html-tests/tests/Bug1.html.ref b/tests/html-tests/tests/Bug1.html.ref new file mode 100644 index 00000000..bc778d38 --- /dev/null +++ b/tests/html-tests/tests/Bug1.html.ref @@ -0,0 +1,89 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" +><head + ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" + /><title + >Bug1</title + ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" + /><script src="haddock-util.js" type="text/javascript" + ></script + ><script type="text/javascript" + >//<![CDATA[ +window.onload = function () {pageLoad();setSynopsis("mini_Bug1.html");}; +//]]> +</script + ></head + ><body + ><div id="package-header" + ><ul class="links" id="page-menu" + ><li + ><A HREF="">Contents</a + ></li + ><li + ><A HREF="">Index</a + ></li + ></ul + ><p class="caption" class="empty" + > </p + ></div + ><div id="content" + ><div id="module-header" + ><p class="caption" + >Bug1</p + ></div + ><div id="synopsis" + ><p id="control.syn" class="caption expander" onclick="toggleSection('syn')" + >Synopsis</p + ><ul id="section.syn" class="hide" onclick="toggleSection('syn')" + ><li class="src short" + ><span class="keyword" + >data</span + > <A HREF="">T</a + > = <A HREF="">T</a + ></li + ></ul + ></div + ><div id="interface" + ><h1 + >Documentation</h1 + ><div class="top" + ><p class="src" + ><span class="keyword" + >data</span + > <a name="t:T" class="def" + >T</a + > </p + ><div class="doc" + ><p + >We should have different anchors for constructors and types/classes. This + hyperlink should point to the type constructor by default: <code + ><A HREF="">T</a + ></code + >. +</p + ></div + ><div class="subs constructors" + ><p class="caption" + >Constructors</p + ><table + ><tr + ><td class="src" + ><a name="v:T" class="def" + >T</a + ></td + ><td class="doc empty" + > </td + ></tr + ></table + ></div + ></div + ></div + ></div + ><div id="footer" + ><p + >Produced by <A HREF="">Haddock</a + > version 2.8.2</p + ></div + ></body + ></html +> diff --git a/tests/html-tests/tests/Bug2.hs b/tests/html-tests/tests/Bug2.hs new file mode 100644 index 00000000..9121922e --- /dev/null +++ b/tests/html-tests/tests/Bug2.hs @@ -0,0 +1,4 @@ +module Bug2 ( x ) where +import B +x :: A +x = A diff --git a/tests/html-tests/tests/Bug2.html.ref b/tests/html-tests/tests/Bug2.html.ref new file mode 100644 index 00000000..ed81755d --- /dev/null +++ b/tests/html-tests/tests/Bug2.html.ref @@ -0,0 +1,53 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" +><head + ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" + /><title + >Bug2</title + ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" + /><script src="haddock-util.js" type="text/javascript" + ></script + ><script type="text/javascript" + >//<![CDATA[ +window.onload = function () {pageLoad();setSynopsis("mini_Bug2.html");}; +//]]> +</script + ></head + ><body + ><div id="package-header" + ><ul class="links" id="page-menu" + ><li + ><A HREF="">Contents</a + ></li + ><li + ><A HREF="">Index</a + ></li + ></ul + ><p class="caption" class="empty" + > </p + ></div + ><div id="content" + ><div id="module-header" + ><p class="caption" + >Bug2</p + ></div + ><div id="interface" + ><h1 + >Documentation</h1 + ><div class="top" + ><p class="src" + ><a name="v:x" class="def" + >x</a + > :: <A HREF="">A</a + ></p + ></div + ></div + ></div + ><div id="footer" + ><p + >Produced by <A HREF="">Haddock</a + > version 2.8.2</p + ></div + ></body + ></html +> diff --git a/tests/html-tests/tests/Bug3.hs b/tests/html-tests/tests/Bug3.hs new file mode 100644 index 00000000..67e57892 --- /dev/null +++ b/tests/html-tests/tests/Bug3.hs @@ -0,0 +1,6 @@ +module Bug3 where + +-- | /multi-line +-- emphasis/ +foo :: Int +foo = undefined diff --git a/tests/html-tests/tests/Bug3.html.ref b/tests/html-tests/tests/Bug3.html.ref new file mode 100644 index 00000000..b231c443 --- /dev/null +++ b/tests/html-tests/tests/Bug3.html.ref @@ -0,0 +1,69 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" +><head + ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" + /><title + >Bug3</title + ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" + /><script src="haddock-util.js" type="text/javascript" + ></script + ><script type="text/javascript" + >//<![CDATA[ +window.onload = function () {pageLoad();setSynopsis("mini_Bug3.html");}; +//]]> +</script + ></head + ><body + ><div id="package-header" + ><ul class="links" id="page-menu" + ><li + ><A HREF="">Contents</a + ></li + ><li + ><A HREF="">Index</a + ></li + ></ul + ><p class="caption" class="empty" + > </p + ></div + ><div id="content" + ><div id="module-header" + ><p class="caption" + >Bug3</p + ></div + ><div id="synopsis" + ><p id="control.syn" class="caption expander" onclick="toggleSection('syn')" + >Synopsis</p + ><ul id="section.syn" class="hide" onclick="toggleSection('syn')" + ><li class="src short" + ><A HREF="">foo</a + > :: <A HREF="">Int</a + ></li + ></ul + ></div + ><div id="interface" + ><h1 + >Documentation</h1 + ><div class="top" + ><p class="src" + ><a name="v:foo" class="def" + >foo</a + > :: <A HREF="">Int</a + ></p + ><div class="doc" + ><p + >/multi-line + emphasis/ +</p + ></div + ></div + ></div + ></div + ><div id="footer" + ><p + >Produced by <A HREF="">Haddock</a + > version 2.8.2</p + ></div + ></body + ></html +> diff --git a/tests/html-tests/tests/Bug4.hs b/tests/html-tests/tests/Bug4.hs new file mode 100644 index 00000000..425a77aa --- /dev/null +++ b/tests/html-tests/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/html-tests/tests/Bug4.html.ref b/tests/html-tests/tests/Bug4.html.ref new file mode 100644 index 00000000..776a0ab6 --- /dev/null +++ b/tests/html-tests/tests/Bug4.html.ref @@ -0,0 +1,68 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" +><head + ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" + /><title + >Bug4</title + ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" + /><script src="haddock-util.js" type="text/javascript" + ></script + ><script type="text/javascript" + >//<![CDATA[ +window.onload = function () {pageLoad();setSynopsis("mini_Bug4.html");}; +//]]> +</script + ></head + ><body + ><div id="package-header" + ><ul class="links" id="page-menu" + ><li + ><A HREF="">Contents</a + ></li + ><li + ><A HREF="">Index</a + ></li + ></ul + ><p class="caption" class="empty" + > </p + ></div + ><div id="content" + ><div id="module-header" + ><p class="caption" + >Bug4</p + ></div + ><div id="synopsis" + ><p id="control.syn" class="caption expander" onclick="toggleSection('syn')" + >Synopsis</p + ><ul id="section.syn" class="hide" onclick="toggleSection('syn')" + ><li class="src short" + ><A HREF="">foo</a + > :: <A HREF="">Int</a + ></li + ></ul + ></div + ><div id="interface" + ><h1 + >Documentation</h1 + ><div class="top" + ><p class="src" + ><a name="v:foo" class="def" + >foo</a + > :: <A HREF="">Int</a + ></p + ><div class="doc" + ><p + >don't use apostrophe's in the wrong place's +</p + ></div + ></div + ></div + ></div + ><div id="footer" + ><p + >Produced by <A HREF="">Haddock</a + > version 2.8.2</p + ></div + ></body + ></html +> diff --git a/tests/html-tests/tests/Bug6.hs b/tests/html-tests/tests/Bug6.hs new file mode 100644 index 00000000..17411f31 --- /dev/null +++ b/tests/html-tests/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 +-- (the field isn't documented separately since it is already documented here) +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/html-tests/tests/Bug6.html.ref b/tests/html-tests/tests/Bug6.html.ref new file mode 100644 index 00000000..c6ee6452 --- /dev/null +++ b/tests/html-tests/tests/Bug6.html.ref @@ -0,0 +1,297 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" +><head + ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" + /><title + >Bug6</title + ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" + /><script src="haddock-util.js" type="text/javascript" + ></script + ><script type="text/javascript" + >//<![CDATA[ +window.onload = function () {pageLoad();setSynopsis("mini_Bug6.html");}; +//]]> +</script + ></head + ><body + ><div id="package-header" + ><ul class="links" id="page-menu" + ><li + ><A HREF="">Contents</a + ></li + ><li + ><A HREF="">Index</a + ></li + ></ul + ><p class="caption" class="empty" + > </p + ></div + ><div id="content" + ><div id="module-header" + ><p class="caption" + >Bug6</p + ></div + ><div id="description" + ><p class="caption" + >Description</p + ><div class="doc" + ><p + >Exporting records. +</p + ></div + ></div + ><div id="synopsis" + ><p id="control.syn" class="caption expander" onclick="toggleSection('syn')" + >Synopsis</p + ><ul id="section.syn" class="hide" onclick="toggleSection('syn')" + ><li class="src short" + ><span class="keyword" + >data</span + > <A HREF="">A</a + > = <A HREF="">A</a + > <A HREF="">Int</a + ></li + ><li class="src short" + ><span class="keyword" + >data</span + > <A HREF="">B</a + > = <A HREF="">B</a + > {<ul class="subs" + ><li + ><A HREF="">b</a + > :: <A HREF="">Int</a + ></li + ></ul + >}</li + ><li class="src short" + ><span class="keyword" + >data</span + > <A HREF="">C</a + > = <A HREF="">C</a + > {<ul class="subs" + ><li + ><A HREF="">c1</a + > :: <A HREF="">Int</a + ></li + ><li + ><A HREF="">c2</a + > :: <A HREF="">Int</a + ></li + ></ul + >}</li + ><li class="src short" + ><span class="keyword" + >data</span + > <A HREF="">D</a + > = <A HREF="">D</a + > <A HREF="">Int</a + > <A HREF="">Int</a + ></li + ><li class="src short" + ><span class="keyword" + >newtype</span + > <A HREF="">E</a + > = <A HREF="">E</a + > <A HREF="">Int</a + ></li + ></ul + ></div + ><div id="interface" + ><h1 + >Documentation</h1 + ><div class="top" + ><p class="src" + ><span class="keyword" + >data</span + > <a name="t:A" class="def" + >A</a + > </p + ><div class="doc" + ><p + >This record is exported without its field +</p + ></div + ><div class="subs constructors" + ><p class="caption" + >Constructors</p + ><table + ><tr + ><td class="src" + ><a name="v:A" class="def" + >A</a + > <A HREF="">Int</a + ></td + ><td class="doc empty" + > </td + ></tr + ></table + ></div + ></div + ><div class="top" + ><p class="src" + ><span class="keyword" + >data</span + > <a name="t:B" class="def" + >B</a + > </p + ><div class="doc" + ><p + >.. with its field, but the field is named separately in the export list + (the field isn't documented separately since it is already documented here) +</p + ></div + ><div class="subs constructors" + ><p class="caption" + >Constructors</p + ><table + ><tr + ><td class="src" + ><a name="v:B" class="def" + >B</a + ></td + ><td class="doc empty" + > </td + ></tr + ><tr + ><td colspan="2" + ><div class="subs fields" + ><p class="caption" + >Fields</p + ><dl + ><dt class="src" + ><a name="v:b" class="def" + >b</a + > :: <A HREF="">Int</a + ></dt + ><dd class="doc empty" + > </dd + ></dl + ><div class="clear" + ></div + ></div + ></td + ></tr + ></table + ></div + ></div + ><div class="top" + ><p class="src" + ><span class="keyword" + >data</span + > <a name="t:C" class="def" + >C</a + > </p + ><div class="doc" + ><p + >.. with fields names as subordinate names in the export +</p + ></div + ><div class="subs constructors" + ><p class="caption" + >Constructors</p + ><table + ><tr + ><td class="src" + ><a name="v:C" class="def" + >C</a + ></td + ><td class="doc empty" + > </td + ></tr + ><tr + ><td colspan="2" + ><div class="subs fields" + ><p class="caption" + >Fields</p + ><dl + ><dt class="src" + ><a name="v:c1" class="def" + >c1</a + > :: <A HREF="">Int</a + ></dt + ><dd class="doc empty" + > </dd + ><dt class="src" + ><a name="v:c2" class="def" + >c2</a + > :: <A HREF="">Int</a + ></dt + ><dd class="doc empty" + > </dd + ></dl + ><div class="clear" + ></div + ></div + ></td + ></tr + ></table + ></div + ></div + ><div class="top" + ><p class="src" + ><span class="keyword" + >data</span + > <a name="t:D" class="def" + >D</a + > </p + ><div class="doc" + ><p + >.. with only some of the fields exported (we can't handle this one - + how do we render the declaration?) +</p + ></div + ><div class="subs constructors" + ><p class="caption" + >Constructors</p + ><table + ><tr + ><td class="src" + ><a name="v:D" class="def" + >D</a + > <A HREF="">Int</a + > <A HREF="">Int</a + ></td + ><td class="doc empty" + > </td + ></tr + ></table + ></div + ></div + ><div class="top" + ><p class="src" + ><span class="keyword" + >newtype</span + > <a name="t:E" class="def" + >E</a + > </p + ><div class="doc" + ><p + >a newtype with a field +</p + ></div + ><div class="subs constructors" + ><p class="caption" + >Constructors</p + ><table + ><tr + ><td class="src" + ><a name="v:E" class="def" + >E</a + > <A HREF="">Int</a + ></td + ><td class="doc empty" + > </td + ></tr + ></table + ></div + ></div + ></div + ></div + ><div id="footer" + ><p + >Produced by <A HREF="">Haddock</a + > version 2.8.2</p + ></div + ></body + ></html +> diff --git a/tests/html-tests/tests/Bug7.hs b/tests/html-tests/tests/Bug7.hs new file mode 100644 index 00000000..8cf57914 --- /dev/null +++ b/tests/html-tests/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/html-tests/tests/Bug7.html.ref b/tests/html-tests/tests/Bug7.html.ref new file mode 100644 index 00000000..eea2095d --- /dev/null +++ b/tests/html-tests/tests/Bug7.html.ref @@ -0,0 +1,153 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" +><head + ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" + /><title + >Bug7</title + ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" + /><script src="haddock-util.js" type="text/javascript" + ></script + ><script type="text/javascript" + >//<![CDATA[ +window.onload = function () {pageLoad();setSynopsis("mini_Bug7.html");}; +//]]> +</script + ></head + ><body + ><div id="package-header" + ><ul class="links" id="page-menu" + ><li + ><A HREF="">Contents</a + ></li + ><li + ><A HREF="">Index</a + ></li + ></ul + ><p class="caption" class="empty" + > </p + ></div + ><div id="content" + ><div id="module-header" + ><p class="caption" + >Bug7</p + ></div + ><div id="description" + ><p class="caption" + >Description</p + ><div class="doc" + ><p + >This module caused a duplicate instance in the documentation for the Foo + type. +</p + ></div + ></div + ><div id="synopsis" + ><p id="control.syn" class="caption expander" onclick="toggleSection('syn')" + >Synopsis</p + ><ul id="section.syn" class="hide" onclick="toggleSection('syn')" + ><li class="src short" + ><span class="keyword" + >data</span + > <A HREF="">Foo</a + > = <A HREF="">Foo</a + ></li + ><li class="src short" + ><span class="keyword" + >class</span + > <A HREF="">Bar</a + > x y </li + ></ul + ></div + ><div id="interface" + ><h1 + >Documentation</h1 + ><div class="top" + ><p class="src" + ><span class="keyword" + >data</span + > <a name="t:Foo" class="def" + >Foo</a + > </p + ><div class="doc" + ><p + >The Foo datatype +</p + ></div + ><div class="subs constructors" + ><p class="caption" + >Constructors</p + ><table + ><tr + ><td class="src" + ><a name="v:Foo" class="def" + >Foo</a + ></td + ><td class="doc empty" + > </td + ></tr + ></table + ></div + ><div class="subs instances" + ><p id="control.i:Foo" class="caption collapser" onclick="toggleSection('i:Foo')" + >Instances</p + ><div id="section.i:Foo" class="show" + ><table + ><tr + ><td class="src" + ><A HREF="">Bar</a + > <A HREF="">Foo</a + > <A HREF="">Foo</a + ></td + ><td class="doc" + ><p + >Just one instance +</p + ></td + ></tr + ></table + ></div + ></div + ></div + ><div class="top" + ><p class="src" + ><span class="keyword" + >class</span + > <a name="t:Bar" class="def" + >Bar</a + > x y </p + ><div class="doc" + ><p + >The Bar class +</p + ></div + ><div class="subs instances" + ><p id="control.i:Bar" class="caption collapser" onclick="toggleSection('i:Bar')" + >Instances</p + ><div id="section.i:Bar" class="show" + ><table + ><tr + ><td class="src" + ><A HREF="">Bar</a + > <A HREF="">Foo</a + > <A HREF="">Foo</a + ></td + ><td class="doc" + ><p + >Just one instance +</p + ></td + ></tr + ></table + ></div + ></div + ></div + ></div + ></div + ><div id="footer" + ><p + >Produced by <A HREF="">Haddock</a + > version 2.8.2</p + ></div + ></body + ></html +> diff --git a/tests/html-tests/tests/Bug8.hs b/tests/html-tests/tests/Bug8.hs new file mode 100644 index 00000000..0f279c29 --- /dev/null +++ b/tests/html-tests/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/html-tests/tests/Bug8.html.ref b/tests/html-tests/tests/Bug8.html.ref new file mode 100644 index 00000000..e8ea727c --- /dev/null +++ b/tests/html-tests/tests/Bug8.html.ref @@ -0,0 +1,80 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" +><head + ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" + /><title + >Bug8</title + ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" + /><script src="haddock-util.js" type="text/javascript" + ></script + ><script type="text/javascript" + >//<![CDATA[ +window.onload = function () {pageLoad();setSynopsis("mini_Bug8.html");}; +//]]> +</script + ></head + ><body + ><div id="package-header" + ><ul class="links" id="page-menu" + ><li + ><A HREF="">Contents</a + ></li + ><li + ><A HREF="">Index</a + ></li + ></ul + ><p class="caption" class="empty" + > </p + ></div + ><div id="content" + ><div id="module-header" + ><p class="caption" + >Bug8</p + ></div + ><div id="interface" + ><h1 + >Documentation</h1 + ><div class="top" + ><p class="src" + ><span class="keyword" + >data</span + > <a name="t:Typ" class="def" + >Typ</a + > </p + ><div class="subs constructors" + ><p class="caption" + >Constructors</p + ><table + ><tr + ><td class="src" + ><a name="v:Type" class="def" + >Type</a + > (<A HREF="">String</a + >, [<A HREF="">Typ</a + >])</td + ><td class="doc empty" + > </td + ></tr + ><tr + ><td class="src" + ><a name="v:TFree" class="def" + >TFree</a + > (<A HREF="">String</a + >, [<A HREF="">String</a + >])</td + ><td class="doc empty" + > </td + ></tr + ></table + ></div + ></div + ></div + ></div + ><div id="footer" + ><p + >Produced by <A HREF="">Haddock</a + > version 2.8.2</p + ></div + ></body + ></html +> diff --git a/tests/html-tests/tests/Bugs.hs b/tests/html-tests/tests/Bugs.hs new file mode 100644 index 00000000..8e1f0079 --- /dev/null +++ b/tests/html-tests/tests/Bugs.hs @@ -0,0 +1,3 @@ +module Bugs where + +data A a = A a (a -> Int) diff --git a/tests/html-tests/tests/Bugs.html.ref b/tests/html-tests/tests/Bugs.html.ref new file mode 100644 index 00000000..5828a6fa --- /dev/null +++ b/tests/html-tests/tests/Bugs.html.ref @@ -0,0 +1,69 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" +><head + ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" + /><title + >Bugs</title + ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" + /><script src="haddock-util.js" type="text/javascript" + ></script + ><script type="text/javascript" + >//<![CDATA[ +window.onload = function () {pageLoad();setSynopsis("mini_Bugs.html");}; +//]]> +</script + ></head + ><body + ><div id="package-header" + ><ul class="links" id="page-menu" + ><li + ><A HREF="">Contents</a + ></li + ><li + ><A HREF="">Index</a + ></li + ></ul + ><p class="caption" class="empty" + > </p + ></div + ><div id="content" + ><div id="module-header" + ><p class="caption" + >Bugs</p + ></div + ><div id="interface" + ><h1 + >Documentation</h1 + ><div class="top" + ><p class="src" + ><span class="keyword" + >data</span + > <a name="t:A" class="def" + >A</a + > a </p + ><div class="subs constructors" + ><p class="caption" + >Constructors</p + ><table + ><tr + ><td class="src" + ><a name="v:A" class="def" + >A</a + > a (a -> <A HREF="">Int</a + >)</td + ><td class="doc empty" + > </td + ></tr + ></table + ></div + ></div + ></div + ></div + ><div id="footer" + ><p + >Produced by <A HREF="">Haddock</a + > version 2.8.2</p + ></div + ></body + ></html +> diff --git a/tests/html-tests/tests/CrossPackageDocs.hs b/tests/html-tests/tests/CrossPackageDocs.hs new file mode 100644 index 00000000..de55060e --- /dev/null +++ b/tests/html-tests/tests/CrossPackageDocs.hs @@ -0,0 +1,3 @@ +module CrossPackageDocs (map, Monad(..), runInteractiveProcess) where + +import System.Process diff --git a/tests/html-tests/tests/CrossPackageDocs.html.ref b/tests/html-tests/tests/CrossPackageDocs.html.ref new file mode 100644 index 00000000..fd16c958 --- /dev/null +++ b/tests/html-tests/tests/CrossPackageDocs.html.ref @@ -0,0 +1,391 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" +><head + ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" + /><title + >CrossPackageDocs</title + ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" + /><script src="haddock-util.js" type="text/javascript" + ></script + ><script type="text/javascript" + >//<![CDATA[ +window.onload = function () {pageLoad();setSynopsis("mini_CrossPackageDocs.html");}; +//]]> +</script + ></head + ><body + ><div id="package-header" + ><ul class="links" id="page-menu" + ><li + ><A HREF="">Contents</a + ></li + ><li + ><A HREF="">Index</a + ></li + ></ul + ><p class="caption" class="empty" + > </p + ></div + ><div id="content" + ><div id="module-header" + ><p class="caption" + >CrossPackageDocs</p + ></div + ><div id="synopsis" + ><p id="control.syn" class="caption expander" onclick="toggleSection('syn')" + >Synopsis</p + ><ul id="section.syn" class="hide" onclick="toggleSection('syn')" + ><li class="src short" + ><A HREF="">map</a + > :: (a -> b) -> [a] -> [b]</li + ><li class="src short" + ><span class="keyword" + >class</span + > <A HREF="">Monad</a + > m <span class="keyword" + >where</span + ><ul class="subs" + ><li + ><A HREF="">(>>=)</a + > :: m a -> (a -> m b) -> m b</li + ><li + ><A HREF="">(>>)</a + > :: m a -> m b -> m b</li + ><li + ><A HREF="">return</a + > :: a -> m a</li + ><li + ><A HREF="">fail</a + > :: <A HREF="">String</a + > -> m a</li + ></ul + ></li + ><li class="src short" + ><A HREF="">runInteractiveProcess</a + > :: <A HREF="">FilePath</a + > -> [<A HREF="">String</a + >] -> <A HREF="">Maybe</a + > <A HREF="">FilePath</a + > -> <A HREF="">Maybe</a + > [(<A HREF="">String</a + >, <A HREF="">String</a + >)] -> <A HREF="">IO</a + > (<A HREF="">Handle</a + >, <A HREF="">Handle</a + >, <A HREF="">Handle</a + >, <A HREF="">ProcessHandle</a + >)</li + ></ul + ></div + ><div id="interface" + ><h1 + >Documentation</h1 + ><div class="top" + ><p class="src" + ><a name="v:map" class="def" + >map</a + > :: (a -> b) -> [a] -> [b]</p + ><div class="doc" + ><p + ><code + ><A HREF="">map</a + ></code + > <code + >f xs</code + > is the list obtained by applying <code + >f</code + > to each element + of <code + >xs</code + >, i.e., +</p + ><pre + > map f [x1, x2, ..., xn] == [f x1, f x2, ..., f xn] + map f [x1, x2, ...] == [f x1, f x2, ...] +</pre + ></div + ></div + ><div class="top" + ><p class="src" + ><span class="keyword" + >class</span + > <a name="t:Monad" class="def" + >Monad</a + > m <span class="keyword" + >where</span + ></p + ><div class="doc" + ><p + >The <code + ><A HREF="">Monad</a + ></code + > class defines the basic operations over a <em + >monad</em + >, +a concept from a branch of mathematics known as <em + >category theory</em + >. +From the perspective of a Haskell programmer, however, it is best to +think of a monad as an <em + >abstract datatype</em + > of actions. +Haskell's <code + >do</code + > expressions provide a convenient syntax for writing +monadic expressions. +</p + ><p + >Minimal complete definition: <code + ><A HREF="">>>=</a + ></code + > and <code + ><A HREF="">return</a + ></code + >. +</p + ><p + >Instances of <code + ><A HREF="">Monad</a + ></code + > should satisfy the following laws: +</p + ><pre + > return a >>= k == k a + m >>= return == m + m >>= (\x -> k x >>= h) == (m >>= k) >>= h +</pre + ><p + >Instances of both <code + ><A HREF="">Monad</a + ></code + > and <code + ><A HREF="">Functor</a + ></code + > should additionally satisfy the law: +</p + ><pre + > fmap f xs == xs >>= return . f +</pre + ><p + >The instances of <code + ><A HREF="">Monad</a + ></code + > for lists, <code + >Data.Maybe.Maybe</code + > and <code + >System.IO.IO</code + > +defined in the <A HREF="">Prelude</a + > satisfy these laws. +</p + ></div + ><div class="subs methods" + ><p class="caption" + >Methods</p + ><p class="src" + ><a name="v:-62--62--61-" class="def" + >(>>=)</a + > :: m a -> (a -> m b) -> m b</p + ><div class="doc" + ><p + >Sequentially compose two actions, passing any value produced + by the first as an argument to the second. +</p + ></div + ><p class="src" + ><a name="v:-62--62-" class="def" + >(>>)</a + > :: m a -> m b -> m b</p + ><div class="doc" + ><p + >Sequentially compose two actions, discarding any value produced + by the first, like sequencing operators (such as the semicolon) + in imperative languages. +</p + ></div + ><p class="src" + ><a name="v:return" class="def" + >return</a + > :: a -> m a</p + ><div class="doc" + ><p + >Inject a value into the monadic type. +</p + ></div + ><p class="src" + ><a name="v:fail" class="def" + >fail</a + > :: <A HREF="">String</a + > -> m a</p + ><div class="doc" + ><p + >Fail with a message. This operation is not part of the + mathematical definition of a monad, but is invoked on pattern-match + failure in a <code + >do</code + > expression. +</p + ></div + ></div + ><div class="subs instances" + ><p id="control.i:Monad" class="caption collapser" onclick="toggleSection('i:Monad')" + >Instances</p + ><div id="section.i:Monad" class="show" + ><table + ><tr + ><td class="src" + ><A HREF="">Monad</a + > []</td + ><td class="doc empty" + > </td + ></tr + ><tr + ><td class="src" + ><A HREF="">Monad</a + > <A HREF="">IO</a + ></td + ><td class="doc empty" + > </td + ></tr + ><tr + ><td class="src" + ><A HREF="">Monad</a + > Q</td + ><td class="doc empty" + > </td + ></tr + ><tr + ><td class="src" + ><A HREF="">Monad</a + > <A HREF="">Maybe</a + ></td + ><td class="doc empty" + > </td + ></tr + ><tr + ><td class="src" + ><A HREF="">Monad</a + > ((->) r)</td + ><td class="doc empty" + > </td + ></tr + ><tr + ><td class="src" + ><A HREF="">Monad</a + > (<A HREF="">Either</a + > e)</td + ><td class="doc empty" + > </td + ></tr + ></table + ></div + ></div + ></div + ><div class="top" + ><p class="src" + ><a name="v:runInteractiveProcess" class="def" + >runInteractiveProcess</a + ></p + ><div class="subs arguments" + ><p class="caption" + >Arguments</p + ><table + ><tr + ><td class="src" + >:: <A HREF="">FilePath</a + ></td + ><td class="doc" + ><p + >Filename of the executable +</p + ></td + ></tr + ><tr + ><td class="src" + >-> [<A HREF="">String</a + >]</td + ><td class="doc" + ><p + >Arguments to pass to the executable +</p + ></td + ></tr + ><tr + ><td class="src" + >-> <A HREF="">Maybe</a + > <A HREF="">FilePath</a + ></td + ><td class="doc" + ><p + >Optional path to the working directory +</p + ></td + ></tr + ><tr + ><td class="src" + >-> <A HREF="">Maybe</a + > [(<A HREF="">String</a + >, <A HREF="">String</a + >)]</td + ><td class="doc" + ><p + >Optional environment (otherwise inherit) +</p + ></td + ></tr + ><tr + ><td class="src" + >-> <A HREF="">IO</a + > (<A HREF="">Handle</a + >, <A HREF="">Handle</a + >, <A HREF="">Handle</a + >, <A HREF="">ProcessHandle</a + >)</td + ><td class="doc empty" + > </td + ></tr + ></table + ></div + ><div class="doc" + ><p + >Runs a raw command, and returns <code + ><A HREF="">Handle</a + ></code + >s that may be used to communicate + with the process via its <code + >stdin</code + >, <code + >stdout</code + > and <code + >stderr</code + > respectively. +</p + ><p + >For example, to start a process and feed a string to its stdin: +</p + ><pre + > (inp,out,err,pid) <- runInteractiveProcess "..." + forkIO (hPutStr inp str) +</pre + ><p + >The <code + ><A HREF="">Handle</a + ></code + >s are initially in binary mode; if you need them to be + in text mode then use <code + ><A HREF="">hSetBinaryMode</a + ></code + >. +</p + ></div + ></div + ></div + ></div + ><div id="footer" + ><p + >Produced by <A HREF="">Haddock</a + > version 2.8.2</p + ></div + ></body + ></html +> diff --git a/tests/html-tests/tests/Examples.hs b/tests/html-tests/tests/Examples.hs new file mode 100644 index 00000000..7b703428 --- /dev/null +++ b/tests/html-tests/tests/Examples.hs @@ -0,0 +1,34 @@ +module Examples where + +-- | Fibonacci number of given 'Integer'. +-- +-- Examples: +-- +-- >>> fib 5 +-- 5 +-- >>> fib 10 +-- 55 +-- +-- >>> fib 10 +-- 55 +-- +-- One more Example: +-- +-- >>> fib 5 +-- 5 +-- +-- One more Example: +-- +-- >>> fib 5 +-- 5 +-- +-- Example with an import: +-- +-- >>> import Data.Char +-- >>> isSpace 'a' +-- False +-- +fib :: Integer -> Integer +fib 0 = 0 +fib 1 = 1 +fib n = fib (n - 1) + fib (n - 2) diff --git a/tests/html-tests/tests/Examples.html.ref b/tests/html-tests/tests/Examples.html.ref new file mode 100644 index 00000000..49383b7a --- /dev/null +++ b/tests/html-tests/tests/Examples.html.ref @@ -0,0 +1,150 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" +><head + ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" + /><title + >Examples</title + ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" + /><script src="haddock-util.js" type="text/javascript" + ></script + ><script type="text/javascript" + >//<![CDATA[ +window.onload = function () {pageLoad();setSynopsis("mini_Examples.html");}; +//]]> +</script + ></head + ><body + ><div id="package-header" + ><ul class="links" id="page-menu" + ><li + ><A HREF="">Contents</a + ></li + ><li + ><A HREF="">Index</a + ></li + ></ul + ><p class="caption" class="empty" + > </p + ></div + ><div id="content" + ><div id="module-header" + ><p class="caption" + >Examples</p + ></div + ><div id="synopsis" + ><p id="control.syn" class="caption expander" onclick="toggleSection('syn')" + >Synopsis</p + ><ul id="section.syn" class="hide" onclick="toggleSection('syn')" + ><li class="src short" + ><A HREF="">fib</a + > :: <A HREF="">Integer</a + > -> <A HREF="">Integer</a + ></li + ></ul + ></div + ><div id="interface" + ><h1 + >Documentation</h1 + ><div class="top" + ><p class="src" + ><a name="v:fib" class="def" + >fib</a + > :: <A HREF="">Integer</a + > -> <A HREF="">Integer</a + ></p + ><div class="doc" + ><p + >Fibonacci number of given <code + ><A HREF="">Integer</a + ></code + >. +</p + ><p + >Examples: +</p + ><pre class="screen" + ><code class="prompt" + >>>> </code + ><strong class="userinput" + ><code + >fib 5 +</code + ></strong + >5 +<code class="prompt" + >>>> </code + ><strong class="userinput" + ><code + >fib 10 +</code + ></strong + >55 +</pre + ><pre class="screen" + ><code class="prompt" + >>>> </code + ><strong class="userinput" + ><code + >fib 10 +</code + ></strong + >55 +</pre + ><p + >One more Example: +</p + ><pre class="screen" + ><code class="prompt" + >>>> </code + ><strong class="userinput" + ><code + >fib 5 +</code + ></strong + >5 +</pre + ><p + >One more Example: +</p + ><pre class="screen" + ><code class="prompt" + >>>> </code + ><strong class="userinput" + ><code + >fib 5 +</code + ></strong + >5 +</pre + ><p + >Example with an import: +</p + ><pre class="screen" + ><code class="prompt" + >>>> </code + ><strong class="userinput" + ><code + >import Data.Char +</code + ></strong + ><code class="prompt" + >>>> </code + ><strong class="userinput" + ><code + >isSpace 'a' +</code + ></strong + >False +</pre + ></div + ></div + ></div + ></div + ><div id="footer" + ><p + >Produced by <A HREF="">Haddock</a + > version 2.8.2</p + ></div + ></body + ></html +> diff --git a/tests/html-tests/tests/FunArgs.hs b/tests/html-tests/tests/FunArgs.hs new file mode 100644 index 00000000..b34d84b7 --- /dev/null +++ b/tests/html-tests/tests/FunArgs.hs @@ -0,0 +1,16 @@ +module FunArgs where + +f :: forall a. Ord a + => Int -- ^ First argument + -> a -- ^ Second argument + -> Bool -- ^ Third argument + -> (a -> a) -- ^ Fourth argument + -> () -- ^ Result +f = undefined + + +g :: a -- ^ First argument + -> b -- ^ Second argument + -> c -- ^ Third argument + -> d -- ^ Result +g = undefined diff --git a/tests/html-tests/tests/FunArgs.html.ref b/tests/html-tests/tests/FunArgs.html.ref new file mode 100644 index 00000000..392ffca8 --- /dev/null +++ b/tests/html-tests/tests/FunArgs.html.ref @@ -0,0 +1,163 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" +><head + ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" + /><title + >FunArgs</title + ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" + /><script src="haddock-util.js" type="text/javascript" + ></script + ><script type="text/javascript" + >//<![CDATA[ +window.onload = function () {pageLoad();setSynopsis("mini_FunArgs.html");}; +//]]> +</script + ></head + ><body + ><div id="package-header" + ><ul class="links" id="page-menu" + ><li + ><A HREF="">Contents</a + ></li + ><li + ><A HREF="">Index</a + ></li + ></ul + ><p class="caption" class="empty" + > </p + ></div + ><div id="content" + ><div id="module-header" + ><p class="caption" + >FunArgs</p + ></div + ><div id="interface" + ><h1 + >Documentation</h1 + ><div class="top" + ><p class="src" + ><a name="v:f" class="def" + >f</a + ></p + ><div class="subs arguments" + ><p class="caption" + >Arguments</p + ><table + ><tr + ><td class="src" + >:: <span class="keyword" + >forall</span + > a . <A HREF="">Ord</a + > a</td + ><td class="doc empty" + > </td + ></tr + ><tr + ><td class="src" + >=> <A HREF="">Int</a + ></td + ><td class="doc" + ><p + >First argument +</p + ></td + ></tr + ><tr + ><td class="src" + >-> a</td + ><td class="doc" + ><p + >Second argument +</p + ></td + ></tr + ><tr + ><td class="src" + >-> <A HREF="">Bool</a + ></td + ><td class="doc" + ><p + >Third argument +</p + ></td + ></tr + ><tr + ><td class="src" + >-> (a -> a)</td + ><td class="doc" + ><p + >Fourth argument +</p + ></td + ></tr + ><tr + ><td class="src" + >-> <A HREF="">()</a + ></td + ><td class="doc" + ><p + >Result +</p + ></td + ></tr + ></table + ></div + ></div + ><div class="top" + ><p class="src" + ><a name="v:g" class="def" + >g</a + ></p + ><div class="subs arguments" + ><p class="caption" + >Arguments</p + ><table + ><tr + ><td class="src" + >:: a</td + ><td class="doc" + ><p + >First argument +</p + ></td + ></tr + ><tr + ><td class="src" + >-> b</td + ><td class="doc" + ><p + >Second argument +</p + ></td + ></tr + ><tr + ><td class="src" + >-> c</td + ><td class="doc" + ><p + >Third argument +</p + ></td + ></tr + ><tr + ><td class="src" + >-> d</td + ><td class="doc" + ><p + >Result +</p + ></td + ></tr + ></table + ></div + ></div + ></div + ></div + ><div id="footer" + ><p + >Produced by <A HREF="">Haddock</a + > version 2.8.2</p + ></div + ></body + ></html +> diff --git a/tests/html-tests/tests/GADTRecords.hs b/tests/html-tests/tests/GADTRecords.hs new file mode 100644 index 00000000..c77810ad --- /dev/null +++ b/tests/html-tests/tests/GADTRecords.hs @@ -0,0 +1,12 @@ +{-# LANGUAGE GADTs #-} +module GADTRecords (H1(..)) where + +-- | h1 +data H1 a b where + C1 :: H1 a b + C2 :: Ord a => [a] -> H1 a a + C3 { field :: Int -- ^ hello docs + } :: H1 Int Int + C4 { field2 :: a -- ^ hello2 docs + } :: H1 Int a + diff --git a/tests/html-tests/tests/GADTRecords.html.ref b/tests/html-tests/tests/GADTRecords.html.ref new file mode 100644 index 00000000..fe80fae2 --- /dev/null +++ b/tests/html-tests/tests/GADTRecords.html.ref @@ -0,0 +1,197 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" +><head + ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" + /><title + >GADTRecords</title + ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" + /><script src="haddock-util.js" type="text/javascript" + ></script + ><script type="text/javascript" + >//<![CDATA[ +window.onload = function () {pageLoad();setSynopsis("mini_GADTRecords.html");}; +//]]> +</script + ></head + ><body + ><div id="package-header" + ><ul class="links" id="page-menu" + ><li + ><A HREF="">Contents</a + ></li + ><li + ><A HREF="">Index</a + ></li + ></ul + ><p class="caption" class="empty" + > </p + ></div + ><div id="content" + ><div id="module-header" + ><p class="caption" + >GADTRecords</p + ></div + ><div id="synopsis" + ><p id="control.syn" class="caption expander" onclick="toggleSection('syn')" + >Synopsis</p + ><ul id="section.syn" class="hide" onclick="toggleSection('syn')" + ><li class="src short" + ><span class="keyword" + >data</span + > <A HREF="">H1</a + > a b <span class="keyword" + >where</span + ><ul class="subs" + ><li + ><A HREF="">C1</a + > :: <A HREF="">H1</a + > a b </li + ><li + ><A HREF="">C2</a + > :: <A HREF="">Ord</a + > a => [a] -> <A HREF="">H1</a + > a a </li + ><li + ><A HREF="">C3</a + > :: { <ul class="subs" + ><li + ><A HREF="">field</a + > :: <A HREF="">Int</a + ></li + ></ul + > } -> <A HREF="">H1</a + > <A HREF="">Int</a + > <A HREF="">Int</a + ></li + ><li + ><A HREF="">C4</a + > :: { <ul class="subs" + ><li + ><A HREF="">field2</a + > :: a</li + ></ul + > } -> <A HREF="">H1</a + > <A HREF="">Int</a + > a</li + ></ul + ></li + ></ul + ></div + ><div id="interface" + ><h1 + >Documentation</h1 + ><div class="top" + ><p class="src" + ><span class="keyword" + >data</span + > <a name="t:H1" class="def" + >H1</a + > a b <span class="keyword" + >where</span + ></p + ><div class="doc" + ><p + >h1 +</p + ></div + ><div class="subs constructors" + ><p class="caption" + >Constructors</p + ><table + ><tr + ><td class="src" + ><a name="v:C1" class="def" + >C1</a + > :: <A HREF="">H1</a + > a b</td + ><td class="doc empty" + > </td + ></tr + ><tr + ><td class="src" + ><a name="v:C2" class="def" + >C2</a + > :: <A HREF="">Ord</a + > a => [a] -> <A HREF="">H1</a + > a a</td + ><td class="doc empty" + > </td + ></tr + ><tr + ><td class="src" + ><a name="v:C3" class="def" + >C3</a + > :: <A HREF="">Int</a + > -> <A HREF="">H1</a + > <A HREF="">Int</a + > <A HREF="">Int</a + ></td + ><td class="doc empty" + > </td + ></tr + ><tr + ><td colspan="2" + ><div class="subs fields" + ><p class="caption" + >Fields</p + ><dl + ><dt class="src" + ><a name="v:field" class="def" + >field</a + > :: <A HREF="">Int</a + ></dt + ><dd class="doc" + ><p + >hello docs +</p + ></dd + ></dl + ><div class="clear" + ></div + ></div + ></td + ></tr + ><tr + ><td class="src" + ><a name="v:C4" class="def" + >C4</a + > :: a -> <A HREF="">H1</a + > <A HREF="">Int</a + > a</td + ><td class="doc empty" + > </td + ></tr + ><tr + ><td colspan="2" + ><div class="subs fields" + ><p class="caption" + >Fields</p + ><dl + ><dt class="src" + ><a name="v:field2" class="def" + >field2</a + > :: a</dt + ><dd class="doc" + ><p + >hello2 docs +</p + ></dd + ></dl + ><div class="clear" + ></div + ></div + ></td + ></tr + ></table + ></div + ></div + ></div + ></div + ><div id="footer" + ><p + >Produced by <A HREF="">Haddock</a + > version 2.8.2</p + ></div + ></body + ></html +> diff --git a/tests/html-tests/tests/Hash.hs b/tests/html-tests/tests/Hash.hs new file mode 100644 index 00000000..7d6506f9 --- /dev/null +++ b/tests/html-tests/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/html-tests/tests/Hash.html.ref b/tests/html-tests/tests/Hash.html.ref new file mode 100644 index 00000000..1bb64d42 --- /dev/null +++ b/tests/html-tests/tests/Hash.html.ref @@ -0,0 +1,284 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" +><head + ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" + /><title + >Hash</title + ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" + /><script src="haddock-util.js" type="text/javascript" + ></script + ><script type="text/javascript" + >//<![CDATA[ +window.onload = function () {pageLoad();setSynopsis("mini_Hash.html");}; +//]]> +</script + ></head + ><body + ><div id="package-header" + ><ul class="links" id="page-menu" + ><li + ><A HREF="">Contents</a + ></li + ><li + ><A HREF="">Index</a + ></li + ></ul + ><p class="caption" class="empty" + > </p + ></div + ><div id="content" + ><div id="module-header" + ><p class="caption" + >Hash</p + ></div + ><div id="table-of-contents" + ><p class="caption" + >Contents</p + ><ul + ><li + ><A HREF="">The <code + >HashTable</code + > type +</a + ><ul + ><li + ><A HREF="">Operations on <code + >HashTable</code + >s +</a + ></li + ></ul + ></li + ><li + ><A HREF="">The <code + >Hash</code + > class +</a + ></li + ></ul + ></div + ><div id="description" + ><p class="caption" + >Description</p + ><div class="doc" + ><p + >Implementation of fixed-size hash tables, with a type + class for constructing hash values for structured types. +</p + ></div + ></div + ><div id="synopsis" + ><p id="control.syn" class="caption expander" onclick="toggleSection('syn')" + >Synopsis</p + ><ul id="section.syn" class="hide" onclick="toggleSection('syn')" + ><li class="src short" + ><span class="keyword" + >data</span + > <A HREF="">HashTable</a + > key val</li + ><li class="src short" + ><A HREF="">new</a + > :: (<A HREF="">Eq</a + > key, <A HREF="">Hash</a + > key) => <A HREF="">Int</a + > -> <A HREF="">IO</a + > (<A HREF="">HashTable</a + > key val)</li + ><li class="src short" + ><A HREF="">insert</a + > :: (<A HREF="">Eq</a + > key, <A HREF="">Hash</a + > key) => key -> val -> <A HREF="">IO</a + > <A HREF="">()</a + ></li + ><li class="src short" + ><A HREF="">lookup</a + > :: <A HREF="">Hash</a + > key => key -> <A HREF="">IO</a + > (<A HREF="">Maybe</a + > val)</li + ><li class="src short" + ><span class="keyword" + >class</span + > <A HREF="">Hash</a + > a <span class="keyword" + >where</span + ><ul class="subs" + ><li + ><A HREF="">hash</a + > :: a -> <A HREF="">Int</a + ></li + ></ul + ></li + ></ul + ></div + ><div id="interface" + ><h1 id="g:1" + >The <code + >HashTable</code + > type +</h1 + ><div class="top" + ><p class="src" + ><span class="keyword" + >data</span + > <a name="t:HashTable" class="def" + >HashTable</a + > key val </p + ><div class="doc" + ><p + >A hash table with keys of type <code + >key</code + > and values of type <code + >val</code + >. + The type <code + >key</code + > should be an instance of <code + ><A HREF="">Eq</a + ></code + >. +</p + ></div + ></div + ><h2 id="g:2" + >Operations on <code + >HashTable</code + >s +</h2 + ><div class="top" + ><p class="src" + ><a name="v:new" class="def" + >new</a + > :: (<A HREF="">Eq</a + > key, <A HREF="">Hash</a + > key) => <A HREF="">Int</a + > -> <A HREF="">IO</a + > (<A HREF="">HashTable</a + > key val)</p + ><div class="doc" + ><p + >Builds a new hash table with a given size +</p + ></div + ></div + ><div class="top" + ><p class="src" + ><a name="v:insert" class="def" + >insert</a + > :: (<A HREF="">Eq</a + > key, <A HREF="">Hash</a + > key) => key -> val -> <A HREF="">IO</a + > <A HREF="">()</a + ></p + ><div class="doc" + ><p + >Inserts a new element into the hash table +</p + ></div + ></div + ><div class="top" + ><p class="src" + ><a name="v:lookup" class="def" + >lookup</a + > :: <A HREF="">Hash</a + > key => key -> <A HREF="">IO</a + > (<A HREF="">Maybe</a + > val)</p + ><div class="doc" + ><p + >Looks up a key in the hash table, returns <code + ><code + ><A HREF="">Just</a + ></code + > val</code + > if the key + was found, or <code + ><A HREF="">Nothing</a + ></code + > otherwise. +</p + ></div + ></div + ><h1 id="g:3" + >The <code + >Hash</code + > class +</h1 + ><div class="top" + ><p class="src" + ><span class="keyword" + >class</span + > <a name="t:Hash" class="def" + >Hash</a + > a <span class="keyword" + >where</span + ></p + ><div class="doc" + ><p + >A class of types which can be hashed. +</p + ></div + ><div class="subs methods" + ><p class="caption" + >Methods</p + ><p class="src" + ><a name="v:hash" class="def" + >hash</a + > :: a -> <A HREF="">Int</a + ></p + ><div class="doc" + ><p + >hashes the value of type <code + >a</code + > into an <code + ><A HREF="">Int</a + ></code + > +</p + ></div + ></div + ><div class="subs instances" + ><p id="control.i:Hash" class="caption collapser" onclick="toggleSection('i:Hash')" + >Instances</p + ><div id="section.i:Hash" class="show" + ><table + ><tr + ><td class="src" + ><A HREF="">Hash</a + > <A HREF="">Float</a + ></td + ><td class="doc empty" + > </td + ></tr + ><tr + ><td class="src" + ><A HREF="">Hash</a + > <A HREF="">Int</a + ></td + ><td class="doc empty" + > </td + ></tr + ><tr + ><td class="src" + >(<A HREF="">Hash</a + > a, <A HREF="">Hash</a + > b) => <A HREF="">Hash</a + > (a, b)</td + ><td class="doc empty" + > </td + ></tr + ></table + ></div + ></div + ></div + ></div + ></div + ><div id="footer" + ><p + >Produced by <A HREF="">Haddock</a + > version 2.8.2</p + ></div + ></body + ></html +> diff --git a/tests/html-tests/tests/Hidden.hs b/tests/html-tests/tests/Hidden.hs new file mode 100644 index 00000000..896da648 --- /dev/null +++ b/tests/html-tests/tests/Hidden.hs @@ -0,0 +1,6 @@ +{-# OPTIONS_HADDOCK hide #-} + +module Hidden where + +hidden :: Int -> Int +hidden a = a diff --git a/tests/html-tests/tests/NamedDoc.hs b/tests/html-tests/tests/NamedDoc.hs new file mode 100644 index 00000000..7c04ba72 --- /dev/null +++ b/tests/html-tests/tests/NamedDoc.hs @@ -0,0 +1,4 @@ +module NamedDoc where + +-- $foo bar + diff --git a/tests/html-tests/tests/NamedDoc.html.ref b/tests/html-tests/tests/NamedDoc.html.ref new file mode 100644 index 00000000..4c514487 --- /dev/null +++ b/tests/html-tests/tests/NamedDoc.html.ref @@ -0,0 +1,57 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" +><head + ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" + /><title + >NamedDoc</title + ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" + /><script src="haddock-util.js" type="text/javascript" + ></script + ><script type="text/javascript" + >//<![CDATA[ +window.onload = function () {pageLoad();setSynopsis("mini_NamedDoc.html");}; +//]]> +</script + ></head + ><body + ><div id="package-header" + ><ul class="links" id="page-menu" + ><li + ><A HREF="">Contents</a + ></li + ><li + ><A HREF="">Index</a + ></li + ></ul + ><p class="caption" class="empty" + > </p + ></div + ><div id="content" + ><div id="module-header" + ><p class="caption" + >NamedDoc</p + ></div + ><div id="synopsis" + ><p id="control.syn" class="caption expander" onclick="toggleSection('syn')" + >Synopsis</p + ><ul id="section.syn" class="hide" onclick="toggleSection('syn')" + ></ul + ></div + ><div id="interface" + ><h1 + >Documentation</h1 + ><div class="doc" + ><p + >bar +</p + ></div + ></div + ></div + ><div id="footer" + ><p + >Produced by <A HREF="">Haddock</a + > version 2.8.2</p + ></div + ></body + ></html +> diff --git a/tests/html-tests/tests/NoLayout.hs b/tests/html-tests/tests/NoLayout.hs new file mode 100644 index 00000000..19b38b1d --- /dev/null +++ b/tests/html-tests/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 function 'g' + ; + g :: Int; + g = undefined + } + diff --git a/tests/html-tests/tests/NoLayout.html.ref b/tests/html-tests/tests/NoLayout.html.ref new file mode 100644 index 00000000..cb073bf6 --- /dev/null +++ b/tests/html-tests/tests/NoLayout.html.ref @@ -0,0 +1,71 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" +><head + ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" + /><title + >NoLayout</title + ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" + /><script src="haddock-util.js" type="text/javascript" + ></script + ><script type="text/javascript" + >//<![CDATA[ +window.onload = function () {pageLoad();setSynopsis("mini_NoLayout.html");}; +//]]> +</script + ></head + ><body + ><div id="package-header" + ><ul class="links" id="page-menu" + ><li + ><A HREF="">Contents</a + ></li + ><li + ><A HREF="">Index</a + ></li + ></ul + ><p class="caption" class="empty" + > </p + ></div + ><div id="content" + ><div id="module-header" + ><p class="caption" + >NoLayout</p + ></div + ><div id="synopsis" + ><p id="control.syn" class="caption expander" onclick="toggleSection('syn')" + >Synopsis</p + ><ul id="section.syn" class="hide" onclick="toggleSection('syn')" + ><li class="src short" + ><A HREF="">g</a + > :: <A HREF="">Int</a + ></li + ></ul + ></div + ><div id="interface" + ><h1 + >Documentation</h1 + ><div class="top" + ><p class="src" + ><a name="v:g" class="def" + >g</a + > :: <A HREF="">Int</a + ></p + ><div class="doc" + ><p + >the function <code + ><A HREF="">g</a + ></code + > +</p + ></div + ></div + ></div + ></div + ><div id="footer" + ><p + >Produced by <A HREF="">Haddock</a + > version 2.8.2</p + ></div + ></body + ></html +> diff --git a/tests/html-tests/tests/NonGreedy.hs b/tests/html-tests/tests/NonGreedy.hs new file mode 100644 index 00000000..f51b55f5 --- /dev/null +++ b/tests/html-tests/tests/NonGreedy.hs @@ -0,0 +1,5 @@ +module NonGreedy where + +-- | <url1> <url2> +f :: a +f = undefined diff --git a/tests/html-tests/tests/NonGreedy.html.ref b/tests/html-tests/tests/NonGreedy.html.ref new file mode 100644 index 00000000..9e39b7c3 --- /dev/null +++ b/tests/html-tests/tests/NonGreedy.html.ref @@ -0,0 +1,68 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" +><head + ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" + /><title + >NonGreedy</title + ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" + /><script src="haddock-util.js" type="text/javascript" + ></script + ><script type="text/javascript" + >//<![CDATA[ +window.onload = function () {pageLoad();setSynopsis("mini_NonGreedy.html");}; +//]]> +</script + ></head + ><body + ><div id="package-header" + ><ul class="links" id="page-menu" + ><li + ><A HREF="">Contents</a + ></li + ><li + ><A HREF="">Index</a + ></li + ></ul + ><p class="caption" class="empty" + > </p + ></div + ><div id="content" + ><div id="module-header" + ><p class="caption" + >NonGreedy</p + ></div + ><div id="synopsis" + ><p id="control.syn" class="caption expander" onclick="toggleSection('syn')" + >Synopsis</p + ><ul id="section.syn" class="hide" onclick="toggleSection('syn')" + ><li class="src short" + ><A HREF="">f</a + > :: a</li + ></ul + ></div + ><div id="interface" + ><h1 + >Documentation</h1 + ><div class="top" + ><p class="src" + ><a name="v:f" class="def" + >f</a + > :: a</p + ><div class="doc" + ><p + ><A HREF="">url1</a + > <A HREF="">url2</a + > +</p + ></div + ></div + ></div + ></div + ><div id="footer" + ><p + >Produced by <A HREF="">Haddock</a + > version 2.8.2</p + ></div + ></body + ></html +> diff --git a/tests/html-tests/tests/QuasiExpr.hs b/tests/html-tests/tests/QuasiExpr.hs new file mode 100644 index 00000000..970759ba --- /dev/null +++ b/tests/html-tests/tests/QuasiExpr.hs @@ -0,0 +1,34 @@ +{-# LANGUAGE TemplateHaskell #-} + +-- Used by QuasiQuote. Example taken from the GHC documentation. +module QuasiExpr where + +import Language.Haskell.TH +import Language.Haskell.TH.Quote + +data Expr = IntExpr Integer + | AntiIntExpr String + | BinopExpr BinOp Expr Expr + | AntiExpr String + deriving Show + +data BinOp = AddOp + | SubOp + | MulOp + | DivOp + deriving Show + +eval :: Expr -> Integer +eval (IntExpr n) = n +eval (BinopExpr op x y) = (opToFun op) (eval x) (eval y) + where + opToFun AddOp = (+) + opToFun SubOp = (-) + opToFun MulOp = (*) + opToFun DivOp = div + +expr = QuasiQuoter parseExprExp undefined undefined undefined + +-- cheating... +parseExprExp :: String -> Q Exp +parseExprExp _ = [| BinopExpr AddOp (IntExpr 1) (IntExpr 2) |] diff --git a/tests/html-tests/tests/QuasiExpr.html.ref b/tests/html-tests/tests/QuasiExpr.html.ref new file mode 100644 index 00000000..321631e4 --- /dev/null +++ b/tests/html-tests/tests/QuasiExpr.html.ref @@ -0,0 +1,191 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" +><head + ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" + /><title + >QuasiExpr</title + ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" + /><script src="haddock-util.js" type="text/javascript" + ></script + ><script type="text/javascript" + >//<![CDATA[ +window.onload = function () {pageLoad();setSynopsis("mini_QuasiExpr.html");}; +//]]> +</script + ></head + ><body + ><div id="package-header" + ><ul class="links" id="page-menu" + ><li + ><A HREF="">Contents</a + ></li + ><li + ><A HREF="">Index</a + ></li + ></ul + ><p class="caption" class="empty" + > </p + ></div + ><div id="content" + ><div id="module-header" + ><p class="caption" + >QuasiExpr</p + ></div + ><div id="interface" + ><h1 + >Documentation</h1 + ><div class="top" + ><p class="src" + ><span class="keyword" + >data</span + > <a name="t:Expr" class="def" + >Expr</a + > </p + ><div class="subs constructors" + ><p class="caption" + >Constructors</p + ><table + ><tr + ><td class="src" + ><a name="v:IntExpr" class="def" + >IntExpr</a + > <A HREF="">Integer</a + ></td + ><td class="doc empty" + > </td + ></tr + ><tr + ><td class="src" + ><a name="v:AntiIntExpr" class="def" + >AntiIntExpr</a + > <A HREF="">String</a + ></td + ><td class="doc empty" + > </td + ></tr + ><tr + ><td class="src" + ><a name="v:BinopExpr" class="def" + >BinopExpr</a + > <A HREF="">BinOp</a + > <A HREF="">Expr</a + > <A HREF="">Expr</a + ></td + ><td class="doc empty" + > </td + ></tr + ><tr + ><td class="src" + ><a name="v:AntiExpr" class="def" + >AntiExpr</a + > <A HREF="">String</a + ></td + ><td class="doc empty" + > </td + ></tr + ></table + ></div + ><div class="subs instances" + ><p id="control.i:Expr" class="caption collapser" onclick="toggleSection('i:Expr')" + >Instances</p + ><div id="section.i:Expr" class="show" + ><table + ><tr + ><td class="src" + ><A HREF="">Show</a + > <A HREF="">Expr</a + ></td + ><td class="doc empty" + > </td + ></tr + ></table + ></div + ></div + ></div + ><div class="top" + ><p class="src" + ><span class="keyword" + >data</span + > <a name="t:BinOp" class="def" + >BinOp</a + > </p + ><div class="subs constructors" + ><p class="caption" + >Constructors</p + ><table + ><tr + ><td class="src" + ><a name="v:AddOp" class="def" + >AddOp</a + ></td + ><td class="doc empty" + > </td + ></tr + ><tr + ><td class="src" + ><a name="v:SubOp" class="def" + >SubOp</a + ></td + ><td class="doc empty" + > </td + ></tr + ><tr + ><td class="src" + ><a name="v:MulOp" class="def" + >MulOp</a + ></td + ><td class="doc empty" + > </td + ></tr + ><tr + ><td class="src" + ><a name="v:DivOp" class="def" + >DivOp</a + ></td + ><td class="doc empty" + > </td + ></tr + ></table + ></div + ><div class="subs instances" + ><p id="control.i:BinOp" class="caption collapser" onclick="toggleSection('i:BinOp')" + >Instances</p + ><div id="section.i:BinOp" class="show" + ><table + ><tr + ><td class="src" + ><A HREF="">Show</a + > <A HREF="">BinOp</a + ></td + ><td class="doc empty" + > </td + ></tr + ></table + ></div + ></div + ></div + ><div class="top" + ><p class="src" + ><a name="v:eval" class="def" + >eval</a + > :: <A HREF="">Expr</a + > -> <A HREF="">Integer</a + ></p + ></div + ><div class="top" + ><p class="src" + ><a name="v:parseExprExp" class="def" + >parseExprExp</a + > :: <A HREF="">String</a + > -> Q Exp</p + ></div + ></div + ></div + ><div id="footer" + ><p + >Produced by <A HREF="">Haddock</a + > version 2.8.2</p + ></div + ></body + ></html +> diff --git a/tests/html-tests/tests/QuasiQuote.hs b/tests/html-tests/tests/QuasiQuote.hs new file mode 100644 index 00000000..06762cf9 --- /dev/null +++ b/tests/html-tests/tests/QuasiQuote.hs @@ -0,0 +1,9 @@ +{-# LANGUAGE TemplateHaskell, QuasiQuotes #-} + +-- example taken from the GHC documentation +module QuasiQuote where + +import QuasiExpr + +val :: Integer +val = eval [expr|1 + 2|] diff --git a/tests/html-tests/tests/QuasiQuote.html.ref b/tests/html-tests/tests/QuasiQuote.html.ref new file mode 100644 index 00000000..e1159268 --- /dev/null +++ b/tests/html-tests/tests/QuasiQuote.html.ref @@ -0,0 +1,53 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" +><head + ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" + /><title + >QuasiQuote</title + ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" + /><script src="haddock-util.js" type="text/javascript" + ></script + ><script type="text/javascript" + >//<![CDATA[ +window.onload = function () {pageLoad();setSynopsis("mini_QuasiQuote.html");}; +//]]> +</script + ></head + ><body + ><div id="package-header" + ><ul class="links" id="page-menu" + ><li + ><A HREF="">Contents</a + ></li + ><li + ><A HREF="">Index</a + ></li + ></ul + ><p class="caption" class="empty" + > </p + ></div + ><div id="content" + ><div id="module-header" + ><p class="caption" + >QuasiQuote</p + ></div + ><div id="interface" + ><h1 + >Documentation</h1 + ><div class="top" + ><p class="src" + ><a name="v:val" class="def" + >val</a + > :: <A HREF="">Integer</a + ></p + ></div + ></div + ></div + ><div id="footer" + ><p + >Produced by <A HREF="">Haddock</a + > version 2.8.2</p + ></div + ></body + ></html +> diff --git a/tests/html-tests/tests/TH.hs b/tests/html-tests/tests/TH.hs new file mode 100644 index 00000000..f8178bcb --- /dev/null +++ b/tests/html-tests/tests/TH.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE TemplateHaskell #-} + +module TH where + +import Language.Haskell.TH + +decl :: Q [Dec] +decl = [d| f x = x|] diff --git a/tests/html-tests/tests/TH.html.ref b/tests/html-tests/tests/TH.html.ref new file mode 100644 index 00000000..be948582 --- /dev/null +++ b/tests/html-tests/tests/TH.html.ref @@ -0,0 +1,52 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" +><head + ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" + /><title + >TH</title + ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" + /><script src="haddock-util.js" type="text/javascript" + ></script + ><script type="text/javascript" + >//<![CDATA[ +window.onload = function () {pageLoad();setSynopsis("mini_TH.html");}; +//]]> +</script + ></head + ><body + ><div id="package-header" + ><ul class="links" id="page-menu" + ><li + ><A HREF="">Contents</a + ></li + ><li + ><A HREF="">Index</a + ></li + ></ul + ><p class="caption" class="empty" + > </p + ></div + ><div id="content" + ><div id="module-header" + ><p class="caption" + >TH</p + ></div + ><div id="interface" + ><h1 + >Documentation</h1 + ><div class="top" + ><p class="src" + ><a name="v:decl" class="def" + >decl</a + > :: Q [Dec]</p + ></div + ></div + ></div + ><div id="footer" + ><p + >Produced by <A HREF="">Haddock</a + > version 2.8.2</p + ></div + ></body + ></html +> diff --git a/tests/html-tests/tests/TH2.hs b/tests/html-tests/tests/TH2.hs new file mode 100644 index 00000000..f8f27710 --- /dev/null +++ b/tests/html-tests/tests/TH2.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE TemplateHaskell #-} + +module TH2 where + +import TH + +-- we can't add a type sig here, so we get no doc +$( decl ) diff --git a/tests/html-tests/tests/TH2.html.ref b/tests/html-tests/tests/TH2.html.ref new file mode 100644 index 00000000..950a391b --- /dev/null +++ b/tests/html-tests/tests/TH2.html.ref @@ -0,0 +1,44 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" +><head + ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" + /><title + >TH2</title + ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" + /><script src="haddock-util.js" type="text/javascript" + ></script + ><script type="text/javascript" + >//<![CDATA[ +window.onload = function () {pageLoad();setSynopsis("mini_TH2.html");}; +//]]> +</script + ></head + ><body + ><div id="package-header" + ><ul class="links" id="page-menu" + ><li + ><A HREF="">Contents</a + ></li + ><li + ><A HREF="">Index</a + ></li + ></ul + ><p class="caption" class="empty" + > </p + ></div + ><div id="content" + ><div id="module-header" + ><p class="caption" + >TH2</p + ></div + ><div id="interface" + ></div + ></div + ><div id="footer" + ><p + >Produced by <A HREF="">Haddock</a + > version 2.8.2</p + ></div + ></body + ></html +> diff --git a/tests/html-tests/tests/Test.hs b/tests/html-tests/tests/Test.hs new file mode 100644 index 00000000..d7a0a716 --- /dev/null +++ b/tests/html-tests/tests/Test.hs @@ -0,0 +1,414 @@ +----------------------------------------------------------------------------- +-- | +-- 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) + + [cat] a small, furry, domesticated mammal + + [pineapple] a fruit grown in the tropics + +@ + 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/html-tests/tests/Test.html.ref b/tests/html-tests/tests/Test.html.ref new file mode 100644 index 00000000..2acc5ec8 --- /dev/null +++ b/tests/html-tests/tests/Test.html.ref @@ -0,0 +1,1968 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" +><head + ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" + /><title + >Test</title + ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" + /><script src="haddock-util.js" type="text/javascript" + ></script + ><script type="text/javascript" + >//<![CDATA[ +window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; +//]]> +</script + ></head + ><body + ><div id="package-header" + ><ul class="links" id="page-menu" + ><li + ><A HREF="">Contents</a + ></li + ><li + ><A HREF="">Index</a + ></li + ></ul + ><p class="caption" class="empty" + > </p + ></div + ><div id="content" + ><div id="module-header" + ><table class="info" + ><tr + ><th + >Portability</th + ><td + >portable</td + ></tr + ><tr + ><th + >Stability</th + ><td + >provisional</td + ></tr + ><tr + ><th + >Maintainer</th + ><td + >libraries@haskell.org</td + ></tr + ></table + ><p class="caption" + >Test</p + ></div + ><div id="table-of-contents" + ><p class="caption" + >Contents</p + ><ul + ><li + ><A HREF="">Type declarations +</a + ><ul + ><li + ><A HREF="">Data types +</a + ></li + ><li + ><A HREF="">Records +</a + ></li + ></ul + ></li + ><li + ><A HREF="">Class declarations +</a + ></li + ><li + ><A HREF="">Function types +</a + ></li + ><li + ><A HREF="">Auxiliary stuff +</a + ></li + ><li + ><A HREF="">A hidden module +</a + ></li + ><li + ><A HREF="">A visible module +</a + ></li + ><li + ><A HREF="">Existential / Universal types +</a + ></li + ><li + ><A HREF="">Type signatures with argument docs +</a + ></li + ><li + ><A HREF="">A section +</a + ><ul + ><li + ><A HREF="">A subsection +</a + ></li + ></ul + ></li + ></ul + ></div + ><div id="description" + ><p class="caption" + >Description</p + ><div class="doc" + ><p + >This module illustrates & tests most of the features of Haddock. + Testing references from the description: <code + ><A HREF="">T</a + ></code + >, <code + ><A HREF="">f</a + ></code + >, <code + ><A HREF="">g</a + ></code + >, <code + ><A HREF="">visible</a + ></code + >. +</p + ></div + ></div + ><div id="synopsis" + ><p id="control.syn" class="caption expander" onclick="toggleSection('syn')" + >Synopsis</p + ><ul id="section.syn" class="hide" onclick="toggleSection('syn')" + ><li class="src short" + ><span class="keyword" + >data</span + > <A HREF="">T</a + > a b<ul class="subs" + ><li + >= <A HREF="">A</a + > <A HREF="">Int</a + > (<A HREF="">Maybe</a + > <A HREF="">Float</a + >) </li + ><li + >| <A HREF="">B</a + > (<A HREF="">T</a + > a b, <A HREF="">T</a + > <A HREF="">Int</a + > <A HREF="">Float</a + >) </li + ></ul + ></li + ><li class="src short" + ><span class="keyword" + >data</span + > <A HREF="">T2</a + > a b</li + ><li class="src short" + ><span class="keyword" + >data</span + > <A HREF="">T3</a + > a b<ul class="subs" + ><li + >= <A HREF="">A1</a + > a </li + ><li + >| <A HREF="">B1</a + > b </li + ></ul + ></li + ><li class="src short" + ><span class="keyword" + >data</span + > <A HREF="">T4</a + > a b<ul class="subs" + ><li + >= <A HREF="">A2</a + > a </li + ><li + >| <A HREF="">B2</a + > b </li + ></ul + ></li + ><li class="src short" + ><span class="keyword" + >data</span + > <A HREF="">T5</a + > a b<ul class="subs" + ><li + >= <A HREF="">A3</a + > a </li + ><li + >| <A HREF="">B3</a + > b </li + ></ul + ></li + ><li class="src short" + ><span class="keyword" + >data</span + > <A HREF="">T6</a + > <ul class="subs" + ><li + >= <A HREF="">A4</a + > </li + ><li + >| <A HREF="">B4</a + > </li + ><li + >| <A HREF="">C4</a + > </li + ></ul + ></li + ><li class="src short" + ><span class="keyword" + >newtype</span + > <A HREF="">N1</a + > a = <A HREF="">N1</a + > a</li + ><li class="src short" + ><span class="keyword" + >newtype</span + > <A HREF="">N2</a + > a b = <A HREF="">N2</a + > {<ul class="subs" + ><li + ><A HREF="">n</a + > :: a b</li + ></ul + >}</li + ><li class="src short" + ><span class="keyword" + >newtype</span + > <A HREF="">N3</a + > a b = <A HREF="">N3</a + > {<ul class="subs" + ><li + ><A HREF="">n3</a + > :: a b</li + ></ul + >}</li + ><li class="src short" + ><span class="keyword" + >data</span + > <A HREF="">N4</a + > a b</li + ><li class="src short" + ><span class="keyword" + >newtype</span + > <A HREF="">N5</a + > a b = <A HREF="">N5</a + > {<ul class="subs" + ><li + ><A HREF="">n5</a + > :: a b</li + ></ul + >}</li + ><li class="src short" + ><span class="keyword" + >newtype</span + > <A HREF="">N6</a + > a b = <A HREF="">N6</a + > {<ul class="subs" + ><li + ><A HREF="">n6</a + > :: a b</li + ></ul + >}</li + ><li class="src short" + ><span class="keyword" + >newtype</span + > <A HREF="">N7</a + > a b = <A HREF="">N7</a + > {<ul class="subs" + ><li + ><A HREF="">n7</a + > :: a b</li + ></ul + >}</li + ><li class="src short" + ><span class="keyword" + >data</span + > <A HREF="">R</a + > <ul class="subs" + ><li + >= <A HREF="">C1</a + > { <ul class="subs" + ><li + ><A HREF="">p</a + > :: <A HREF="">Int</a + ></li + ><li + ><A HREF="">q</a + > :: <span class="keyword" + >forall</span + > a. a -> a</li + ><li + ><A HREF="">r</a + > :: <A HREF="">Int</a + ></li + ><li + ><A HREF="">s</a + > :: <A HREF="">Int</a + ></li + ></ul + > }</li + ><li + >| <A HREF="">C2</a + > { <ul class="subs" + ><li + ><A HREF="">t</a + > :: T1 -> <A HREF="">T2</a + > <A HREF="">Int</a + > <A HREF="">Int</a + > -> <A HREF="">T3</a + > <A HREF="">Bool</a + > <A HREF="">Bool</a + > -> <A HREF="">T4</a + > <A HREF="">Float</a + > <A HREF="">Float</a + > -> <A HREF="">T5</a + > <A HREF="">()</a + > <A HREF="">()</a + ></li + ><li + ><A HREF="">u</a + > :: <A HREF="">Int</a + ></li + ><li + ><A HREF="">v</a + > :: <A HREF="">Int</a + ></li + ></ul + > }</li + ></ul + ></li + ><li class="src short" + ><span class="keyword" + >data</span + > <A HREF="">R1</a + > = <A HREF="">C3</a + > {<ul class="subs" + ><li + ><A HREF="">s1</a + > :: <A HREF="">Int</a + ></li + ><li + ><A HREF="">s2</a + > :: <A HREF="">Int</a + ></li + ><li + ><A HREF="">s3</a + > :: <A HREF="">Int</a + ></li + ></ul + >}</li + ><li class="src short" + ><span class="keyword" + >class</span + > <A HREF="">D</a + > a => <A HREF="">C</a + > a <span class="keyword" + >where</span + ><ul class="subs" + ><li + ><A HREF="">a</a + > :: <A HREF="">IO</a + > a</li + ><li + ><A HREF="">b</a + > :: [a]</li + ></ul + ></li + ><li class="src short" + ><span class="keyword" + >class</span + > <A HREF="">D</a + > a <span class="keyword" + >where</span + ><ul class="subs" + ><li + ><A HREF="">d</a + > :: <A HREF="">T</a + > a b</li + ><li + ><A HREF="">e</a + > :: (a, a)</li + ></ul + ></li + ><li class="src short" + ><span class="keyword" + >class</span + > <A HREF="">E</a + > a </li + ><li class="src short" + ><span class="keyword" + >class</span + > <A HREF="">F</a + > a <span class="keyword" + >where</span + ><ul class="subs" + ><li + ><A HREF="">ff</a + > :: a</li + ></ul + ></li + ><li class="src short" + ><A HREF="">f</a + > :: <A HREF="">C</a + > a => a -> <A HREF="">Int</a + ></li + ><li class="src short" + ><A HREF="">g</a + > :: <A HREF="">Int</a + > -> <A HREF="">IO</a + > CInt</li + ><li class="src short" + ><A HREF="">hidden</a + > :: <A HREF="">Int</a + > -> <A HREF="">Int</a + ></li + ><li class="src short" + >module <A HREF="">Visible</a + ></li + ><li class="src short" + ><span class="keyword" + >data</span + > <A HREF="">Ex</a + > a<ul class="subs" + ><li + >= <span class="keyword" + >forall</span + > b . <A HREF="">C</a + > b => <A HREF="">Ex1</a + > b </li + ><li + >| <span class="keyword" + >forall</span + > b . <A HREF="">Ex2</a + > b </li + ><li + >| <span class="keyword" + >forall</span + > b . <A HREF="">C</a + > a => <A HREF="">Ex3</a + > b </li + ><li + >| <A HREF="">Ex4</a + > (<span class="keyword" + >forall</span + > a. a -> a) </li + ></ul + ></li + ><li class="src short" + ><A HREF="">k</a + > :: <A HREF="">T</a + > <A HREF="">()</a + > <A HREF="">()</a + > -> <A HREF="">T2</a + > <A HREF="">Int</a + > <A HREF="">Int</a + > -> (<A HREF="">T3</a + > <A HREF="">Bool</a + > <A HREF="">Bool</a + > -> <A HREF="">T4</a + > <A HREF="">Float</a + > <A HREF="">Float</a + >) -> <A HREF="">T5</a + > <A HREF="">()</a + > <A HREF="">()</a + > -> <A HREF="">IO</a + > <A HREF="">()</a + ></li + ><li class="src short" + ><A HREF="">l</a + > :: (<A HREF="">Int</a + >, <A HREF="">Int</a + >, <A HREF="">Float</a + >) -> <A HREF="">Int</a + ></li + ><li class="src short" + ><A HREF="">m</a + > :: <A HREF="">R</a + > -> <A HREF="">N1</a + > <A HREF="">()</a + > -> <A HREF="">IO</a + > <A HREF="">Int</a + ></li + ><li class="src short" + ><A HREF="">o</a + > :: <A HREF="">Float</a + > -> <A HREF="">IO</a + > <A HREF="">Float</a + ></li + ><li class="src short" + ><A HREF="">f'</a + > :: <A HREF="">Int</a + ></li + ></ul + ></div + ><div id="interface" + ><h1 id="g:1" + >Type declarations +</h1 + ><h2 id="g:2" + >Data types +</h2 + ><div class="top" + ><p class="src" + ><span class="keyword" + >data</span + > <a name="t:T" class="def" + >T</a + > a b </p + ><div class="doc" + ><p + >This comment applies to the <em + >following</em + > declaration + and it continues until the next non-comment line +</p + ></div + ><div class="subs constructors" + ><p class="caption" + >Constructors</p + ><table + ><tr + ><td class="src" + ><a name="v:A" class="def" + >A</a + > <A HREF="">Int</a + > (<A HREF="">Maybe</a + > <A HREF="">Float</a + >)</td + ><td class="doc" + ><p + >This comment describes the <code + ><A HREF="">A</a + ></code + > constructor +</p + ></td + ></tr + ><tr + ><td class="src" + ><a name="v:B" class="def" + >B</a + > (<A HREF="">T</a + > a b, <A HREF="">T</a + > <A HREF="">Int</a + > <A HREF="">Float</a + >)</td + ><td class="doc" + ><p + >This comment describes the <code + ><A HREF="">B</a + ></code + > constructor +</p + ></td + ></tr + ></table + ></div + ></div + ><div class="top" + ><p class="src" + ><span class="keyword" + >data</span + > <a name="t:T2" class="def" + >T2</a + > a b </p + ><div class="doc" + ><p + >An abstract data declaration +</p + ></div + ></div + ><div class="top" + ><p class="src" + ><span class="keyword" + >data</span + > <a name="t:T3" class="def" + >T3</a + > a b </p + ><div class="doc" + ><p + >A data declaration with no documentation annotations on the constructors +</p + ></div + ><div class="subs constructors" + ><p class="caption" + >Constructors</p + ><table + ><tr + ><td class="src" + ><a name="v:A1" class="def" + >A1</a + > a</td + ><td class="doc empty" + > </td + ></tr + ><tr + ><td class="src" + ><a name="v:B1" class="def" + >B1</a + > b</td + ><td class="doc empty" + > </td + ></tr + ></table + ></div + ></div + ><div class="top" + ><p class="src" + ><span class="keyword" + >data</span + > <a name="t:T4" class="def" + >T4</a + > a b </p + ><div class="subs constructors" + ><p class="caption" + >Constructors</p + ><table + ><tr + ><td class="src" + ><a name="v:A2" class="def" + >A2</a + > a</td + ><td class="doc empty" + > </td + ></tr + ><tr + ><td class="src" + ><a name="v:B2" class="def" + >B2</a + > b</td + ><td class="doc empty" + > </td + ></tr + ></table + ></div + ></div + ><div class="top" + ><p class="src" + ><span class="keyword" + >data</span + > <a name="t:T5" class="def" + >T5</a + > a b </p + ><div class="subs constructors" + ><p class="caption" + >Constructors</p + ><table + ><tr + ><td class="src" + ><a name="v:A3" class="def" + >A3</a + > a</td + ><td class="doc" + ><p + >documents <code + ><A HREF="">A3</a + ></code + > +</p + ></td + ></tr + ><tr + ><td class="src" + ><a name="v:B3" class="def" + >B3</a + > b</td + ><td class="doc" + ><p + >documents <code + ><A HREF="">B3</a + ></code + > +</p + ></td + ></tr + ></table + ></div + ></div + ><div class="top" + ><p class="src" + ><span class="keyword" + >data</span + > <a name="t:T6" class="def" + >T6</a + > </p + ><div class="doc" + ><p + >Testing alternative comment styles +</p + ></div + ><div class="subs constructors" + ><p class="caption" + >Constructors</p + ><table + ><tr + ><td class="src" + ><a name="v:A4" class="def" + >A4</a + ></td + ><td class="doc" + ><p + >This is the doc for <code + ><A HREF="">A4</a + ></code + > +</p + ></td + ></tr + ><tr + ><td class="src" + ><a name="v:B4" class="def" + >B4</a + ></td + ><td class="doc" + ><p + >This is the doc for <code + ><A HREF="">B4</a + ></code + > +</p + ></td + ></tr + ><tr + ><td class="src" + ><a name="v:C4" class="def" + >C4</a + ></td + ><td class="doc" + ><p + >This is the doc for <code + ><A HREF="">C4</a + ></code + > +</p + ></td + ></tr + ></table + ></div + ></div + ><div class="top" + ><p class="src" + ><span class="keyword" + >newtype</span + > <a name="t:N1" class="def" + >N1</a + > a </p + ><div class="doc" + ><p + >A newtype +</p + ></div + ><div class="subs constructors" + ><p class="caption" + >Constructors</p + ><table + ><tr + ><td class="src" + ><a name="v:N1" class="def" + >N1</a + > a</td + ><td class="doc empty" + > </td + ></tr + ></table + ></div + ></div + ><div class="top" + ><p class="src" + ><span class="keyword" + >newtype</span + > <a name="t:N2" class="def" + >N2</a + > a b </p + ><div class="doc" + ><p + >A newtype with a fieldname +</p + ></div + ><div class="subs constructors" + ><p class="caption" + >Constructors</p + ><table + ><tr + ><td class="src" + ><a name="v:N2" class="def" + >N2</a + ></td + ><td class="doc empty" + > </td + ></tr + ><tr + ><td colspan="2" + ><div class="subs fields" + ><p class="caption" + >Fields</p + ><dl + ><dt class="src" + ><a name="v:n" class="def" + >n</a + > :: a b</dt + ><dd class="doc empty" + > </dd + ></dl + ><div class="clear" + ></div + ></div + ></td + ></tr + ></table + ></div + ></div + ><div class="top" + ><p class="src" + ><span class="keyword" + >newtype</span + > <a name="t:N3" class="def" + >N3</a + > a b </p + ><div class="doc" + ><p + >A newtype with a fieldname, documentation on the field +</p + ></div + ><div class="subs constructors" + ><p class="caption" + >Constructors</p + ><table + ><tr + ><td class="src" + ><a name="v:N3" class="def" + >N3</a + ></td + ><td class="doc empty" + > </td + ></tr + ><tr + ><td colspan="2" + ><div class="subs fields" + ><p class="caption" + >Fields</p + ><dl + ><dt class="src" + ><a name="v:n3" class="def" + >n3</a + > :: a b</dt + ><dd class="doc" + ><p + >this is the <code + ><A HREF="">n3</a + ></code + > field +</p + ></dd + ></dl + ><div class="clear" + ></div + ></div + ></td + ></tr + ></table + ></div + ></div + ><div class="top" + ><p class="src" + ><span class="keyword" + >data</span + > <a name="t:N4" class="def" + >N4</a + > a b </p + ><div class="doc" + ><p + >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. +</p + ></div + ></div + ><div class="top" + ><p class="src" + ><span class="keyword" + >newtype</span + > <a name="t:N5" class="def" + >N5</a + > a b </p + ><div class="subs constructors" + ><p class="caption" + >Constructors</p + ><table + ><tr + ><td class="src" + ><a name="v:N5" class="def" + >N5</a + ></td + ><td class="doc empty" + > </td + ></tr + ><tr + ><td colspan="2" + ><div class="subs fields" + ><p class="caption" + >Fields</p + ><dl + ><dt class="src" + ><a name="v:n5" class="def" + >n5</a + > :: a b</dt + ><dd class="doc" + ><p + >no docs on the datatype or the constructor +</p + ></dd + ></dl + ><div class="clear" + ></div + ></div + ></td + ></tr + ></table + ></div + ></div + ><div class="top" + ><p class="src" + ><span class="keyword" + >newtype</span + > <a name="t:N6" class="def" + >N6</a + > a b </p + ><div class="subs constructors" + ><p class="caption" + >Constructors</p + ><table + ><tr + ><td class="src" + ><a name="v:N6" class="def" + >N6</a + ></td + ><td class="doc" + ><p + >docs on the constructor only +</p + ></td + ></tr + ><tr + ><td colspan="2" + ><div class="subs fields" + ><p class="caption" + >Fields</p + ><dl + ><dt class="src" + ><a name="v:n6" class="def" + >n6</a + > :: a b</dt + ><dd class="doc empty" + > </dd + ></dl + ><div class="clear" + ></div + ></div + ></td + ></tr + ></table + ></div + ></div + ><div class="top" + ><p class="src" + ><span class="keyword" + >newtype</span + > <a name="t:N7" class="def" + >N7</a + > a b </p + ><div class="doc" + ><p + >docs on the newtype and the constructor +</p + ></div + ><div class="subs constructors" + ><p class="caption" + >Constructors</p + ><table + ><tr + ><td class="src" + ><a name="v:N7" class="def" + >N7</a + ></td + ><td class="doc" + ><p + >The <code + ><A HREF="">N7</a + ></code + > constructor +</p + ></td + ></tr + ><tr + ><td colspan="2" + ><div class="subs fields" + ><p class="caption" + >Fields</p + ><dl + ><dt class="src" + ><a name="v:n7" class="def" + >n7</a + > :: a b</dt + ><dd class="doc empty" + > </dd + ></dl + ><div class="clear" + ></div + ></div + ></td + ></tr + ></table + ></div + ></div + ><h2 id="g:3" + >Records +</h2 + ><div class="top" + ><p class="src" + ><span class="keyword" + >data</span + > <a name="t:R" class="def" + >R</a + > </p + ><div class="doc" + ><p + >This is the documentation for the <code + ><A HREF="">R</a + ></code + > record, which has four fields, + <code + ><A HREF="">p</a + ></code + >, <code + ><A HREF="">q</a + ></code + >, <code + ><A HREF="">r</a + ></code + >, and <code + ><A HREF="">s</a + ></code + >. +</p + ></div + ><div class="subs constructors" + ><p class="caption" + >Constructors</p + ><table + ><tr + ><td class="src" + ><a name="v:C1" class="def" + >C1</a + ></td + ><td class="doc" + ><p + >This is the <code + ><A HREF="">C1</a + ></code + > record constructor, with the following fields: +</p + ></td + ></tr + ><tr + ><td colspan="2" + ><div class="subs fields" + ><p class="caption" + >Fields</p + ><dl + ><dt class="src" + ><a name="v:p" class="def" + >p</a + > :: <A HREF="">Int</a + ></dt + ><dd class="doc" + ><p + >This comment applies to the <code + ><A HREF="">p</a + ></code + > field +</p + ></dd + ><dt class="src" + ><a name="v:q" class="def" + >q</a + > :: <span class="keyword" + >forall</span + > a. a -> a</dt + ><dd class="doc" + ><p + >This comment applies to the <code + ><A HREF="">q</a + ></code + > field +</p + ></dd + ><dt class="src" + ><a name="v:r" class="def" + >r</a + > :: <A HREF="">Int</a + ></dt + ><dd class="doc" + ><p + >This comment applies to both <code + ><A HREF="">r</a + ></code + > and <code + ><A HREF="">s</a + ></code + > +</p + ></dd + ><dt class="src" + ><a name="v:s" class="def" + >s</a + > :: <A HREF="">Int</a + ></dt + ><dd class="doc" + ><p + >This comment applies to both <code + ><A HREF="">r</a + ></code + > and <code + ><A HREF="">s</a + ></code + > +</p + ></dd + ></dl + ><div class="clear" + ></div + ></div + ></td + ></tr + ><tr + ><td class="src" + ><a name="v:C2" class="def" + >C2</a + ></td + ><td class="doc" + ><p + >This is the <code + ><A HREF="">C2</a + ></code + > record constructor, also with some fields: +</p + ></td + ></tr + ><tr + ><td colspan="2" + ><div class="subs fields" + ><p class="caption" + >Fields</p + ><dl + ><dt class="src" + ><a name="v:t" class="def" + >t</a + > :: T1 -> <A HREF="">T2</a + > <A HREF="">Int</a + > <A HREF="">Int</a + > -> <A HREF="">T3</a + > <A HREF="">Bool</a + > <A HREF="">Bool</a + > -> <A HREF="">T4</a + > <A HREF="">Float</a + > <A HREF="">Float</a + > -> <A HREF="">T5</a + > <A HREF="">()</a + > <A HREF="">()</a + ></dt + ><dd class="doc empty" + > </dd + ><dt class="src" + ><a name="v:u" class="def" + >u</a + > :: <A HREF="">Int</a + ></dt + ><dd class="doc empty" + > </dd + ><dt class="src" + ><a name="v:v" class="def" + >v</a + > :: <A HREF="">Int</a + ></dt + ><dd class="doc empty" + > </dd + ></dl + ><div class="clear" + ></div + ></div + ></td + ></tr + ></table + ></div + ></div + ><div class="top" + ><p class="src" + ><span class="keyword" + >data</span + > <a name="t:R1" class="def" + >R1</a + > </p + ><div class="doc" + ><p + >Testing different record commenting styles +</p + ></div + ><div class="subs constructors" + ><p class="caption" + >Constructors</p + ><table + ><tr + ><td class="src" + ><a name="v:C3" class="def" + >C3</a + ></td + ><td class="doc" + ><p + >This is the <code + ><A HREF="">C3</a + ></code + > record constructor +</p + ></td + ></tr + ><tr + ><td colspan="2" + ><div class="subs fields" + ><p class="caption" + >Fields</p + ><dl + ><dt class="src" + ><a name="v:s1" class="def" + >s1</a + > :: <A HREF="">Int</a + ></dt + ><dd class="doc" + ><p + >The <code + ><A HREF="">s1</a + ></code + > record selector +</p + ></dd + ><dt class="src" + ><a name="v:s2" class="def" + >s2</a + > :: <A HREF="">Int</a + ></dt + ><dd class="doc" + ><p + >The <code + ><A HREF="">s2</a + ></code + > record selector +</p + ></dd + ><dt class="src" + ><a name="v:s3" class="def" + >s3</a + > :: <A HREF="">Int</a + ></dt + ><dd class="doc" + ><p + >The <code + ><A HREF="">s3</a + ></code + > record selector +</p + ></dd + ></dl + ><div class="clear" + ></div + ></div + ></td + ></tr + ></table + ></div + ></div + ><div class="doc" + ><p + >test that we can export record selectors on their own: +</p + ></div + ><h1 id="g:4" + >Class declarations +</h1 + ><div class="top" + ><p class="src" + ><span class="keyword" + >class</span + > <A HREF="">D</a + > a => <a name="t:C" class="def" + >C</a + > a <span class="keyword" + >where</span + ></p + ><div class="doc" + ><p + >This comment applies to the <em + >previous</em + > declaration (the <code + ><A HREF="">C</a + ></code + > class) +</p + ></div + ><div class="subs methods" + ><p class="caption" + >Methods</p + ><p class="src" + ><a name="v:a" class="def" + >a</a + > :: <A HREF="">IO</a + > a</p + ><div class="doc" + ><p + >this is a description of the <code + ><A HREF="">a</a + ></code + > method +</p + ></div + ><p class="src" + ><a name="v:b" class="def" + >b</a + > :: [a]</p + ><div class="doc" + ><p + >this is a description of the <code + ><A HREF="">b</a + ></code + > method +</p + ></div + ></div + ></div + ><div class="top" + ><p class="src" + ><span class="keyword" + >class</span + > <a name="t:D" class="def" + >D</a + > a <span class="keyword" + >where</span + ></p + ><div class="doc" + ><p + >This is a class declaration with no separate docs for the methods +</p + ></div + ><div class="subs methods" + ><p class="caption" + >Methods</p + ><p class="src" + ><a name="v:d" class="def" + >d</a + > :: <A HREF="">T</a + > a b</p + ><p class="src" + ><a name="v:e" class="def" + >e</a + > :: (a, a)</p + ></div + ><div class="subs instances" + ><p id="control.i:D" class="caption collapser" onclick="toggleSection('i:D')" + >Instances</p + ><div id="section.i:D" class="show" + ><table + ><tr + ><td class="src" + ><A HREF="">D</a + > <A HREF="">Float</a + ></td + ><td class="doc empty" + > </td + ></tr + ><tr + ><td class="src" + ><A HREF="">D</a + > <A HREF="">Int</a + ></td + ><td class="doc empty" + > </td + ></tr + ></table + ></div + ></div + ></div + ><div class="top" + ><p class="src" + ><span class="keyword" + >class</span + > <a name="t:E" class="def" + >E</a + > a </p + ><div class="doc" + ><p + >This is a class declaration with no methods (or no methods exported) +</p + ></div + ></div + ><div class="top" + ><p class="src" + ><span class="keyword" + >class</span + > <a name="t:F" class="def" + >F</a + > a <span class="keyword" + >where</span + ></p + ><div class="subs methods" + ><p class="caption" + >Methods</p + ><p class="src" + ><a name="v:ff" class="def" + >ff</a + > :: a</p + ></div + ></div + ><div class="doc" + ><p + >Test that we can export a class method on its own: +</p + ></div + ><h1 id="g:5" + >Function types +</h1 + ><div class="top" + ><p class="src" + ><a name="v:f" class="def" + >f</a + > :: <A HREF="">C</a + > a => a -> <A HREF="">Int</a + ></p + ><div class="doc" + ><p + >In a comment string we can refer to identifiers in scope with +single quotes like this: <code + ><A HREF="">T</a + ></code + >, and we can refer to modules by +using double quotes: <A HREF="">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 + ><li + > This is the next item (different kind of bullet) +</li + ></ol + ><dl + ><dt + >cat</dt + ><dd + > a small, furry, domesticated mammal +</dd + ><dt + >pineapple</dt + ><dd + > a fruit grown in the tropics +</dd + ></dl + ><pre + > + This is a block of code, which can include other markup: <code + ><A HREF="">R</a + ></code + > + 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/</a + >. +</p + ></div + ></div + ><div class="top" + ><p class="src" + ><a name="v:g" class="def" + >g</a + > :: <A HREF="">Int</a + > -> <A HREF="">IO</a + > CInt</p + ><div class="doc" + ><p + >we can export foreign declarations too +</p + ></div + ></div + ><h1 id="g:6" + >Auxiliary stuff +</h1 + ><div 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 + ></div + ><div class="doc" + ><p + >This is some documentation that is attached to a name ($aux2) +</p + ></div + ><div class="doc" + ><pre + > code block on its own in named doc</pre + ></div + ><div class="doc" + ><pre + > code block on its own in named doc (after newline)</pre + ></div + ><div class="doc" + ><p + >a nested, named doc comment +</p + ><p + >with a paragraph, +</p + ><pre + > and a code block</pre + ></div + ><div class="doc" + ><pre + >test +test1 +</pre + ><pre + > test2 + test3 +</pre + ></div + ><div class="doc" + ><pre + > +test1 +test2 +</pre + ></div + ><div class="doc" + ><pre + >test3 +test4 +</pre + ></div + ><div class="doc" + ><pre + > +test1 +test2 +</pre + ><pre + >test3 +test4 +</pre + ></div + ><div class="doc" + ><pre + >test3 +test4 +</pre + ><pre + > +test1 +test2 +</pre + ></div + ><div class="doc" + ><p + >aux11: +</p + ><pre + >test3 +test4 +</pre + ><pre + > +test1 +test2 +</pre + ></div + ><div class="doc" + ><pre + > foo +</pre + ><pre + > bar +</pre + ></div + ><div 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 + ></div + ><h1 id="g:7" + >A hidden module +</h1 + ><div class="top" + ><p class="src" + ><a name="v:hidden" class="def" + >hidden</a + > :: <A HREF="">Int</a + > -> <A HREF="">Int</a + ></p + ></div + ><h1 id="g:8" + >A visible module +</h1 + ><div class="top" + ><p class="src" + >module <A HREF="">Visible</a + ></p + ></div + ><div class="doc" + ><p + >nested-style doc comments +</p + ></div + ><h1 id="g:9" + >Existential / Universal types +</h1 + ><div class="top" + ><p class="src" + ><span class="keyword" + >data</span + > <a name="t:Ex" class="def" + >Ex</a + > a </p + ><div class="doc" + ><p + >A data-type using existential/universal types +</p + ></div + ><div class="subs constructors" + ><p class="caption" + >Constructors</p + ><table + ><tr + ><td class="src" + ><span class="keyword" + >forall</span + > b . <A HREF="">C</a + > b => <a name="v:Ex1" class="def" + >Ex1</a + > b</td + ><td class="doc empty" + > </td + ></tr + ><tr + ><td class="src" + ><span class="keyword" + >forall</span + > b . <a name="v:Ex2" class="def" + >Ex2</a + > b</td + ><td class="doc empty" + > </td + ></tr + ><tr + ><td class="src" + ><span class="keyword" + >forall</span + > b . <A HREF="">C</a + > a => <a name="v:Ex3" class="def" + >Ex3</a + > b</td + ><td class="doc empty" + > </td + ></tr + ><tr + ><td class="src" + ><a name="v:Ex4" class="def" + >Ex4</a + > (<span class="keyword" + >forall</span + > a. a -> a)</td + ><td class="doc empty" + > </td + ></tr + ></table + ></div + ></div + ><h1 id="g:10" + >Type signatures with argument docs +</h1 + ><div class="top" + ><p class="src" + ><a name="v:k" class="def" + >k</a + ></p + ><div class="subs arguments" + ><p class="caption" + >Arguments</p + ><table + ><tr + ><td class="src" + >:: <A HREF="">T</a + > <A HREF="">()</a + > <A HREF="">()</a + ></td + ><td class="doc" + ><p + >This argument has type <code + ><A HREF="">T</a + ></code + > +</p + ></td + ></tr + ><tr + ><td class="src" + >-> <A HREF="">T2</a + > <A HREF="">Int</a + > <A HREF="">Int</a + ></td + ><td class="doc" + ><p + >This argument has type 'T2 Int Int' +</p + ></td + ></tr + ><tr + ><td class="src" + >-> (<A HREF="">T3</a + > <A HREF="">Bool</a + > <A HREF="">Bool</a + > -> <A HREF="">T4</a + > <A HREF="">Float</a + > <A HREF="">Float</a + >)</td + ><td class="doc" + ><p + >This argument has type <code + >T3 Bool Bool -> T4 Float Float</code + > +</p + ></td + ></tr + ><tr + ><td class="src" + >-> <A HREF="">T5</a + > <A HREF="">()</a + > <A HREF="">()</a + ></td + ><td class="doc" + ><p + >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. +</p + ></td + ></tr + ><tr + ><td class="src" + >-> <A HREF="">IO</a + > <A HREF="">()</a + ></td + ><td class="doc" + ><p + >This is the result type +</p + ></td + ></tr + ></table + ></div + ><div class="doc" + ><p + >This is a function with documentation for each argument +</p + ></div + ></div + ><div class="top" + ><p class="src" + ><a name="v:l" class="def" + >l</a + ></p + ><div class="subs arguments" + ><p class="caption" + >Arguments</p + ><table + ><tr + ><td class="src" + >:: (<A HREF="">Int</a + >, <A HREF="">Int</a + >, <A HREF="">Float</a + >)</td + ><td class="doc" + ><p + >takes a triple +</p + ></td + ></tr + ><tr + ><td class="src" + >-> <A HREF="">Int</a + ></td + ><td class="doc" + ><p + >returns an <code + ><A HREF="">Int</a + ></code + > +</p + ></td + ></tr + ></table + ></div + ></div + ><div class="top" + ><p class="src" + ><a name="v:m" class="def" + >m</a + ></p + ><div class="subs arguments" + ><p class="caption" + >Arguments</p + ><table + ><tr + ><td class="src" + >:: <A HREF="">R</a + ></td + ><td class="doc empty" + > </td + ></tr + ><tr + ><td class="src" + >-> <A HREF="">N1</a + > <A HREF="">()</a + ></td + ><td class="doc" + ><p + >one of the arguments +</p + ></td + ></tr + ><tr + ><td class="src" + >-> <A HREF="">IO</a + > <A HREF="">Int</a + ></td + ><td class="doc" + ><p + >and the return value +</p + ></td + ></tr + ></table + ></div + ><div class="doc" + ><p + >This function has some arg docs +</p + ></div + ></div + ><div class="top" + ><p class="src" + ><a name="v:o" class="def" + >o</a + ></p + ><div class="subs arguments" + ><p class="caption" + >Arguments</p + ><table + ><tr + ><td class="src" + >:: <A HREF="">Float</a + ></td + ><td class="doc" + ><p + >The input float +</p + ></td + ></tr + ><tr + ><td class="src" + >-> <A HREF="">IO</a + > <A HREF="">Float</a + ></td + ><td class="doc" + ><p + >The output float +</p + ></td + ></tr + ></table + ></div + ><div class="doc" + ><p + >A foreign import with argument docs +</p + ></div + ></div + ><h1 id="g:11" + >A section +</h1 + ><h2 id="g:12" + >A subsection +</h2 + ><div class="doc" + ><pre + > a literal line +</pre + ><p + >$ a non <em + >literal</em + > line $ +</p + ></div + ><div class="top" + ><p class="src" + ><a name="v:f-39-" class="def" + >f'</a + > :: <A HREF="">Int</a + ></p + ><div class="doc" + ><p + >a function with a prime can be referred to as <code + ><A HREF="">f'</a + ></code + > + but f' doesn't get link'd 'f\'' +</p + ></div + ></div + ></div + ></div + ><div id="footer" + ><p + >Produced by <A HREF="">Haddock</a + > version 2.8.2</p + ></div + ></body + ></html +> diff --git a/tests/html-tests/tests/Ticket112.hs b/tests/html-tests/tests/Ticket112.hs new file mode 100644 index 00000000..c9cd5117 --- /dev/null +++ b/tests/html-tests/tests/Ticket112.hs @@ -0,0 +1,9 @@ +{-# LANGUAGE MagicHash #-} + +module Ticket112 where + +import GHC.Prim + +-- | ...given a raw 'Addr#' to the string, and the length of the string. +f :: a +f = undefined diff --git a/tests/html-tests/tests/Ticket112.html.ref b/tests/html-tests/tests/Ticket112.html.ref new file mode 100644 index 00000000..f29b507a --- /dev/null +++ b/tests/html-tests/tests/Ticket112.html.ref @@ -0,0 +1,69 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" +><head + ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" + /><title + >Ticket112</title + ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" + /><script src="haddock-util.js" type="text/javascript" + ></script + ><script type="text/javascript" + >//<![CDATA[ +window.onload = function () {pageLoad();setSynopsis("mini_Ticket112.html");}; +//]]> +</script + ></head + ><body + ><div id="package-header" + ><ul class="links" id="page-menu" + ><li + ><A HREF="">Contents</a + ></li + ><li + ><A HREF="">Index</a + ></li + ></ul + ><p class="caption" class="empty" + > </p + ></div + ><div id="content" + ><div id="module-header" + ><p class="caption" + >Ticket112</p + ></div + ><div id="synopsis" + ><p id="control.syn" class="caption expander" onclick="toggleSection('syn')" + >Synopsis</p + ><ul id="section.syn" class="hide" onclick="toggleSection('syn')" + ><li class="src short" + ><A HREF="">f</a + > :: a</li + ></ul + ></div + ><div id="interface" + ><h1 + >Documentation</h1 + ><div class="top" + ><p class="src" + ><a name="v:f" class="def" + >f</a + > :: a</p + ><div class="doc" + ><p + >...given a raw <code + ><A HREF="">Addr#</a + ></code + > to the string, and the length of the string. +</p + ></div + ></div + ></div + ></div + ><div id="footer" + ><p + >Produced by <A HREF="">Haddock</a + > version 2.8.2</p + ></div + ></body + ></html +> diff --git a/tests/html-tests/tests/Ticket61.hs b/tests/html-tests/tests/Ticket61.hs new file mode 100644 index 00000000..26ca287f --- /dev/null +++ b/tests/html-tests/tests/Ticket61.hs @@ -0,0 +1,3 @@ +module Ticket61 (module Ticket61_Hidden) where + +import Ticket61_Hidden diff --git a/tests/html-tests/tests/Ticket61.html.ref b/tests/html-tests/tests/Ticket61.html.ref new file mode 100644 index 00000000..453cabad --- /dev/null +++ b/tests/html-tests/tests/Ticket61.html.ref @@ -0,0 +1,69 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" +><head + ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" + /><title + >Ticket61</title + ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" + /><script src="haddock-util.js" type="text/javascript" + ></script + ><script type="text/javascript" + >//<![CDATA[ +window.onload = function () {pageLoad();setSynopsis("mini_Ticket61.html");}; +//]]> +</script + ></head + ><body + ><div id="package-header" + ><ul class="links" id="page-menu" + ><li + ><A HREF="">Contents</a + ></li + ><li + ><A HREF="">Index</a + ></li + ></ul + ><p class="caption" class="empty" + > </p + ></div + ><div id="content" + ><div id="module-header" + ><p class="caption" + >Ticket61</p + ></div + ><div id="interface" + ><h1 + >Documentation</h1 + ><div class="top" + ><p class="src" + ><span class="keyword" + >class</span + > <a name="t:C" class="def" + >C</a + > a <span class="keyword" + >where</span + ></p + ><div class="subs methods" + ><p class="caption" + >Methods</p + ><p class="src" + ><a name="v:f" class="def" + >f</a + > :: a</p + ><div class="doc" + ><p + >A comment about f +</p + ></div + ></div + ></div + ></div + ></div + ><div id="footer" + ><p + >Produced by <A HREF="">Haddock</a + > version 2.8.2</p + ></div + ></body + ></html +> diff --git a/tests/html-tests/tests/Ticket61_Hidden.hs b/tests/html-tests/tests/Ticket61_Hidden.hs new file mode 100644 index 00000000..583c10cd --- /dev/null +++ b/tests/html-tests/tests/Ticket61_Hidden.hs @@ -0,0 +1,7 @@ +{-# OPTIONS_HADDOCK hide #-} + +module Ticket61_Hidden where + +class C a where + -- | A comment about f + f :: a diff --git a/tests/html-tests/tests/Ticket75.hs b/tests/html-tests/tests/Ticket75.hs new file mode 100644 index 00000000..94a2f115 --- /dev/null +++ b/tests/html-tests/tests/Ticket75.hs @@ -0,0 +1,7 @@ +module Ticket75 where + +data a :- b = Q + +-- | A reference to ':-' +f :: Int +f = undefined diff --git a/tests/html-tests/tests/Ticket75.html.ref b/tests/html-tests/tests/Ticket75.html.ref new file mode 100644 index 00000000..dcadf429 --- /dev/null +++ b/tests/html-tests/tests/Ticket75.html.ref @@ -0,0 +1,99 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" +><head + ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" + /><title + >Ticket75</title + ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" + /><script src="haddock-util.js" type="text/javascript" + ></script + ><script type="text/javascript" + >//<![CDATA[ +window.onload = function () {pageLoad();setSynopsis("mini_Ticket75.html");}; +//]]> +</script + ></head + ><body + ><div id="package-header" + ><ul class="links" id="page-menu" + ><li + ><A HREF="">Contents</a + ></li + ><li + ><A HREF="">Index</a + ></li + ></ul + ><p class="caption" class="empty" + > </p + ></div + ><div id="content" + ><div id="module-header" + ><p class="caption" + >Ticket75</p + ></div + ><div id="synopsis" + ><p id="control.syn" class="caption expander" onclick="toggleSection('syn')" + >Synopsis</p + ><ul id="section.syn" class="hide" onclick="toggleSection('syn')" + ><li class="src short" + ><span class="keyword" + >data</span + > a <A HREF="">:-</a + > b = <A HREF="">Q</a + ></li + ><li class="src short" + ><A HREF="">f</a + > :: <A HREF="">Int</a + ></li + ></ul + ></div + ><div id="interface" + ><h1 + >Documentation</h1 + ><div class="top" + ><p class="src" + ><span class="keyword" + >data</span + > a <a name="t::-45-" class="def" + >:-</a + > b </p + ><div class="subs constructors" + ><p class="caption" + >Constructors</p + ><table + ><tr + ><td class="src" + ><a name="v:Q" class="def" + >Q</a + ></td + ><td class="doc empty" + > </td + ></tr + ></table + ></div + ></div + ><div class="top" + ><p class="src" + ><a name="v:f" class="def" + >f</a + > :: <A HREF="">Int</a + ></p + ><div class="doc" + ><p + >A reference to <code + ><A HREF="">:-</a + ></code + > +</p + ></div + ></div + ></div + ></div + ><div id="footer" + ><p + >Produced by <A HREF="">Haddock</a + > version 2.8.2</p + ></div + ></body + ></html +> diff --git a/tests/html-tests/tests/TypeFamilies.hs b/tests/html-tests/tests/TypeFamilies.hs new file mode 100644 index 00000000..561f95fd --- /dev/null +++ b/tests/html-tests/tests/TypeFamilies.hs @@ -0,0 +1,28 @@ +{-# LANGUAGE TypeFamilies #-} + +module TypeFamilies where + +-- | Type family G +type family G a :: * + +-- | A class with an associated type +class A a where + -- | An associated type + data B a :: * -> * + -- | A method + f :: B a Int + +-- | Doc for family +type family F a + + +-- | Doc for G Int +type instance G Int = Bool +type instance G Float = Int + + +instance A Int where + data B Int x = Con x + f = Con 3 + +g = Con 5 diff --git a/tests/html-tests/tests/TypeFamilies.html.ref b/tests/html-tests/tests/TypeFamilies.html.ref new file mode 100644 index 00000000..02ad9920 --- /dev/null +++ b/tests/html-tests/tests/TypeFamilies.html.ref @@ -0,0 +1,168 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" +><head + ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" + /><title + >TypeFamilies</title + ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" + /><script src="haddock-util.js" type="text/javascript" + ></script + ><script type="text/javascript" + >//<![CDATA[ +window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies.html");}; +//]]> +</script + ></head + ><body + ><div id="package-header" + ><ul class="links" id="page-menu" + ><li + ><A HREF="">Contents</a + ></li + ><li + ><A HREF="">Index</a + ></li + ></ul + ><p class="caption" class="empty" + > </p + ></div + ><div id="content" + ><div id="module-header" + ><p class="caption" + >TypeFamilies</p + ></div + ><div id="synopsis" + ><p id="control.syn" class="caption expander" onclick="toggleSection('syn')" + >Synopsis</p + ><ul id="section.syn" class="hide" onclick="toggleSection('syn')" + ><li class="src short" + ><span class="keyword" + >type family</span + > <A HREF="">G</a + > a :: *</li + ><li class="src short" + ><span class="keyword" + >class</span + > <A HREF="">A</a + > a <span class="keyword" + >where</span + ><ul class="subs" + ><li + ><span class="keyword" + >data</span + > <A HREF="">B</a + > a :: * -> *</li + ><li + ><A HREF="">f</a + > :: <A HREF="">B</a + > a <A HREF="">Int</a + ></li + ></ul + ></li + ><li class="src short" + ><span class="keyword" + >type family</span + > <A HREF="">F</a + > a </li + ></ul + ></div + ><div id="interface" + ><h1 + >Documentation</h1 + ><div class="top" + ><p class="src" + ><span class="keyword" + >type family</span + > <a name="t:G" class="def" + >G</a + > a :: *</p + ><div class="doc" + ><p + >Type family G +</p + ></div + ></div + ><div class="top" + ><p class="src" + ><span class="keyword" + >class</span + > <a name="t:A" class="def" + >A</a + > a <span class="keyword" + >where</span + ></p + ><div class="doc" + ><p + >A class with an associated type +</p + ></div + ><div class="subs associated-types" + ><p class="caption" + >Associated Types</p + ><p class="src" + ><span class="keyword" + >data</span + > <a name="t:B" class="def" + >B</a + > a :: * -> *</p + ><div class="doc" + ><p + >An associated type +</p + ></div + ></div + ><div class="subs methods" + ><p class="caption" + >Methods</p + ><p class="src" + ><a name="v:f" class="def" + >f</a + > :: <A HREF="">B</a + > a <A HREF="">Int</a + ></p + ><div class="doc" + ><p + >A method +</p + ></div + ></div + ><div class="subs instances" + ><p id="control.i:A" class="caption collapser" onclick="toggleSection('i:A')" + >Instances</p + ><div id="section.i:A" class="show" + ><table + ><tr + ><td class="src" + ><A HREF="">A</a + > <A HREF="">Int</a + ></td + ><td class="doc empty" + > </td + ></tr + ></table + ></div + ></div + ></div + ><div class="top" + ><p class="src" + ><span class="keyword" + >type family</span + > <a name="t:F" class="def" + >F</a + > a </p + ><div class="doc" + ><p + >Doc for family +</p + ></div + ></div + ></div + ></div + ><div id="footer" + ><p + >Produced by <A HREF="">Haddock</a + > version 2.8.2</p + ></div + ></body + ></html +> diff --git a/tests/html-tests/tests/TypeOperators.hs b/tests/html-tests/tests/TypeOperators.hs new file mode 100644 index 00000000..aa0fbe8c --- /dev/null +++ b/tests/html-tests/tests/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/html-tests/tests/TypeOperators.html.ref b/tests/html-tests/tests/TypeOperators.html.ref new file mode 100644 index 00000000..445af672 --- /dev/null +++ b/tests/html-tests/tests/TypeOperators.html.ref @@ -0,0 +1,215 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" +><head + ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" + /><title + >TypeOperators</title + ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" + /><script src="haddock-util.js" type="text/javascript" + ></script + ><script type="text/javascript" + >//<![CDATA[ +window.onload = function () {pageLoad();setSynopsis("mini_TypeOperators.html");}; +//]]> +</script + ></head + ><body + ><div id="package-header" + ><ul class="links" id="page-menu" + ><li + ><A HREF="">Contents</a + ></li + ><li + ><A HREF="">Index</a + ></li + ></ul + ><p class="caption" class="empty" + > </p + ></div + ><div id="content" + ><div id="module-header" + ><p class="caption" + >TypeOperators</p + ></div + ><div id="table-of-contents" + ><p class="caption" + >Contents</p + ><ul + ><li + ><A HREF="">stuff +</a + ></li + ></ul + ></div + ><div id="synopsis" + ><p id="control.syn" class="caption expander" onclick="toggleSection('syn')" + >Synopsis</p + ><ul id="section.syn" class="hide" onclick="toggleSection('syn')" + ><li class="src short" + ><span class="keyword" + >data</span + > a <A HREF="">:-:</a + > b</li + ><li class="src short" + ><span class="keyword" + >data</span + > (a <A HREF="">:+:</a + > b) c</li + ><li class="src short" + ><span class="keyword" + >data</span + > <A HREF="">Op</a + > a b</li + ><li class="src short" + ><span class="keyword" + >newtype</span + > <A HREF="">O</a + > g f a = <A HREF="">O</a + > {<ul class="subs" + ><li + ><A HREF="">unO</a + > :: g (f a)</li + ></ul + >}</li + ><li class="src short" + ><A HREF="">biO</a + > :: (g `<A HREF="">O</a + >` f) a</li + ><li class="src short" + ><span class="keyword" + >newtype</span + > <A HREF="">Flip</a + > (~>) b a = <A HREF="">Flip</a + > {<ul class="subs" + ><li + ><A HREF="">unFlip</a + > :: a ~> b</li + ></ul + >}</li + ></ul + ></div + ><div id="interface" + ><h1 id="g:1" + >stuff +</h1 + ><div class="top" + ><p class="src" + ><span class="keyword" + >data</span + > a <a name="t::-45-:" class="def" + >:-:</a + > b </p + ></div + ><div class="top" + ><p class="src" + ><span class="keyword" + >data</span + > (a <a name="t::-43-:" class="def" + >:+:</a + > b) c </p + ></div + ><div class="top" + ><p class="src" + ><span class="keyword" + >data</span + > <a name="t:Op" class="def" + >Op</a + > a b </p + ></div + ><div class="top" + ><p class="src" + ><span class="keyword" + >newtype</span + > <a name="t:O" class="def" + >O</a + > g f a </p + ><div class="subs constructors" + ><p class="caption" + >Constructors</p + ><table + ><tr + ><td class="src" + ><a name="v:O" class="def" + >O</a + ></td + ><td class="doc empty" + > </td + ></tr + ><tr + ><td colspan="2" + ><div class="subs fields" + ><p class="caption" + >Fields</p + ><dl + ><dt class="src" + ><a name="v:unO" class="def" + >unO</a + > :: g (f a)</dt + ><dd class="doc empty" + > </dd + ></dl + ><div class="clear" + ></div + ></div + ></td + ></tr + ></table + ></div + ></div + ><div class="top" + ><p class="src" + ><a name="v:biO" class="def" + >biO</a + > :: (g `<A HREF="">O</a + >` f) a</p + ></div + ><div class="top" + ><p class="src" + ><span class="keyword" + >newtype</span + > <a name="t:Flip" class="def" + >Flip</a + > (~>) b a </p + ><div class="subs constructors" + ><p class="caption" + >Constructors</p + ><table + ><tr + ><td class="src" + ><a name="v:Flip" class="def" + >Flip</a + ></td + ><td class="doc empty" + > </td + ></tr + ><tr + ><td colspan="2" + ><div class="subs fields" + ><p class="caption" + >Fields</p + ><dl + ><dt class="src" + ><a name="v:unFlip" class="def" + >unFlip</a + > :: a ~> b</dt + ><dd class="doc empty" + > </dd + ></dl + ><div class="clear" + ></div + ></div + ></td + ></tr + ></table + ></div + ></div + ></div + ></div + ><div id="footer" + ><p + >Produced by <A HREF="">Haddock</a + > version 2.8.2</p + ></div + ></body + ></html +> diff --git a/tests/html-tests/tests/Visible.hs b/tests/html-tests/tests/Visible.hs new file mode 100644 index 00000000..cad71931 --- /dev/null +++ b/tests/html-tests/tests/Visible.hs @@ -0,0 +1,3 @@ +module Visible where +visible :: Int -> Int +visible a = a diff --git a/tests/html-tests/tests/Visible.html.ref b/tests/html-tests/tests/Visible.html.ref new file mode 100644 index 00000000..3dc3418f --- /dev/null +++ b/tests/html-tests/tests/Visible.html.ref @@ -0,0 +1,54 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" +><head + ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" + /><title + >Visible</title + ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" + /><script src="haddock-util.js" type="text/javascript" + ></script + ><script type="text/javascript" + >//<![CDATA[ +window.onload = function () {pageLoad();setSynopsis("mini_Visible.html");}; +//]]> +</script + ></head + ><body + ><div id="package-header" + ><ul class="links" id="page-menu" + ><li + ><A HREF="">Contents</a + ></li + ><li + ><A HREF="">Index</a + ></li + ></ul + ><p class="caption" class="empty" + > </p + ></div + ><div id="content" + ><div id="module-header" + ><p class="caption" + >Visible</p + ></div + ><div id="interface" + ><h1 + >Documentation</h1 + ><div class="top" + ><p class="src" + ><a name="v:visible" class="def" + >visible</a + > :: <A HREF="">Int</a + > -> <A HREF="">Int</a + ></p + ></div + ></div + ></div + ><div id="footer" + ><p + >Produced by <A HREF="">Haddock</a + > version 2.8.2</p + ></div + ></body + ></html +> |