diff options
169 files changed, 12851 insertions, 2544 deletions
@@ -2,9 +2,12 @@ /haddock-api/dist/ /haddock-library/dist/ /html-test/out/ +/hypsrc-test/out/ /latex-test/out/ /doc/haddock +/doc/haddock.ps +/doc/haddock.pdf /doc/autom4te.cache/ /doc/config.log /doc/config.mk @@ -12,3 +15,6 @@ /doc/configure tags TAGS + +.cabal-sandbox +cabal.sandbox.config diff --git a/.travis.yml b/.travis.yml index ad1331f8..c16b1709 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,20 +3,25 @@ language: haskell env: # - GHCVER=7.8.2 # - GHCVER=7.8.3 + - GHCVER=7.10.2 before_install: - sudo add-apt-repository -y ppa:hvr/ghc - sudo apt-get update - sudo apt-get install ghc-$GHCVER - export PATH=/opt/ghc/$GHCVER/bin:$PATH + - sudo apt-get install cabal-install-1.22 + - export PATH=/opt/cabal/1.22/bin:$PATH + - cabal --version - cd haddock-library - cabal install --only-dependencies --enable-tests - cabal install doctest - - cabal configure --enable-tests --ghc-options=-Werror && cabal build && cabal test + # --ghc-options=-Werror + - cabal configure --enable-tests && cabal build && cabal test - doctest -isrc -i$(echo vendor/attoparsec-*) -optP-include -optPdist/build/autogen/cabal_macros.h src/Documentation/Haddock/Parser.hs - cabal install - cd .. - - (cd haddock-api/ && cabal install --only-dependencies --enable-tests && cabal configure --enable-tests --ghc-options=-Werror && cabal build && cabal test && cabal install) + - (cd haddock-api/ && cabal install --only-dependencies --enable-tests && cabal configure --enable-tests && cabal build && cabal test && cabal install) script: - - cabal configure --enable-tests --ghc-options=-Werror && cabal build && cabal test + - cabal configure --enable-tests && cabal build && cabal test @@ -1,3 +1,38 @@ +Changes in version 2.16.2 + + * Generate hyperlinked source ourselves (#410, part of GSOC 2015) + + * Fix expansion icon for user-collapsible sections (#412) + + * Break up response file arguments on newlines + + * Various HTML fixes (#301, #406, #407, #421) + + * Line anchors in hyperlinked source (#420) + +Changes in version 2.16.1 + + * Don't default to type constructors for out-of-scope names (#253 and + #375) + + * Fix Hoogle display of constructors (#361) + + * Fully qualify names in Hoogle instances output (#263) + + * Output method documentation in Hoogle backend (#259) + + * Don't print instance safety information in Hoogle (#168) + + * Expand response files in arguments (#285) + + * Build the main executable with -threaded (#399) + + * Use SrcSpan of declarations for inferred type sigs (#207) + + * Fix cross-module instance locations (#383) + + * Fix alignment of Source link for instances in Firefox (#384) + Changes in version 2.16.0 * Experimental collapsible header support (#335) @@ -26,6 +61,12 @@ Changes in version 2.16.0 * properly render package ID (not package key) in index (#329) + * links to source location of class instance definitions + + * Fix code blocks in presence of Windows line endings + + * Deal better with long synopsis lines (#151) + Changes in version 2.15.0 * Always read in prologue files as UTF8 (#286 and Cabal #1721) @@ -1,5 +1,7 @@ -Haddock, a Haskell Documentation Tool -===================================== +# Haddock, a Haskell Documentation Tool + + +#### About haddock This is Haddock, a tool for automatically generating documentation from annotated Haskell source code. It is primary intended for @@ -26,12 +28,45 @@ generated. Abstract types and classes are handled correctly. In fact, even without any documentation annotations, Haddock can generate useful documentation from your source code. + +#### Documentation formats + Haddock can generate documentation in multiple formats; currently HTML is implemented, and there is partial support for generating LaTeX and Hoogle. + +#### Source code documentation + Full documentation can be found in the doc/ subdirectory, in DocBook format. -Please create issues when you have any problems and pull requests if -you have some code.
\ No newline at end of file + +#### Contributing + +Please create issues when you have any problems and pull requests if you have some code. + +###### Hacking + +To get started you'll need a latest GHC release installed. Below is an +example setup using cabal sandboxes. + +```bash + git clone https://github.com/haskell/haddock.git + cd haddock + cabal sandbox init + cabal sandbox add-source haddock-library + cabal sandbox add-source haddock-api + # adjust -j to the number of cores you want to use + cabal install -j4 --dependencies-only --enable-tests + cabal configure --enable-tests + cabal build -j4 + # run the test suite + cabal test +``` + +If you're a GHC developer and want to update Haddock to work with your +changes, you should be working on `ghc-head` branch instead of master. +See instructions at +https://ghc.haskell.org/trac/ghc/wiki/WorkingConventions/Git/Submodules +for an example workflow. diff --git a/doc/README b/doc/README.md index 5bc038bf..cf1fc31b 100644 --- a/doc/README +++ b/doc/README.md @@ -1,5 +1,4 @@ -Haddock documentation ---------------------- +# Haddock documentation The documentation is in DocBook XML format. You need some tools to process it: at least xsltproc, and the DocBook XML DTD and XSL @@ -8,19 +7,19 @@ process the documentation on your system, and a Makefile to actually do the processing (so, on Windows, you'll need Cygwin or MSys in addition to the DocBook XML tools). To build the HTML documentation: - $ autoconf - $ ./configure - $ make html + $ autoconf + $ ./configure + $ make html which leaves the HTML documentation in a haddock/ subdirectory. Printable documentation can also be produced, eg.: - $ make pdf + $ make pdf or - $ make ps + $ make ps Generating the printed formats requires more tools (fop or xmltex) and tends to be a bit harder. diff --git a/doc/haddock.xml b/doc/haddock.xml index 2ffd7d78..e805a437 100644 --- a/doc/haddock.xml +++ b/doc/haddock.xml @@ -12,7 +12,7 @@ <book id="haddock"> <bookinfo> - <date>2004-08-02</date> + <date>2015-06-02</date> <title>Haddock User Guide</title> <author> <firstname>Simon</firstname> @@ -24,12 +24,21 @@ <surname>Waern</surname> </author> <address><email>david.waern@gmail.com</email></address> + <author> + <firstname>Mateusz</firstname> + <surname>Kowalczyk</surname> + </author> + <address><email>fuuzetsu@fuuzetsu.co.uk</email></address> <copyright> <year>2010</year> <holder>Simon Marlow, David Waern</holder> </copyright> + <copyright> + <year>2013-2015</year> + <holder>Mateusz Kowalczyk</holder> + </copyright> <abstract> - <para>This document describes Haddock version 2.15.1, a Haskell + <para>This document describes Haddock version 2.16.2, a Haskell documentation tool.</para> </abstract> </bookinfo> @@ -336,11 +345,27 @@ <varlistentry> <term> <indexterm><primary><option>-i</option></primary></indexterm> - <option>-i</option> <replaceable>path</replaceable>,<replaceable>file</replaceable> + <option>-i</option> <replaceable>file</replaceable> + </term> + <term> + <indexterm><primary><option>-i</option></primary></indexterm> + <option>-i</option> <replaceable>docpath</replaceable>,<replaceable>file</replaceable> + </term> + <term> + <indexterm><primary><option>-i</option></primary></indexterm> + <option>-i</option> <replaceable>docpath</replaceable>,<replaceable>srcpath</replaceable>,<replaceable>file</replaceable> </term> <term> <indexterm><primary><option>--read-interface</option></primary></indexterm> - <option>--read-interface</option>=<replaceable>path</replaceable>,<replaceable>file</replaceable> + <option>--read-interface</option>=<replaceable>file</replaceable> + </term> + <term> + <indexterm><primary><option>--read-interface</option></primary></indexterm> + <option>--read-interface</option>=<replaceable>docpath</replaceable>,<replaceable>file</replaceable> + </term> + <term> + <indexterm><primary><option>--read-interface</option></primary></indexterm> + <option>--read-interface</option>=<replaceable>docpath</replaceable>,<replaceable>srcpath</replaceable>,<replaceable>file</replaceable> </term> <listitem> <para>Read the interface file in @@ -348,19 +373,25 @@ produced by running Haddock with the <option>--dump-interface</option> option. The interface describes a set of modules whose HTML documentation is - located in <replaceable>path</replaceable> (which may be a - relative pathname). The <replaceable>path</replaceable> is - optional, and defaults to <quote>.</quote>.</para> + located in <replaceable>docpath</replaceable> (which may be a + relative pathname). The <replaceable>docpath</replaceable> is + optional, and defaults to <quote>.</quote>. The + <replaceable>srcpath</replaceable> is optional but has no default + value.</para> <para>This option allows Haddock to produce separate sets of documentation with hyperlinks between them. The - <replaceable>path</replaceable> is used to direct hyperlinks + <replaceable>docpath</replaceable> is used to direct hyperlinks to point to the right files; so make sure you don't move the HTML files later or these links will break. Using a - relative <replaceable>path</replaceable> means that a + relative <replaceable>docpath</replaceable> means that a documentation subtree can still be moved around without breaking links.</para> + <para>Similarly to <replaceable>docpath</replaceable>, <replaceable>srcpath</replaceable> is used generate cross-package hyperlinks but + within sources rendered with <option>--hyperlinked-source</option> + option.</para> + <para>Multiple <option>--read-interface</option> options may be given.</para> </listitem> @@ -521,6 +552,43 @@ $ pdflatex <replaceable>package</replaceable>.tex</screen> <varlistentry> <term> + <indexterm><primary><option>--hyperlinked-source</option></primary></indexterm> + <option>--hyperlinked-source</option> + </term> + <listitem> + <para>Generate hyperlinked source code (as HTML web page). All + rendered files will be put into + <filename class='directory'>src/</filename> subfolder of output + directory.</para> + <para>Usually, this should be used in combination with + <option>--html</option> option - generated documentation will then + contain references to appropriate code fragments. Previously, this + behaviour could be achieved by generating sources using external + tool and specifying <option>--source-base</option>, + <option>--source-module</option>, <option>--source-entity</option> + and related options. Note that these flags are ignored once + <option>--hyperlinked-source</option> is set.</para> + <para>In order to make cross-package source hyperlinking possible, + appropriate source paths have to be set up when providing + interface files using <option>--read-interface</option> + option.</para> + </listitem> + </varlistentry> + + <varlistentry> + <term> + <indexterm><primary><option>--source-css</option></primary></indexterm> + <option>--source-css=<replaceable>style</replaceable></option> + </term> + <listitem> + <para>Use custom CSS file for sources rendered by the + <option>--hyperlinked-source</option> option. If no custom style + file is provided, Haddock will use default one.</para> + </listitem> + </varlistentry> + + <varlistentry> + <term> <indexterm><primary><option>-S</option></primary></indexterm> <option>-S</option> </term> @@ -2029,7 +2097,18 @@ This belongs to the list above! 2. No newline separation even in indented lists. -} </programlisting> + <para>The indentation of the first list item is honoured. That is, + in the following example the items are on the same level. Before + Haddock 2.16.1, the second item would have been nested under the + first item which was unexpected. + </para> +<programlisting> +{-| + * foo + * bar +-} +</programlisting> </section> <section> diff --git a/driver/Main.hs b/driver/Main.hs index 42b99860..ccbb8b7d 100644 --- a/driver/Main.hs +++ b/driver/Main.hs @@ -1,7 +1,29 @@ +{-# LANGUAGE ScopedTypeVariables #-} module Main where -import Documentation.Haddock (haddock) -import System.Environment (getArgs) +import Control.Exception +import Documentation.Haddock (haddock) +import System.Environment (getArgs) +import System.Exit (exitFailure) +import System.IO main :: IO () -main = getArgs >>= haddock +main = getArgs >>= expandResponse >>= haddock + + +-- | Arguments which look like '@foo' will be replaced with the +-- contents of file @foo@. The contents will be passed through 'words' +-- and blanks filtered out first. +-- +-- We quit if the file is not found or reading somehow fails. +expandResponse :: [String] -> IO [String] +expandResponse = fmap concat . mapM expand + where + expand :: String -> IO [String] + expand ('@':f) = readFileExc f >>= return . filter (not . null) . lines + expand x = return [x] + + readFileExc f = + readFile f `catch` \(e :: IOException) -> do + hPutStrLn stderr $ "Error while expanding response file: " ++ show e + exitFailure @@ -59,9 +59,9 @@ endif .PHONY: install_utils/haddock_data install_utils/haddock_data: $(foreach i,$(sort $(dir $(utils/haddock_dist_DATA_FILES))), \ - $(call make-command,$(call INSTALL_DIR,"$(DESTDIR)$(ghclibdir)/$i"))) + $(call make-command,$(INSTALL_DIR) "$(DESTDIR)$(ghclibdir)/$i")) $(foreach i,$(utils/haddock_dist_DATA_FILES), \ - $(call make-command,$(call INSTALL_DATA,$(INSTALL_OPTS),utils/haddock/haddock-api/resources/$i,"$(DESTDIR)$(ghclibdir)/$(dir $i)"))) + $(call make-command,$(INSTALL_DATA) $(INSTALL_OPTS) utils/haddock/haddock-api/resources/$i "$(DESTDIR)$(ghclibdir)/$(dir $i)")) .PHONY: install_utils/haddock_link install_utils/haddock_link: diff --git a/haddock-api/haddock-api.cabal b/haddock-api/haddock-api.cabal index b2199c68..7835ea50 100644 --- a/haddock-api/haddock-api.cabal +++ b/haddock-api/haddock-api.cabal @@ -1,5 +1,5 @@ name: haddock-api -version: 2.16.0 +version: 2.16.2 synopsis: A documentation-generation tool for Haskell libraries description: Haddock is a documentation-generation tool for Haskell libraries @@ -18,8 +18,10 @@ stability: experimental data-dir: resources data-files: + html/solarized.css html/frames.html html/haddock-util.js + html/highlight.js html/Classic.theme/haskell_icon.gif html/Classic.theme/minus.gif html/Classic.theme/plus.gif @@ -36,19 +38,21 @@ library Haskell2010 build-depends: - base >= 4.3 && < 4.9 + base >= 4.3 && < 4.10 , bytestring , filepath , directory , containers + , transformers , deepseq , array , xhtml >= 3000.2 && < 3000.3 , Cabal >= 1.10 - , ghc == 7.9.* + , ghc-boot + , ghc >= 7.10 && < 7.12 , ghc-paths - , haddock-library == 1.2.0.* + , haddock-library == 1.2.* hs-source-dirs: src @@ -66,6 +70,7 @@ library Haddock.Interface.AttachInstances Haddock.Interface.LexParseRn Haddock.Interface.ParseModuleHeader + Haddock.Interface.Specialize Haddock.Parser Haddock.Utils Haddock.Backends.Xhtml @@ -79,6 +84,12 @@ library Haddock.Backends.LaTeX Haddock.Backends.HaddockDB Haddock.Backends.Hoogle + Haddock.Backends.Hyperlinker + Haddock.Backends.Hyperlinker.Ast + Haddock.Backends.Hyperlinker.Parser + Haddock.Backends.Hyperlinker.Renderer + Haddock.Backends.Hyperlinker.Types + Haddock.Backends.Hyperlinker.Utils Haddock.ModuleTree Haddock.Types Haddock.Doc @@ -86,9 +97,30 @@ library Haddock.InterfaceFile Haddock.Options Haddock.GhcUtils + Haddock.Syb Haddock.Convert Paths_haddock_api +test-suite spec + type: exitcode-stdio-1.0 + default-language: Haskell2010 + main-is: Spec.hs + ghc-options: -Wall + + hs-source-dirs: + test + , src + + other-modules: + Haddock.Backends.Hyperlinker.ParserSpec + + build-depends: + base >= 4.3 && < 4.9 + , containers + , ghc >= 7.10 && < 7.12 + , hspec + , QuickCheck == 2.* + source-repository head type: git location: https://github.com/haskell/haddock.git diff --git a/haddock-api/resources/html/Ocean.std-theme/ocean.css b/haddock-api/resources/html/Ocean.std-theme/ocean.css index de436324..139335ac 100644 --- a/haddock-api/resources/html/Ocean.std-theme/ocean.css +++ b/haddock-api/resources/html/Ocean.std-theme/ocean.css @@ -41,6 +41,9 @@ a[href]:link { color: rgb(196,69,29); } a[href]:visited { color: rgb(171,105,84); } a[href]:hover { text-decoration:underline; } +a[href].def:link, a[href].def:visited { color: black; } +a[href].def:hover { color: rgb(78, 98, 114); } + /* @end */ /* @group Fonts & Sizes */ @@ -143,15 +146,23 @@ ul.links li a { background-image: url(plus.gif); background-repeat: no-repeat; } -p.caption.collapser, -p.caption.expander { - background-position: 0 0.4em; -} .collapser, .expander { padding-left: 14px; margin-left: -14px; cursor: pointer; } +p.caption.collapser, +p.caption.expander { + background-position: 0 0.4em; +} + +.instance.collapser, .instance.expander { + margin-left: 0px; + background-position: left center; + min-width: 9px; + min-height: 9px; +} + pre { padding: 0.25em; @@ -318,6 +329,7 @@ div#style-menu-holder { height: 80%; top: 10%; padding: 0; + max-width: 75%; } #synopsis .caption { @@ -378,6 +390,15 @@ div#style-menu-holder { margin: 0 -0.5em 0 0.5em; } +#interface td.src .link { + float: right; + color: #919191; + border-left: 1px solid #919191; + background: #f0f0f0; + padding: 0 0.5em 0.2em; + margin: 0 -0.5em 0 0.5em; +} + #interface span.fixity { color: #919191; border-left: 1px solid #919191; @@ -406,30 +427,39 @@ div#style-menu-holder { margin-top: 0.8em; } -.subs dl { +.clearfix:after { + clear: both; + content: " "; + display: block; + height: 0; + visibility: hidden; +} + +.subs ul { + list-style: none; + display: table; margin: 0; } -.subs dt { - float: left; - clear: left; - display: block; +.subs ul li { + display: table-row; +} + +.subs ul li dfn { + display: table-cell; + font-style: normal; + font-weight: bold; margin: 1px 0; + white-space: nowrap; } -.subs dd { - float: right; - width: 90%; - display: block; +.subs ul li > .doc { + display: table-cell; padding-left: 0.5em; margin-bottom: 0.5em; } -.subs dd.empty { - display: none; -} - -.subs dd p { +.subs ul li > .doc p { margin: 0; } @@ -445,6 +475,11 @@ div#style-menu-holder { margin-left: 1em; } +/* Workaround for bug in Firefox (issue #384) */ +.inst-left { + float: left; +} + .top p.src { border-top: 1px solid #ccc; } diff --git a/haddock-api/resources/html/frames.html b/haddock-api/resources/html/frames.html index 1b4e38d4..e86edb66 100644 --- a/haddock-api/resources/html/frames.html +++ b/haddock-api/resources/html/frames.html @@ -1,4 +1,4 @@ -<!DOCTYPE html +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> diff --git a/haddock-api/resources/html/haddock-util.js b/haddock-api/resources/html/haddock-util.js index 9a6fccf7..fc7743fe 100644 --- a/haddock-api/resources/html/haddock-util.js +++ b/haddock-api/resources/html/haddock-util.js @@ -131,11 +131,11 @@ function perform_search(full) var text = document.getElementById("searchbox").value.toLowerCase(); if (text == last_search && !full) return; last_search = text; - + var table = document.getElementById("indexlist"); var status = document.getElementById("searchmsg"); var children = table.firstChild.childNodes; - + // first figure out the first node with the prefix var first = bisect(-1); var last = (first == -1 ? -1 : bisect(1)); @@ -166,7 +166,7 @@ function perform_search(full) status.innerHTML = ""; } - + function setclass(first, last, status) { for (var i = first; i <= last; i++) @@ -174,8 +174,8 @@ function perform_search(full) children[i].className = status; } } - - + + // do a binary search, treating 0 as ... // return either -1 (no 0's found) or location of most far match function bisect(dir) @@ -201,9 +201,9 @@ function perform_search(full) if (checkitem(i) == 0) return i; } return -1; - } - - + } + + // from an index, decide what the result is // 0 = match, -1 is lower, 1 is higher function checkitem(i) @@ -212,8 +212,8 @@ function perform_search(full) if (s == text) return 0; else return (s > text ? -1 : 1); } - - + + // from an index, get its string // this abstracts over alternates function getitem(i) @@ -229,7 +229,7 @@ function perform_search(full) } function setSynopsis(filename) { - if (parent.window.synopsis) { + if (parent.window.synopsis && parent.window.synopsis.location) { if (parent.window.synopsis.location.replace) { // In Firefox this avoids adding the change to the history. parent.window.synopsis.location.replace(filename); @@ -250,7 +250,7 @@ function addMenuItem(html) { function adjustForFrames() { var bodyCls; - + if (parent.location.href == window.location.href) { // not in frames, so add Frames button addMenuItem("<a href='#' onclick='reframe();return true;'>Frames</a>"); diff --git a/haddock-api/resources/html/highlight.js b/haddock-api/resources/html/highlight.js new file mode 100644 index 00000000..1e903bd0 --- /dev/null +++ b/haddock-api/resources/html/highlight.js @@ -0,0 +1,27 @@ + +var highlight = function (on) { + return function () { + var links = document.getElementsByTagName('a'); + for (var i = 0; i < links.length; i++) { + var that = links[i]; + + if (this.href != that.href) { + continue; + } + + if (on) { + that.classList.add("hover-highlight"); + } else { + that.classList.remove("hover-highlight"); + } + } + } +}; + +window.onload = function () { + var links = document.getElementsByTagName('a'); + for (var i = 0; i < links.length; i++) { + links[i].onmouseover = highlight(true); + links[i].onmouseout = highlight(false); + } +}; diff --git a/haddock-api/resources/html/solarized.css b/haddock-api/resources/html/solarized.css new file mode 100644 index 00000000..e83dc5ec --- /dev/null +++ b/haddock-api/resources/html/solarized.css @@ -0,0 +1,55 @@ +body { + background-color: #fdf6e3; +} + +.hs-identifier { + color: #073642; +} + +.hs-identifier.hs-var { +} + +.hs-identifier.hs-type { + color: #5f5faf; +} + +.hs-keyword { + color: #af005f; +} + +.hs-string, .hs-char { + color: #cb4b16; +} + +.hs-number { + color: #268bd2; +} + +.hs-operator { + color: #d33682; +} + +.hs-glyph, .hs-special { + color: #dc322f; +} + +.hs-comment { + color: #8a8a8a; +} + +.hs-pragma { + color: #2aa198; +} + +.hs-cpp { + color: #859900; +} + +a:link, a:visited { + text-decoration: none; + border-bottom: 1px solid #eee8d5; +} + +a:hover, a.hover-highlight { + background-color: #eee8d5; +} diff --git a/haddock-api/src/Haddock.hs b/haddock-api/src/Haddock.hs index 72c544e1..70cdf8a3 100644 --- a/haddock-api/src/Haddock.hs +++ b/haddock-api/src/Haddock.hs @@ -30,6 +30,7 @@ import Haddock.Backends.Xhtml import Haddock.Backends.Xhtml.Themes (getThemes) import Haddock.Backends.LaTeX import Haddock.Backends.Hoogle +import Haddock.Backends.Hyperlinker import Haddock.Interface import Haddock.Parser import Haddock.Types @@ -39,11 +40,13 @@ import Haddock.Options import Haddock.Utils import Control.Monad hiding (forM_) +import Control.Applicative import Data.Foldable (forM_) import Data.List (isPrefixOf) import Control.Exception import Data.Maybe import Data.IORef +import Data.Map (Map) import qualified Data.Map as Map import System.IO import System.Exit @@ -118,11 +121,8 @@ handleGhcExceptions = -- error messages propagated as exceptions handleGhcException $ \e -> do hFlush stdout - case e of - PhaseFailed _ code -> exitWith code - _ -> do - print (e :: GhcException) - exitFailure + print (e :: GhcException) + exitFailure ------------------------------------------------------------------------------- @@ -157,6 +157,7 @@ haddockWithGhc ghc args = handleTopExceptions $ do _ -> return flags unless (Flag_NoWarnings `elem` flags) $ do + hypSrcWarnings flags forM_ (warnings args) $ \warning -> do hPutStrLn stderr warning @@ -225,13 +226,16 @@ renderStep dflags flags qual pkgs interfaces = do let ifaceFiles = map snd pkgs installedIfaces = concatMap ifInstalledIfaces ifaceFiles - srcMap = Map.fromList [ (ifPackageKey if_, x) | ((_, Just x), if_) <- pkgs ] - render dflags flags qual interfaces installedIfaces srcMap + extSrcMap = Map.fromList $ do + ((_, Just path), ifile) <- pkgs + iface <- ifInstalledIfaces ifile + return (instMod iface, path) + render dflags flags qual interfaces installedIfaces extSrcMap -- | Render the interfaces with whatever backend is specified in the flags. -render :: DynFlags -> [Flag] -> QualOption -> [Interface] -> [InstalledInterface] -> SrcMap -> IO () -render dflags flags qual ifaces installedIfaces srcMap = do +render :: DynFlags -> [Flag] -> QualOption -> [Interface] -> [InstalledInterface] -> Map Module FilePath -> IO () +render dflags flags qual ifaces installedIfaces extSrcMap = do let title = fromMaybe "" (optTitle flags) @@ -242,6 +246,7 @@ render dflags flags qual ifaces installedIfaces srcMap = do opt_index_url = optIndexUrl flags odir = outputDir flags opt_latex_style = optLaTeXStyle flags + opt_source_css = optSourceCssFile flags visibleIfaces = [ i | i <- ifaces, OptHide `notElem` ifaceOptions i ] @@ -250,15 +255,35 @@ render dflags flags qual ifaces installedIfaces srcMap = do allVisibleIfaces = [ i | i <- allIfaces, OptHide `notElem` instOptions i ] pkgMod = ifaceMod (head ifaces) - pkgKey = modulePackageKey pkgMod - pkgStr = Just (packageKeyString pkgKey) - (pkgName,pkgVer) = modulePackageInfo dflags flags pkgMod + pkgKey = moduleUnitId pkgMod + pkgStr = Just (unitIdString pkgKey) + pkgNameVer = modulePackageInfo dflags flags pkgMod (srcBase, srcModule, srcEntity, srcLEntity) = sourceUrls flags - srcMap' = maybe srcMap (\path -> Map.insert pkgKey path srcMap) srcEntity + + srcModule' + | Flag_HyperlinkedSource `elem` flags = Just hypSrcModuleUrlFormat + | otherwise = srcModule + + srcMap = mkSrcMap $ Map.union + (Map.map SrcExternal extSrcMap) + (Map.fromList [ (ifaceMod iface, SrcLocal) | iface <- ifaces ]) + + pkgSrcMap = Map.mapKeys moduleUnitId extSrcMap + pkgSrcMap' + | Flag_HyperlinkedSource `elem` flags = + Map.insert pkgKey hypSrcModuleNameUrlFormat pkgSrcMap + | Just srcNameUrl <- srcEntity = Map.insert pkgKey srcNameUrl pkgSrcMap + | otherwise = pkgSrcMap + -- TODO: Get these from the interface files as with srcMap - srcLMap' = maybe Map.empty (\path -> Map.singleton pkgKey path) srcLEntity - sourceUrls' = (srcBase, srcModule, srcMap', srcLMap') + pkgSrcLMap' + | Flag_HyperlinkedSource `elem` flags = + Map.singleton pkgKey hypSrcModuleLineUrlFormat + | Just path <- srcLEntity = Map.singleton pkgKey path + | otherwise = Map.empty + + sourceUrls' = (srcBase, srcModule', pkgSrcMap', pkgSrcLMap') libDir <- getHaddockLibDir flags prologue <- getPrologue dflags flags @@ -288,17 +313,28 @@ render dflags flags qual ifaces installedIfaces srcMap = do -- TODO: we throw away Meta for both Hoogle and LaTeX right now, -- might want to fix that if/when these two get some work on them when (Flag_Hoogle `elem` flags) $ do - let pkgNameStr | unpackFS pkgNameFS == "main" && title /= [] - = title - | otherwise = unpackFS pkgNameFS - where PackageName pkgNameFS = pkgName - ppHoogle dflags pkgNameStr pkgVer title (fmap _doc prologue) visibleIfaces - odir + case pkgNameVer of + Nothing -> putStrLn . unlines $ + [ "haddock: Unable to find a package providing module " + ++ moduleNameString (moduleName pkgMod) ++ ", skipping Hoogle." + , "" + , " Perhaps try specifying the desired package explicitly" + ++ " using the --package-name" + , " and --package-version arguments." + ] + Just (PackageName pkgNameFS, pkgVer) -> + let pkgNameStr | unpackFS pkgNameFS == "main" && title /= [] = title + | otherwise = unpackFS pkgNameFS + in ppHoogle dflags pkgNameStr pkgVer title (fmap _doc prologue) + visibleIfaces odir when (Flag_LaTeX `elem` flags) $ do ppLaTeX title pkgStr visibleIfaces odir (fmap _doc prologue) opt_latex_style libDir + when (Flag_HyperlinkedSource `elem` flags) $ do + ppHyperlinkedSource odir libDir opt_source_css pretty srcMap ifaces + -- | From GHC 7.10, this function has a potential to crash with a -- nasty message such as @expectJust getPackageDetails@ because -- package name and versions can no longer reliably be extracted in @@ -312,12 +348,12 @@ modulePackageInfo :: DynFlags -- contain the package name or version -- provided by the user which we -- prioritise - -> Module -> (PackageName, Data.Version.Version) + -> Module -> Maybe (PackageName, Data.Version.Version) modulePackageInfo dflags flags modu = - (fromMaybe (packageName pkg) (optPackageName flags), - fromMaybe (packageVersion pkg) (optPackageVersion flags)) + cmdline <|> pkgDb where - pkg = getPackageDetails dflags (modulePackageKey modu) + cmdline = (,) <$> optPackageName flags <*> optPackageVersion flags + pkgDb = (\pkg -> (packageName pkg, packageVersion pkg)) <$> lookupPackage dflags (moduleUnitId modu) ------------------------------------------------------------------------------- @@ -467,6 +503,35 @@ shortcutFlags flags = do ++ "Ported to use the GHC API by David Waern 2006-2008\n" +-- | Generate some warnings about potential misuse of @--hyperlinked-source@. +hypSrcWarnings :: [Flag] -> IO () +hypSrcWarnings flags = do + + when (hypSrc && any isSourceUrlFlag flags) $ + hPutStrLn stderr $ concat + [ "Warning: " + , "--source-* options are ignored when " + , "--hyperlinked-source is enabled." + ] + + when (not hypSrc && any isSourceCssFlag flags) $ + hPutStrLn stderr $ concat + [ "Warning: " + , "source CSS file is specified but " + , "--hyperlinked-source is disabled." + ] + + where + hypSrc = Flag_HyperlinkedSource `elem` flags + isSourceUrlFlag (Flag_SourceBaseURL _) = True + isSourceUrlFlag (Flag_SourceModuleURL _) = True + isSourceUrlFlag (Flag_SourceEntityURL _) = True + isSourceUrlFlag (Flag_SourceLEntityURL _) = True + isSourceUrlFlag _ = False + isSourceCssFlag (Flag_SourceCss _) = True + isSourceCssFlag _ = False + + updateHTMLXRefs :: [(DocPaths, InterfaceFile)] -> IO () updateHTMLXRefs packages = do writeIORef html_xrefs_ref (Map.fromList mapping) diff --git a/haddock-api/src/Haddock/Backends/HaddockDB.hs b/haddock-api/src/Haddock/Backends/HaddockDB.hs index 1c248bfb..0bdc9057 100644 --- a/haddock-api/src/Haddock/Backends/HaddockDB.hs +++ b/haddock-api/src/Haddock/Backends/HaddockDB.hs @@ -40,7 +40,7 @@ ppIfaces mods where do_mod (Module mod, iface) = text "<sect1 id=\"sec-" <> text mod <> text "\">" - $$ text "<title><literal>" + $$ text "<title><literal>" <> text mod <> text "</literal></title>" $$ text "<indexterm><primary><literal>" @@ -50,10 +50,10 @@ ppIfaces mods $$ vcat (map (do_export mod) (eltsFM (iface_decls iface))) $$ text "</variablelist>" $$ text "</sect1>" - + do_export mod decl | (nm:_) <- declBinders decl = text "<varlistentry id=" <> ppLinkId mod nm <> char '>' - $$ text "<term><literal>" + $$ text "<term><literal>" <> do_decl decl <> text "</literal></term>" $$ text "<listitem>" @@ -63,11 +63,11 @@ ppIfaces mods $$ text "</varlistentry>" do_export _ _ = empty - do_decl (HsTypeSig _ [nm] ty _) + do_decl (HsTypeSig _ [nm] ty _) = ppHsName nm <> text " :: " <> ppHsType ty do_decl (HsTypeDecl _ nm args ty _) = hsep ([text "type", ppHsName nm ] - ++ map ppHsName args + ++ map ppHsName args ++ [equals, ppHsType ty]) do_decl (HsNewTypeDecl loc ctx nm args con drv _) = hsep ([text "data", ppHsName nm] -- data, not newtype @@ -87,7 +87,7 @@ ppHsConstr :: HsConDecl -> Doc ppHsConstr (HsRecDecl pos name tvs ctxt fieldList maybe_doc) = ppHsName name <> (braces . hsep . punctuate comma . map ppField $ fieldList) -ppHsConstr (HsConDecl pos name tvs ctxt typeList maybe_doc) = +ppHsConstr (HsConDecl pos name tvs ctxt typeList maybe_doc) = hsep (ppHsName name : map ppHsBangType typeList) ppField (HsFieldDecl ns ty doc) @@ -100,7 +100,7 @@ ppHsBangType (HsUnBangedTy ty) = ppHsType ty ppHsContext :: HsContext -> Doc ppHsContext [] = empty -ppHsContext context = parenList (map (\ (a,b) -> ppHsQName a <+> +ppHsContext context = parenList (map (\ (a,b) -> ppHsQName a <+> hsep (map ppHsAType b)) context) ppHsType :: HsType -> Doc @@ -109,7 +109,7 @@ ppHsType (HsForAllType Nothing context htype) = ppHsType (HsForAllType (Just tvs) [] htype) = hsep (text "forall" : map ppHsName tvs ++ text "." : [ppHsType htype]) ppHsType (HsForAllType (Just tvs) context htype) = - hsep (text "forall" : map ppHsName tvs ++ text "." : + hsep (text "forall" : map ppHsName tvs ++ text "." : ppHsContext context : text "=>" : [ppHsType htype]) ppHsType (HsTyFun a b) = fsep [ppHsBType a, text "->", ppHsType b] ppHsType (HsTyIP n t) = fsep [(char '?' <> ppHsName n), text "::", ppHsType t] @@ -135,7 +135,7 @@ ppHsQName (UnQual str) = ppHsName str ppHsQName n@(Qual (Module mod) str) | n == unit_con_name = ppHsName str | isSpecial str = ppHsName str - | otherwise + | otherwise = text "<link linkend=" <> ppLinkId mod str <> char '>' <> ppHsName str <> text "</link>" diff --git a/haddock-api/src/Haddock/Backends/Hoogle.hs b/haddock-api/src/Haddock/Backends/Hoogle.hs index fe656a4b..a9bc9a8b 100644 --- a/haddock-api/src/Haddock/Backends/Hoogle.hs +++ b/haddock-api/src/Haddock/Backends/Hoogle.hs @@ -15,12 +15,15 @@ module Haddock.Backends.Hoogle ( ppHoogle ) where - +import BasicTypes (OverlapFlag(..), OverlapMode(..)) +import InstEnv (ClsInst(..)) import Haddock.GhcUtils import Haddock.Types hiding (Version) import Haddock.Utils hiding (out) + import GHC import Outputable +import NameSet import Data.Char import Data.List @@ -64,7 +67,8 @@ dropHsDocTy :: HsType a -> HsType a dropHsDocTy = f where g (L src x) = L src (f x) - f (HsForAllTy a b c d e) = HsForAllTy a b c d (g e) + f (HsForAllTy a e) = HsForAllTy a (g e) + f (HsQualTy a e) = HsQualTy a (g e) f (HsBangTy a b) = HsBangTy a (g b) f (HsAppTy a b) = HsAppTy (g a) (g b) f (HsFunTy a b) = HsFunTy (g a) (g b) @@ -81,32 +85,28 @@ outHsType :: OutputableBndr a => DynFlags -> HsType a -> String outHsType dflags = out dflags . dropHsDocTy -makeExplicit :: HsType a -> HsType a -makeExplicit (HsForAllTy _ a b c d) = HsForAllTy Explicit a b c d -makeExplicit x = x - -makeExplicitL :: LHsType a -> LHsType a -makeExplicitL (L src x) = L src (makeExplicit x) - - dropComment :: String -> String dropComment (' ':'-':'-':' ':_) = [] dropComment (x:xs) = x : dropComment xs dropComment [] = [] -out :: Outputable a => DynFlags -> a -> String -out dflags = f . unwords . map (dropWhile isSpace) . lines . showSDocUnqual dflags . ppr +outWith :: Outputable a => (SDoc -> String) -> a -> [Char] +outWith p = f . unwords . map (dropWhile isSpace) . lines . p . ppr where f xs | " <document comment>" `isPrefixOf` xs = f $ drop 19 xs f (x:xs) = x : f xs f [] = [] +out :: Outputable a => DynFlags -> a -> String +out dflags = outWith $ showSDocUnqual dflags operator :: String -> String operator (x:xs) | not (isAlphaNum x) && x `notElem` "_' ([{" = '(' : x:xs ++ ")" operator x = x +commaSeparate :: Outputable a => DynFlags -> [a] -> String +commaSeparate dflags = showSDocUnqual dflags . interpp'SP --------------------------------------------------------------------- -- How to print each export @@ -115,49 +115,84 @@ ppExport :: DynFlags -> ExportItem Name -> [String] ppExport dflags ExportDecl { expItemDecl = L _ decl , expItemMbDoc = (dc, _) , expItemSubDocs = subdocs + , expItemFixities = fixities } = ppDocumentation dflags dc ++ f decl where f (TyClD d@DataDecl{}) = ppData dflags d subdocs f (TyClD d@SynDecl{}) = ppSynonym dflags d - f (TyClD d@ClassDecl{}) = ppClass dflags d - f (ForD (ForeignImport name typ _ _)) = ppSig dflags $ TypeSig [name] typ [] - f (ForD (ForeignExport name typ _ _)) = ppSig dflags $ TypeSig [name] typ [] - f (SigD sig) = ppSig dflags sig + f (TyClD d@ClassDecl{}) = ppClass dflags d subdocs + f (ForD (ForeignImport name typ _ _)) = [pp_sig dflags [name] (hsSigType typ)] + f (ForD (ForeignExport name typ _ _)) = [pp_sig dflags [name] (hsSigType typ)] + f (SigD sig) = ppSig dflags sig ++ ppFixities f _ = [] + + ppFixities = concatMap (ppFixity dflags) fixities ppExport _ _ = [] +ppSigWithDoc :: DynFlags -> Sig Name -> [(Name, DocForDecl Name)] -> [String] +ppSigWithDoc dflags (TypeSig names sig) subdocs + = concatMap mkDocSig names + where + mkDocSig n = concatMap (ppDocumentation dflags) (getDoc n) + ++ [pp_sig dflags names (hsSigWcType sig)] + + getDoc :: Located Name -> [Documentation Name] + getDoc n = maybe [] (return . fst) (lookup (unL n) subdocs) + +ppSigWithDoc _ _ _ = [] ppSig :: DynFlags -> Sig Name -> [String] -ppSig dflags (TypeSig names sig _) - = [operator prettyNames ++ " :: " ++ outHsType dflags typ] - where - prettyNames = intercalate ", " $ map (out dflags) names - typ = case unL sig of - HsForAllTy Explicit a b c d -> HsForAllTy Implicit a b c d - HsForAllTy Qualified a b c d -> HsForAllTy Implicit a b c d - x -> x -ppSig _ _ = [] +ppSig dflags x = ppSigWithDoc dflags x [] +pp_sig :: DynFlags -> [Located Name] -> LHsType Name -> String +pp_sig dflags names (L _ typ) = + operator prettyNames ++ " :: " ++ outHsType dflags typ + where + prettyNames = intercalate ", " $ map (out dflags) names -- note: does not yet output documentation for class methods -ppClass :: DynFlags -> TyClDecl Name -> [String] -ppClass dflags x = out dflags x{tcdSigs=[]} : - concatMap (ppSig dflags . addContext . unL) (tcdSigs x) +ppClass :: DynFlags -> TyClDecl Name -> [(Name, DocForDecl Name)] -> [String] +ppClass dflags decl subdocs = (out dflags decl{tcdSigs=[]} ++ ppTyFams) : ppMethods where - addContext (TypeSig name (L l sig) nwcs) = TypeSig name (L l $ f sig) nwcs - addContext (MinimalSig src sig) = MinimalSig src sig - addContext _ = error "expected TypeSig" - f (HsForAllTy a b c con d) = HsForAllTy a b c (reL (context : unLoc con)) d - f t = HsForAllTy Implicit Nothing emptyHsQTvs (reL [context]) (reL t) + ppMethods = concat . map (ppSig' . unLoc . add_ctxt) $ tcdSigs decl + ppSig' = flip (ppSigWithDoc dflags) subdocs - context = nlHsTyConApp (tcdName x) - (map (reL . HsTyVar . hsTyVarName . unL) (hsQTvBndrs (tyClDeclTyVars x))) + add_ctxt = addClassContext (tcdName decl) (tyClDeclTyVars decl) + ppTyFams + | null $ tcdATs decl = "" + | otherwise = (" " ++) . showSDocUnqual dflags . whereWrapper $ concat + [ map ppr (tcdATs decl) + , map (ppr . tyFamEqnToSyn . unLoc) (tcdATDefs decl) + ] + + whereWrapper elems = vcat' + [ text "where" <+> lbrace + , nest 4 . vcat . map (<> semi) $ elems + , rbrace + ] + + tyFamEqnToSyn :: TyFamDefltEqn Name -> TyClDecl Name + tyFamEqnToSyn tfe = SynDecl + { tcdLName = tfe_tycon tfe + , tcdTyVars = tfe_pats tfe + , tcdRhs = tfe_rhs tfe + , tcdFVs = emptyNameSet + } -ppInstance :: DynFlags -> ClsInst -> [String] -ppInstance dflags x = [dropComment $ out dflags x] +ppInstance :: DynFlags -> ClsInst -> [String] +ppInstance dflags x = + [dropComment $ outWith (showSDocForUser dflags alwaysQualify) cls] + where + -- As per #168, we don't want safety information about the class + -- in Hoogle output. The easiest way to achieve this is to set the + -- safety information to a state where the Outputable instance + -- produces no output which means no overlap and unsafe (or [safe] + -- is generated). + cls = x { is_flag = OverlapFlag { overlapMode = NoOverlap mempty + , isSafeOverlap = False } } ppSynonym :: DynFlags -> TyClDecl Name -> [String] ppSynonym dflags x = [out dflags x] @@ -184,26 +219,40 @@ lookupCon dflags subdocs (L _ name) = case lookup name subdocs of _ -> [] ppCtor :: DynFlags -> TyClDecl Name -> [(Name, DocForDecl Name)] -> ConDecl Name -> [String] -ppCtor dflags dat subdocs con - = concatMap (lookupCon dflags subdocs) (con_names con) ++ f (con_details con) +ppCtor dflags dat subdocs con@ConDeclH98 {} + -- AZ:TODO get rid of the concatMap + = concatMap (lookupCon dflags subdocs) [con_name con] ++ f (getConDetails con) where f (PrefixCon args) = [typeSig name $ args ++ [resType]] f (InfixCon a1 a2) = f $ PrefixCon [a1,a2] f (RecCon (L _ recs)) = f (PrefixCon $ map cd_fld_type (map unLoc recs)) ++ concat - [(concatMap (lookupCon dflags subdocs) (cd_fld_names r)) ++ - [out dflags (map unL $ cd_fld_names r) `typeSig` [resType, cd_fld_type r]] + [(concatMap (lookupCon dflags subdocs . noLoc . selectorFieldOcc . unLoc) (cd_fld_names r)) ++ + [out dflags (map (selectorFieldOcc . unLoc) $ cd_fld_names r) `typeSig` [resType, cd_fld_type r]] | r <- map unLoc recs] - funs = foldr1 (\x y -> reL $ HsFunTy (makeExplicitL x) (makeExplicitL y)) + funs = foldr1 (\x y -> reL $ HsFunTy x y) apps = foldl1 (\x y -> reL $ HsAppTy x y) - typeSig nm flds = operator nm ++ " :: " ++ outHsType dflags (makeExplicit $ unL $ funs flds) - name = out dflags $ map unL $ con_names con + typeSig nm flds = operator nm ++ " :: " ++ outHsType dflags (unL $ funs flds) + + -- We print the constructors as comma-separated list. See GHC + -- docs for con_names on why it is a list to begin with. + name = commaSeparate dflags . map unL $ getConNames con + + resType = apps $ map (reL . HsTyVar . reL) $ + (tcdName dat) : [hsTyVarName v | L _ v@(UserTyVar _) <- hsQTvExplicit $ tyClDeclTyVars dat] + +ppCtor dflags _dat subdocs con@ConDeclGADT {} + = concatMap (lookupCon dflags subdocs) (getConNames con) ++ f + where + f = [typeSig name (hsib_body $ con_type con)] + + typeSig nm ty = operator nm ++ " :: " ++ outHsType dflags (unL ty) + name = out dflags $ map unL $ getConNames con - resType = case con_res con of - ResTyH98 -> apps $ map (reL . HsTyVar) $ - (tcdName dat) : [hsTyVarName v | L _ v@(UserTyVar _) <- hsQTvBndrs $ tyClDeclTyVars dat] - ResTyGADT _ x -> x + +ppFixity :: DynFlags -> (Name, Fixity) -> [String] +ppFixity dflags (name, fixity) = [out dflags (FixitySig [noLoc name] fixity)] --------------------------------------------------------------------- @@ -334,3 +383,8 @@ escape = concatMap f f '>' = ">" f '&' = "&" f x = [x] + + +-- | Just like 'vcat' but uses '($+$)' instead of '($$)'. +vcat' :: [SDoc] -> SDoc +vcat' = foldr ($+$) empty diff --git a/haddock-api/src/Haddock/Backends/Hyperlinker.hs b/haddock-api/src/Haddock/Backends/Hyperlinker.hs new file mode 100644 index 00000000..248a8a54 --- /dev/null +++ b/haddock-api/src/Haddock/Backends/Hyperlinker.hs @@ -0,0 +1,64 @@ +module Haddock.Backends.Hyperlinker + ( ppHyperlinkedSource + , module Haddock.Backends.Hyperlinker.Types + , module Haddock.Backends.Hyperlinker.Utils + ) where + + +import Haddock.Types +import Haddock.Backends.Hyperlinker.Renderer +import Haddock.Backends.Hyperlinker.Types +import Haddock.Backends.Hyperlinker.Utils + +import Text.XHtml hiding ((</>)) + +import Data.Maybe +import System.Directory +import System.FilePath + + +-- | Generate hyperlinked source for given interfaces. +-- +-- Note that list of interfaces should also contain interfaces normally hidden +-- when generating documentation. Otherwise this could lead to dead links in +-- produced source. +ppHyperlinkedSource :: FilePath -- ^ Output directory + -> FilePath -- ^ Resource directory + -> Maybe FilePath -- ^ Custom CSS file path + -> Bool -- ^ Flag indicating whether to pretty-print HTML + -> SrcMap -- ^ Paths to sources + -> [Interface] -- ^ Interfaces for which we create source + -> IO () +ppHyperlinkedSource outdir libdir mstyle pretty srcs ifaces = do + createDirectoryIfMissing True srcdir + let cssFile = fromMaybe (defaultCssFile libdir) mstyle + copyFile cssFile $ srcdir </> srcCssFile + copyFile (libdir </> "html" </> highlightScript) $ + srcdir </> highlightScript + mapM_ (ppHyperlinkedModuleSource srcdir pretty srcs) ifaces + where + srcdir = outdir </> hypSrcDir + +-- | Generate hyperlinked source for particular interface. +ppHyperlinkedModuleSource :: FilePath -> Bool -> SrcMap -> Interface + -> IO () +ppHyperlinkedModuleSource srcdir pretty srcs iface = + case ifaceTokenizedSrc iface of + Just tokens -> writeFile path . html . render' $ tokens + Nothing -> return () + where + render' = render (Just srcCssFile) (Just highlightScript) srcs + html = if pretty then renderHtml else showHtml + path = srcdir </> hypSrcModuleFile (ifaceMod iface) + +-- | Name of CSS file in output directory. +srcCssFile :: FilePath +srcCssFile = "style.css" + +-- | Name of highlight script in output and resource directory. +highlightScript :: FilePath +highlightScript = "highlight.js" + +-- | Path to default CSS file. +defaultCssFile :: FilePath -> FilePath +defaultCssFile libdir = libdir </> "html" </> "solarized.css" diff --git a/haddock-api/src/Haddock/Backends/Hyperlinker/Ast.hs b/haddock-api/src/Haddock/Backends/Hyperlinker/Ast.hs new file mode 100644 index 00000000..e8baae88 --- /dev/null +++ b/haddock-api/src/Haddock/Backends/Hyperlinker/Ast.hs @@ -0,0 +1,185 @@ +{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE RecordWildCards #-} +{-# LANGUAGE TypeFamilies #-} + + +module Haddock.Backends.Hyperlinker.Ast (enrich) where + + +import Haddock.Syb +import Haddock.Backends.Hyperlinker.Types + +import qualified GHC + +import Control.Applicative +import Data.Data +import Data.Maybe + + +-- | Add more detailed information to token stream using GHC API. +enrich :: GHC.RenamedSource -> [Token] -> [RichToken] +enrich src = + map $ \token -> RichToken + { rtkToken = token + , rtkDetails = enrichToken token detailsMap + } + where + detailsMap = concatMap ($ src) + [ variables + , types + , decls + , binds + , imports + ] + +-- | A map containing association between source locations and "details" of +-- this location. +-- +-- For the time being, it is just a list of pairs. However, looking up things +-- in such structure has linear complexity. We cannot use any hashmap-like +-- stuff because source locations are not ordered. In the future, this should +-- be replaced with interval tree data structure. +type DetailsMap = [(GHC.SrcSpan, TokenDetails)] + +lookupBySpan :: Span -> DetailsMap -> Maybe TokenDetails +lookupBySpan tspan = listToMaybe . map snd . filter (matches tspan . fst) + +enrichToken :: Token -> DetailsMap -> Maybe TokenDetails +enrichToken (Token typ _ spn) dm + | typ `elem` [TkIdentifier, TkOperator] = lookupBySpan spn dm +enrichToken _ _ = Nothing + +-- | Obtain details map for variables ("normally" used identifiers). +variables :: GHC.RenamedSource -> DetailsMap +variables = + everything (<|>) (var `combine` rec) + where + var term = case cast term of + (Just (GHC.L sspan (GHC.HsVar name))) -> + pure (sspan, RtkVar (GHC.unLoc name)) + (Just (GHC.L _ (GHC.RecordCon (GHC.L sspan name) _ _ _))) -> + pure (sspan, RtkVar name) + _ -> empty + rec term = case cast term of + Just (GHC.HsRecField (GHC.L sspan name) (_ :: GHC.LHsExpr GHC.Name) _) -> + pure (sspan, RtkVar name) + _ -> empty + +-- | Obtain details map for types. +types :: GHC.RenamedSource -> DetailsMap +types = + everything (<|>) ty + where + ty term = case cast term of + (Just (GHC.L sspan (GHC.HsTyVar name))) -> + pure (sspan, RtkType (GHC.unLoc name)) + _ -> empty + +-- | Obtain details map for identifier bindings. +-- +-- That includes both identifiers bound by pattern matching or declared using +-- ordinary assignment (in top-level declarations, let-expressions and where +-- clauses). +binds :: GHC.RenamedSource -> DetailsMap +binds = + everything (<|>) (fun `combine` pat `combine` tvar) + where + fun term = case cast term of + (Just (GHC.FunBind (GHC.L sspan name) _ _ _ _ :: GHC.HsBind GHC.Name)) -> + pure (sspan, RtkBind name) + _ -> empty + pat term = case cast term of + (Just (GHC.L sspan (GHC.VarPat name))) -> + pure (sspan, RtkBind (GHC.unLoc name)) + (Just (GHC.L _ (GHC.ConPatIn (GHC.L sspan name) recs))) -> + [(sspan, RtkVar name)] ++ everything (<|>) rec recs + (Just (GHC.L _ (GHC.AsPat (GHC.L sspan name) _))) -> + pure (sspan, RtkBind name) + _ -> empty + rec term = case cast term of + (Just (GHC.HsRecField (GHC.L sspan name) (_ :: GHC.LPat GHC.Name) _)) -> + pure (sspan, RtkVar name) + _ -> empty + tvar term = case cast term of + (Just (GHC.L sspan (GHC.UserTyVar name))) -> + pure (sspan, RtkBind (GHC.unLoc name)) + (Just (GHC.L _ (GHC.KindedTyVar (GHC.L sspan name) _))) -> + pure (sspan, RtkBind name) + _ -> empty + +-- | Obtain details map for top-level declarations. +decls :: GHC.RenamedSource -> DetailsMap +decls (group, _, _, _) = concatMap ($ group) + [ concat . map typ . concat . map GHC.group_tyclds . GHC.hs_tyclds + , everything (<|>) fun . GHC.hs_valds + , everything (<|>) (con `combine` ins) + ] + where + typ (GHC.L _ t) = case t of + GHC.DataDecl name _ _ _ -> pure . decl $ name + GHC.SynDecl name _ _ _ -> pure . decl $ name + GHC.FamDecl fam -> pure . decl $ GHC.fdLName fam + GHC.ClassDecl{..} -> [decl tcdLName] ++ concatMap sig tcdSigs + fun term = case cast term of + (Just (GHC.FunBind (GHC.L sspan name) _ _ _ _ :: GHC.HsBind GHC.Name)) + | GHC.isExternalName name -> pure (sspan, RtkDecl name) + _ -> empty + con term = case cast term of + (Just cdcl) -> + map decl (GHC.getConNames cdcl) ++ everything (<|>) fld cdcl + Nothing -> empty + ins term = case cast term of + (Just (GHC.DataFamInstD inst)) -> pure . tyref $ GHC.dfid_tycon inst + (Just (GHC.TyFamInstD (GHC.TyFamInstDecl (GHC.L _ eqn) _))) -> + pure . tyref $ GHC.tfe_tycon eqn + _ -> empty + fld term = case cast term of + Just (field :: GHC.ConDeclField GHC.Name) + -> map (decl . fmap GHC.selectorFieldOcc) $ GHC.cd_fld_names field + Nothing -> empty + sig (GHC.L _ (GHC.TypeSig names _)) = map decl names + sig _ = [] + decl (GHC.L sspan name) = (sspan, RtkDecl name) + tyref (GHC.L sspan name) = (sspan, RtkType name) + +-- | Obtain details map for import declarations. +-- +-- This map also includes type and variable details for items in export and +-- import lists. +imports :: GHC.RenamedSource -> DetailsMap +imports src@(_, imps, _, _) = + everything (<|>) ie src ++ mapMaybe (imp . GHC.unLoc) imps + where + ie term = case cast term of + (Just (GHC.IEVar v)) -> pure $ var v + (Just (GHC.IEThingAbs t)) -> pure $ typ t + (Just (GHC.IEThingAll t)) -> pure $ typ t + (Just (GHC.IEThingWith t _ vs _fls)) -> + [typ t] ++ map var vs + _ -> empty + typ (GHC.L sspan name) = (sspan, RtkType name) + var (GHC.L sspan name) = (sspan, RtkVar name) + imp idecl | not . GHC.ideclImplicit $ idecl = + let (GHC.L sspan name) = GHC.ideclName idecl + in Just (sspan, RtkModule name) + imp _ = Nothing + +-- | Check whether token stream span matches GHC source span. +-- +-- Currently, it is implemented as checking whether "our" span is contained +-- in GHC span. The reason for that is because GHC span are generally wider +-- and may spread across couple tokens. For example, @(>>=)@ consists of three +-- tokens: @(@, @>>=@, @)@, but GHC source span associated with @>>=@ variable +-- contains @(@ and @)@. Similarly, qualified identifiers like @Foo.Bar.quux@ +-- are tokenized as @Foo@, @.@, @Bar@, @.@, @quux@ but GHC source span +-- associated with @quux@ contains all five elements. +matches :: Span -> GHC.SrcSpan -> Bool +matches tspan (GHC.RealSrcSpan aspan) + | saspan <= stspan && etspan <= easpan = True + where + stspan = (posRow . spStart $ tspan, posCol . spStart $ tspan) + etspan = (posRow . spEnd $ tspan, posCol . spEnd $ tspan) + saspan = (GHC.srcSpanStartLine aspan, GHC.srcSpanStartCol aspan) + easpan = (GHC.srcSpanEndLine aspan, GHC.srcSpanEndCol aspan) +matches _ _ = False diff --git a/haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs b/haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs new file mode 100644 index 00000000..e206413e --- /dev/null +++ b/haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs @@ -0,0 +1,204 @@ +module Haddock.Backends.Hyperlinker.Parser (parse) where + + +import Data.Char +import Data.List +import Data.Maybe + +import Haddock.Backends.Hyperlinker.Types + + +-- | Turn source code string into a stream of more descriptive tokens. +-- +-- Result should retain original file layout (including comments, whitespace, +-- etc.), i.e. the following "law" should hold: +-- +-- @concat . map 'tkValue' . 'parse' = id@ +parse :: String -> [Token] +parse = tokenize . tag . chunk + +-- | Split raw source string to more meaningful chunks. +-- +-- This is the initial stage of tokenization process. Each chunk is either +-- a comment (including comment delimiters), a whitespace string, preprocessor +-- macro (and all its content until the end of a line) or valid Haskell lexeme. +chunk :: String -> [String] +chunk [] = [] +chunk str@(c:_) + | isSpace c = + let (space, mcpp, rest) = spanSpaceOrCpp str + in [space] ++ maybeToList mcpp ++ chunk rest +chunk str + | "--" `isPrefixOf` str = chunk' $ spanToNewline str + | "{-" `isPrefixOf` str = chunk' $ chunkComment 0 str + | otherwise = case lex str of + (tok:_) -> chunk' tok + [] -> [str] + where + chunk' (c, rest) = c:(chunk rest) + +-- | Split input to "first line" string and the rest of it. +-- +-- Ideally, this should be done simply with @'break' (== '\n')@. However, +-- Haskell also allows line-unbreaking (or whatever it is called) so things +-- are not as simple and this function deals with that. +spanToNewline :: String -> (String, String) +spanToNewline [] = ([], []) +spanToNewline ('\\':'\n':str) = + let (str', rest) = spanToNewline str + in ('\\':'\n':str', rest) +spanToNewline str@('\n':_) = ("", str) +spanToNewline (c:str) = + let (str', rest) = spanToNewline str + in (c:str', rest) + +-- | Split input to whitespace string, (optional) preprocessor directive and +-- the rest of it. +-- +-- Again, using something like @'span' 'isSpace'@ would be nice to chunk input +-- to whitespace. The problem is with /#/ symbol - if it is placed at the very +-- beginning of a line, it should be recognized as preprocessor macro. In any +-- other case, it is ordinary Haskell symbol and can be used to declare +-- operators. Hence, while dealing with whitespace we also check whether there +-- happens to be /#/ symbol just after a newline character - if that is the +-- case, we begin treating the whole line as preprocessor macro. +spanSpaceOrCpp :: String -> (String, Maybe String, String) +spanSpaceOrCpp ('\n':'#':str) = + let (str', rest) = spanToNewline str + in ("\n", Just $ '#':str', rest) +spanSpaceOrCpp (c:str') + | isSpace c = + let (space, mcpp, rest) = spanSpaceOrCpp str' + in (c:space, mcpp, rest) +spanSpaceOrCpp str = ("", Nothing, str) + +-- | Split input to comment content (including delimiters) and the rest. +-- +-- Again, some more logic than simple 'span' is required because of Haskell +-- comment nesting policy. +chunkComment :: Int -> String -> (String, String) +chunkComment _ [] = ("", "") +chunkComment depth ('{':'-':str) = + let (c, rest) = chunkComment (depth + 1) str + in ("{-" ++ c, rest) +chunkComment depth ('-':'}':str) + | depth == 1 = ("-}", str) + | otherwise = + let (c, rest) = chunkComment (depth - 1) str + in ("-}" ++ c, rest) +chunkComment depth (e:str) = + let (c, rest) = chunkComment depth str + in (e:c, rest) + +-- | Assign source location for each chunk in given stream. +tag :: [String] -> [(Span, String)] +tag = + reverse . snd . foldl aux (Position 1 1, []) + where + aux (pos, cs) str = + let pos' = foldl move pos str + in (pos', (Span pos pos', str):cs) + move pos '\n' = pos { posRow = posRow pos + 1, posCol = 1 } + move pos _ = pos { posCol = posCol pos + 1 } + +-- | Turn unrecognised chunk stream to more descriptive token stream. +tokenize :: [(Span, String)] -> [Token] +tokenize = + map aux + where + aux (sp, str) = Token + { tkType = classify str + , tkValue = str + , tkSpan = sp + } + +-- | Classify given string as appropriate Haskell token. +-- +-- This method is based on Haskell 98 Report lexical structure description: +-- https://www.haskell.org/onlinereport/lexemes.html +-- +-- However, this is probably far from being perfect and most probably does not +-- handle correctly all corner cases. +classify :: String -> TokenType +classify str + | "--" `isPrefixOf` str = TkComment + | "{-#" `isPrefixOf` str = TkPragma + | "{-" `isPrefixOf` str = TkComment +classify str@(c:_) + | isSpace c = TkSpace + | isDigit c = TkNumber + | c `elem` special = TkSpecial + | str `elem` glyphs = TkGlyph + | all (`elem` symbols) str = TkOperator + | c == '#' = TkCpp + | c == '"' = TkString + | c == '\'' = TkChar +classify str + | str `elem` keywords = TkKeyword + | isIdentifier str = TkIdentifier + | otherwise = TkUnknown + +keywords :: [String] +keywords = + [ "as" + , "case" + , "class" + , "data" + , "default" + , "deriving" + , "do" + , "else" + , "hiding" + , "if" + , "import" + , "in" + , "infix" + , "infixl" + , "infixr" + , "instance" + , "let" + , "module" + , "newtype" + , "of" + , "qualified" + , "then" + , "type" + , "where" + , "forall" + , "family" + , "mdo" + ] + +glyphs :: [String] +glyphs = + [ ".." + , ":" + , "::" + , "=" + , "\\" + , "|" + , "<-" + , "->" + , "@" + , "~" + , "~#" + , "=>" + , "-" + , "!" + ] + +special :: [Char] +special = "()[]{},;`" + +-- TODO: Add support for any Unicode symbol or punctuation. +-- source: http://stackoverflow.com/questions/10548170/what-characters-are-permitted-for-haskell-operators +symbols :: [Char] +symbols = "!#$%&*+./<=>?@\\^|-~:" + +isIdentifier :: String -> Bool +isIdentifier (s:str) + | (isLower' s || isUpper s) && all isAlphaNum' str = True + where + isLower' c = isLower c || c == '_' + isAlphaNum' c = isAlphaNum c || c == '_' || c == '\'' +isIdentifier _ = False diff --git a/haddock-api/src/Haddock/Backends/Hyperlinker/Renderer.hs b/haddock-api/src/Haddock/Backends/Hyperlinker/Renderer.hs new file mode 100644 index 00000000..15793f0c --- /dev/null +++ b/haddock-api/src/Haddock/Backends/Hyperlinker/Renderer.hs @@ -0,0 +1,189 @@ +{-# LANGUAGE RecordWildCards #-} + + +module Haddock.Backends.Hyperlinker.Renderer (render) where + + +import Haddock.Backends.Hyperlinker.Types +import Haddock.Backends.Hyperlinker.Utils + +import qualified GHC +import qualified Name as GHC +import qualified Unique as GHC + +import System.FilePath.Posix ((</>)) + +import Data.List +import Data.Maybe +import Data.Monoid +import qualified Data.Map as Map + +import Text.XHtml (Html, HtmlAttr, (!)) +import qualified Text.XHtml as Html + + +type StyleClass = String + + +render :: Maybe FilePath -> Maybe FilePath -> SrcMap -> [RichToken] + -> Html +render mcss mjs srcs tokens = header mcss mjs <> body srcs tokens + + +data TokenGroup + = GrpNormal Token + | GrpRich TokenDetails [Token] + + +-- | Group consecutive tokens pointing to the same element. +-- +-- We want to render qualified identifiers as one entity. For example, +-- @Bar.Baz.foo@ consists of 5 tokens (@Bar@, @.@, @Baz@, @.@, @foo@) but for +-- better user experience when highlighting and clicking links, these tokens +-- should be regarded as one identifier. Therefore, before rendering we must +-- group consecutive elements pointing to the same 'GHC.Name' (note that even +-- dot token has it if it is part of qualified name). +groupTokens :: [RichToken] -> [TokenGroup] +groupTokens [] = [] +groupTokens ((RichToken tok Nothing):rest) = (GrpNormal tok):(groupTokens rest) +groupTokens ((RichToken tok (Just det)):rest) = + let (grp, rest') = span same rest + in (GrpRich det (tok:(map rtkToken grp))):(groupTokens rest') + where + same (RichToken _ (Just det')) = det == det' + same _ = False + + +body :: SrcMap -> [RichToken] -> Html +body srcs tokens = + Html.body . Html.pre $ hypsrc + where + hypsrc = mconcat . map (tokenGroup srcs) . groupTokens $ tokens + + +header :: Maybe FilePath -> Maybe FilePath -> Html +header mcss mjs + | isNothing mcss && isNothing mjs = Html.noHtml +header mcss mjs = + Html.header $ css mcss <> js mjs + where + css Nothing = Html.noHtml + css (Just cssFile) = Html.thelink Html.noHtml ! + [ Html.rel "stylesheet" + , Html.thetype "text/css" + , Html.href cssFile + ] + js Nothing = Html.noHtml + js (Just scriptFile) = Html.script Html.noHtml ! + [ Html.thetype "text/javascript" + , Html.src scriptFile + ] + + +tokenGroup :: SrcMap -> TokenGroup -> Html +tokenGroup _ (GrpNormal tok@(Token { .. })) + | tkType == TkSpace = renderSpace (posRow . spStart $ tkSpan) tkValue + | otherwise = tokenSpan tok ! attrs + where + attrs = [ multiclass . tokenStyle $ tkType ] +tokenGroup srcs (GrpRich det tokens) = + externalAnchor det . internalAnchor det . hyperlink srcs det $ content + where + content = mconcat . map (richToken det) $ tokens + + +richToken :: TokenDetails -> Token -> Html +richToken det tok = + tokenSpan tok ! [ multiclass style ] + where + style = (tokenStyle . tkType) tok ++ richTokenStyle det + + +tokenSpan :: Token -> Html +tokenSpan = Html.thespan . Html.toHtml . tkValue + + +richTokenStyle :: TokenDetails -> [StyleClass] +richTokenStyle (RtkVar _) = ["hs-var"] +richTokenStyle (RtkType _) = ["hs-type"] +richTokenStyle _ = [] + +tokenStyle :: TokenType -> [StyleClass] +tokenStyle TkIdentifier = ["hs-identifier"] +tokenStyle TkKeyword = ["hs-keyword"] +tokenStyle TkString = ["hs-string"] +tokenStyle TkChar = ["hs-char"] +tokenStyle TkNumber = ["hs-number"] +tokenStyle TkOperator = ["hs-operator"] +tokenStyle TkGlyph = ["hs-glyph"] +tokenStyle TkSpecial = ["hs-special"] +tokenStyle TkSpace = [] +tokenStyle TkComment = ["hs-comment"] +tokenStyle TkCpp = ["hs-cpp"] +tokenStyle TkPragma = ["hs-pragma"] +tokenStyle TkUnknown = [] + +multiclass :: [StyleClass] -> HtmlAttr +multiclass = Html.theclass . intercalate " " + +externalAnchor :: TokenDetails -> Html -> Html +externalAnchor (RtkDecl name) content = + Html.anchor content ! [ Html.name $ externalAnchorIdent name ] +externalAnchor _ content = content + +internalAnchor :: TokenDetails -> Html -> Html +internalAnchor (RtkBind name) content = + Html.anchor content ! [ Html.name $ internalAnchorIdent name ] +internalAnchor _ content = content + +externalAnchorIdent :: GHC.Name -> String +externalAnchorIdent = hypSrcNameUrl + +internalAnchorIdent :: GHC.Name -> String +internalAnchorIdent = ("local-" ++) . show . GHC.getKey . GHC.nameUnique + +hyperlink :: SrcMap -> TokenDetails -> Html -> Html +hyperlink srcs details = case rtkName details of + Left name -> + if GHC.isInternalName name + then internalHyperlink name + else externalNameHyperlink srcs name + Right name -> externalModHyperlink srcs name + +internalHyperlink :: GHC.Name -> Html -> Html +internalHyperlink name content = + Html.anchor content ! [ Html.href $ "#" ++ internalAnchorIdent name ] + +externalNameHyperlink :: SrcMap -> GHC.Name -> Html -> Html +externalNameHyperlink (srcs, _) name content = case Map.lookup mdl srcs of + Just SrcLocal -> Html.anchor content ! + [ Html.href $ hypSrcModuleNameUrl mdl name ] + Just (SrcExternal path) -> Html.anchor content ! + [ Html.href $ path </> hypSrcModuleNameUrl mdl name ] + Nothing -> content + where + mdl = GHC.nameModule name + +externalModHyperlink :: SrcMap -> GHC.ModuleName -> Html -> Html +externalModHyperlink (_, srcs) name content = case Map.lookup name srcs of + Just SrcLocal -> Html.anchor content ! + [ Html.href $ hypSrcModuleUrl' name ] + Just (SrcExternal path) -> Html.anchor content ! + [ Html.href $ path </> hypSrcModuleUrl' name ] + Nothing -> content + + +renderSpace :: Int -> String -> Html +renderSpace _ [] = Html.noHtml +renderSpace line ('\n':rest) = mconcat + [ Html.thespan . Html.toHtml $ "\n" + , lineAnchor (line + 1) + , renderSpace (line + 1) rest + ] +renderSpace line space = + let (hspace, rest) = span (/= '\n') space + in (Html.thespan . Html.toHtml) hspace <> renderSpace line rest + + +lineAnchor :: Int -> Html +lineAnchor line = Html.anchor Html.noHtml ! [ Html.name $ hypSrcLineUrl line ] diff --git a/haddock-api/src/Haddock/Backends/Hyperlinker/Types.hs b/haddock-api/src/Haddock/Backends/Hyperlinker/Types.hs new file mode 100644 index 00000000..5f4dbc8c --- /dev/null +++ b/haddock-api/src/Haddock/Backends/Hyperlinker/Types.hs @@ -0,0 +1,85 @@ +module Haddock.Backends.Hyperlinker.Types where + + +import qualified GHC + +import Data.Map (Map) +import qualified Data.Map as Map + + +data Token = Token + { tkType :: TokenType + , tkValue :: String + , tkSpan :: Span + } + +data Position = Position + { posRow :: !Int + , posCol :: !Int + } + +data Span = Span + { spStart :: Position + , spEnd :: Position + } + +data TokenType + = TkIdentifier + | TkKeyword + | TkString + | TkChar + | TkNumber + | TkOperator + | TkGlyph + | TkSpecial + | TkSpace + | TkComment + | TkCpp + | TkPragma + | TkUnknown + deriving (Show, Eq) + + +data RichToken = RichToken + { rtkToken :: Token + , rtkDetails :: Maybe TokenDetails + } + +data TokenDetails + = RtkVar GHC.Name + | RtkType GHC.Name + | RtkBind GHC.Name + | RtkDecl GHC.Name + | RtkModule GHC.ModuleName + deriving (Eq) + + +rtkName :: TokenDetails -> Either GHC.Name GHC.ModuleName +rtkName (RtkVar name) = Left name +rtkName (RtkType name) = Left name +rtkName (RtkBind name) = Left name +rtkName (RtkDecl name) = Left name +rtkName (RtkModule name) = Right name + + +-- | Path for making cross-package hyperlinks in generated sources. +-- +-- Used in 'SrcMap' to determine whether module originates in current package +-- or in an external package. +data SrcPath + = SrcExternal FilePath + | SrcLocal + +-- | Mapping from modules to cross-package source paths. +-- +-- This mapping is actually a pair of maps instead of just one map. The reason +-- for this is because when hyperlinking modules in import lists we have no +-- 'GHC.Module' available. On the other hand, we can't just use map with +-- 'GHC.ModuleName' as indices because certain modules may have common name +-- but originate in different packages. Hence, we use both /rich/ and /poor/ +-- versions, where the /poor/ is just projection of /rich/ one cached in pair +-- for better performance. +type SrcMap = (Map GHC.Module SrcPath, Map GHC.ModuleName SrcPath) + +mkSrcMap :: Map GHC.Module SrcPath -> SrcMap +mkSrcMap srcs = (srcs, Map.mapKeys GHC.moduleName srcs) diff --git a/haddock-api/src/Haddock/Backends/Hyperlinker/Utils.hs b/haddock-api/src/Haddock/Backends/Hyperlinker/Utils.hs new file mode 100644 index 00000000..9de4a03d --- /dev/null +++ b/haddock-api/src/Haddock/Backends/Hyperlinker/Utils.hs @@ -0,0 +1,68 @@ +module Haddock.Backends.Hyperlinker.Utils + ( hypSrcDir, hypSrcModuleFile, hypSrcModuleFile' + , hypSrcModuleUrl, hypSrcModuleUrl' + , hypSrcNameUrl + , hypSrcLineUrl + , hypSrcModuleNameUrl, hypSrcModuleLineUrl + , hypSrcModuleUrlFormat + , hypSrcModuleNameUrlFormat, hypSrcModuleLineUrlFormat + ) where + + +import Haddock.Backends.Xhtml.Utils + +import GHC +import FastString +import System.FilePath.Posix ((</>)) + + +hypSrcDir :: FilePath +hypSrcDir = "src" + +hypSrcModuleFile :: Module -> FilePath +hypSrcModuleFile = hypSrcModuleFile' . moduleName + +hypSrcModuleFile' :: ModuleName -> FilePath +hypSrcModuleFile' mdl = spliceURL' + Nothing (Just mdl) Nothing Nothing moduleFormat + +hypSrcModuleUrl :: Module -> String +hypSrcModuleUrl = hypSrcModuleFile + +hypSrcModuleUrl' :: ModuleName -> String +hypSrcModuleUrl' = hypSrcModuleFile' + +hypSrcNameUrl :: Name -> String +hypSrcNameUrl name = spliceURL + Nothing Nothing (Just name) Nothing nameFormat + +hypSrcLineUrl :: Int -> String +hypSrcLineUrl line = spliceURL + Nothing Nothing Nothing (Just spn) lineFormat + where + loc = mkSrcLoc nilFS line 1 + spn = mkSrcSpan loc loc + +hypSrcModuleNameUrl :: Module -> Name -> String +hypSrcModuleNameUrl mdl name = hypSrcModuleUrl mdl ++ "#" ++ hypSrcNameUrl name + +hypSrcModuleLineUrl :: Module -> Int -> String +hypSrcModuleLineUrl mdl line = hypSrcModuleUrl mdl ++ "#" ++ hypSrcLineUrl line + +hypSrcModuleUrlFormat :: String +hypSrcModuleUrlFormat = hypSrcDir </> moduleFormat + +hypSrcModuleNameUrlFormat :: String +hypSrcModuleNameUrlFormat = hypSrcModuleUrlFormat ++ "#" ++ nameFormat + +hypSrcModuleLineUrlFormat :: String +hypSrcModuleLineUrlFormat = hypSrcModuleUrlFormat ++ "#" ++ lineFormat + +moduleFormat :: String +moduleFormat = "%{MODULE}.html" + +nameFormat :: String +nameFormat = "%{NAME}" + +lineFormat :: String +lineFormat = "line-%{LINE}" diff --git a/haddock-api/src/Haddock/Backends/LaTeX.hs b/haddock-api/src/Haddock/Backends/LaTeX.hs index c9262c7e..ab6bb41c 100644 --- a/haddock-api/src/Haddock/Backends/LaTeX.hs +++ b/haddock-api/src/Haddock/Backends/LaTeX.hs @@ -1,4 +1,5 @@ {-# OPTIONS_GHC -fno-warn-name-shadowing #-} +{-# LANGUAGE RecordWildCards #-} ----------------------------------------------------------------------------- -- | -- Module : Haddock.Backends.LaTeX @@ -212,9 +213,9 @@ processExports (e : es) = isSimpleSig :: ExportItem DocName -> Maybe ([DocName], HsType DocName) -isSimpleSig ExportDecl { expItemDecl = L _ (SigD (TypeSig lnames (L _ t) _)) +isSimpleSig ExportDecl { expItemDecl = L _ (SigD (TypeSig lnames t)) , expItemMbDoc = (Documentation Nothing Nothing, argDocs) } - | Map.null argDocs = Just (map unLoc lnames, t) + | Map.null argDocs = Just (map unLoc lnames, unLoc (hsSigWcType t)) isSimpleSig _ = Nothing @@ -249,8 +250,8 @@ ppDocGroup lev doc = sec lev <> braces doc declNames :: LHsDecl DocName -> [DocName] declNames (L _ decl) = case decl of TyClD d -> [tcdName d] - SigD (TypeSig lnames _ _) -> map unLoc lnames - SigD (PatSynSig lname _ _ _ _) -> [unLoc lname] + SigD (TypeSig lnames _ ) -> map unLoc lnames + SigD (PatSynSig lname _) -> [unLoc lname] ForD (ForeignImport (L _ n) _ _ _) -> [n] ForD (ForeignExport (L _ n) _ _ _) -> [n] _ -> error "declaration not supported by declNames" @@ -292,10 +293,11 @@ ppDecl (L loc decl) (doc, fnArgsDoc) instances subdocs _fixities = case decl of -- TyClD d@(TySynonym {}) -- | Just _ <- tcdTyPats d -> ppTyInst False loc doc d unicode -- Family instances happen via FamInst now - TyClD d@(ClassDecl {}) -> ppClassDecl instances loc doc subdocs d unicode - SigD (TypeSig lnames (L _ t) _) -> ppFunSig loc (doc, fnArgsDoc) (map unLoc lnames) t unicode - SigD (PatSynSig lname qtvs prov req ty) -> - ppLPatSig loc (doc, fnArgsDoc) lname qtvs prov req ty unicode + TyClD d@(ClassDecl {}) -> ppClassDecl instances loc doc subdocs d unicode + SigD (TypeSig lnames t) -> ppFunSig loc (doc, fnArgsDoc) (map unLoc lnames) + (hsSigWcType t) unicode + SigD (PatSynSig lname ty) -> + ppLPatSig loc (doc, fnArgsDoc) lname ty unicode ForD d -> ppFor loc (doc, fnArgsDoc) d unicode InstD _ -> empty _ -> error "declaration not supported by ppDecl" @@ -310,8 +312,8 @@ ppTyFam _ _ _ _ _ = ppFor :: SrcSpan -> DocForDecl DocName -> ForeignDecl DocName -> Bool -> LaTeX -ppFor loc doc (ForeignImport (L _ name) (L _ typ) _ _) unicode = - ppFunSig loc doc [name] typ unicode +ppFor loc doc (ForeignImport (L _ name) typ _ _) unicode = + ppFunSig loc doc [name] (hsSigType typ) unicode ppFor _ _ _ _ = error "ppFor error in Haddock.Backends.LaTeX" -- error "foreign declarations are currently not supported by --latex" @@ -328,7 +330,9 @@ ppTySyn loc doc (SynDecl { tcdLName = L _ name, tcdTyVars = ltyvars , tcdRhs = ltype }) unicode = ppTypeOrFunSig loc [name] (unLoc ltype) doc (full, hdr, char '=') unicode where - hdr = hsep (keyword "type" : ppDocBinder name : ppTyVars ltyvars) + hdr = hsep (keyword "type" + : ppDocBinder name + : map ppSymName (tyvarNames ltyvars)) full = hdr <+> char '=' <+> ppLType unicode ltype ppTySyn _ _ _ _ = error "declaration not supported by ppTySyn" @@ -339,9 +343,9 @@ ppTySyn _ _ _ _ = error "declaration not supported by ppTySyn" ------------------------------------------------------------------------------- -ppFunSig :: SrcSpan -> DocForDecl DocName -> [DocName] -> HsType DocName +ppFunSig :: SrcSpan -> DocForDecl DocName -> [DocName] -> LHsType DocName -> Bool -> LaTeX -ppFunSig loc doc docnames typ unicode = +ppFunSig loc doc docnames (L _ typ) unicode = ppTypeOrFunSig loc docnames typ doc ( ppTypeSig names typ False , hsep . punctuate comma $ map ppSymName names @@ -351,29 +355,17 @@ ppFunSig loc doc docnames typ unicode = names = map getName docnames ppLPatSig :: SrcSpan -> DocForDecl DocName -> Located DocName - -> (HsExplicitFlag, LHsTyVarBndrs DocName) - -> LHsContext DocName -> LHsContext DocName - -> LHsType DocName + -> LHsSigType DocName -> Bool -> LaTeX -ppLPatSig _loc (doc, _argDocs) (L _ name) (expl, qtvs) lprov lreq (L _ ty) unicode +ppLPatSig _loc (doc, _argDocs) (L _ name) ty unicode = declWithDoc pref1 (documentationToLaTeX doc) where pref1 = hsep [ keyword "pattern" , ppDocBinder name , dcolon unicode - , ppLTyVarBndrs expl qtvs unicode - , ctx - , ppType unicode ty + , ppLType unicode (hsSigType ty) ] - ctx = case (ppLContextMaybe lprov unicode, ppLContextMaybe lreq unicode) of - (Nothing, Nothing) -> empty - (Nothing, Just req) -> parens empty <+> darr <+> req <+> darr - (Just prov, Nothing) -> prov <+> darr - (Just prov, Just req) -> prov <+> darr <+> req <+> darr - - darr = darrow unicode - ppTypeOrFunSig :: SrcSpan -> [DocName] -> HsType DocName -> DocForDecl DocName -> (LaTeX, LaTeX, LaTeX) -> Bool -> LaTeX @@ -392,23 +384,15 @@ ppTypeOrFunSig _ _ typ (doc, argDocs) (pref1, pref2, sep0) arg_doc n = rDoc . fmap _doc $ Map.lookup n argDocs - do_args :: Int -> LaTeX -> (HsType DocName) -> LaTeX - do_args n leader (HsForAllTy Explicit _ tvs lctxt ltype) - = decltt leader <-> - decltt (hsep (forallSymbol unicode : ppTyVars tvs ++ [dot]) <+> - ppLContextNoArrow lctxt unicode) <+> nl $$ - do_largs n (darrow unicode) ltype - - do_args n leader (HsForAllTy Qualified e a lctxt ltype) - = do_args n leader (HsForAllTy Implicit e a lctxt ltype) - do_args n leader (HsForAllTy Implicit _ _ lctxt ltype) - | not (null (unLoc lctxt)) - = decltt leader <-> decltt (ppLContextNoArrow lctxt unicode) <+> nl $$ - do_largs n (darrow unicode) ltype - -- if we're not showing any 'forall' or class constraints or - -- anything, skip having an empty line for the context. - | otherwise - = do_largs n leader ltype + do_args :: Int -> LaTeX -> HsType DocName -> LaTeX + do_args _n leader (HsForAllTy tvs ltype) + = decltt leader + <-> decltt (hsep (forallSymbol unicode : ppTyVars tvs ++ [dot])) + <+> ppLType unicode ltype + do_args n leader (HsQualTy lctxt ltype) + = decltt leader + <-> ppLContextNoArrow lctxt unicode <+> nl $$ + do_largs n (darrow unicode) ltype do_args n leader (HsFunTy lt r) = decltt leader <-> decltt (ppLFunLhType unicode lt) <-> arg_doc n <+> nl $$ do_largs (n+1) (arrow unicode) r @@ -423,12 +407,12 @@ ppTypeSig nms ty unicode = <+> ppType unicode ty -ppTyVars :: LHsTyVarBndrs DocName -> [LaTeX] -ppTyVars tvs = map ppSymName (tyvarNames tvs) +ppTyVars :: [LHsTyVarBndr DocName] -> [LaTeX] +ppTyVars = map (ppSymName . getName . hsLTyVarName) -tyvarNames :: LHsTyVarBndrs DocName -> [Name] -tyvarNames = map getName . hsLTyVarNames +tyvarNames :: LHsQTyVars DocName -> [Name] +tyvarNames = map (getName . hsLTyVarName) . hsQTvExplicit declWithDoc :: LaTeX -> Maybe LaTeX -> LaTeX @@ -477,12 +461,12 @@ rDoc = maybeDoc . fmap latexStripTrailingWhitespace ppClassHdr :: Bool -> Located [LHsType DocName] -> DocName - -> LHsTyVarBndrs DocName -> [Located ([Located DocName], [Located DocName])] + -> LHsQTyVars DocName -> [Located ([Located DocName], [Located DocName])] -> Bool -> LaTeX ppClassHdr summ lctxt n tvs fds unicode = keyword "class" <+> (if not . null . unLoc $ lctxt then ppLContext lctxt unicode else empty) - <+> ppAppDocNameNames summ n (tyvarNames $ tvs) + <+> ppAppDocNameNames summ n (tyvarNames tvs) <+> ppFds fds unicode @@ -520,8 +504,8 @@ ppClassDecl instances loc doc subdocs methodTable = text "\\haddockpremethods{}\\textbf{Methods}" $$ - vcat [ ppFunSig loc doc names typ unicode - | L _ (TypeSig lnames (L _ typ) _) <- lsigs + vcat [ ppFunSig loc doc names (hsSigWcType typ) unicode + | L _ (TypeSig lnames typ) <- lsigs , let doc = lookupAnySubdoc (head names) subdocs names = map unLoc lnames ] -- FIXME: is taking just the first name ok? Is it possible that @@ -544,14 +528,14 @@ ppDocInstances unicode (i : rest) (is, rest') = spanWith isUndocdInstance rest isUndocdInstance :: DocInstance a -> Maybe (InstHead a) -isUndocdInstance (i,Nothing) = Just i +isUndocdInstance (i,Nothing,_) = Just i isUndocdInstance _ = Nothing -- | Print a possibly commented instance. The instance header is printed inside -- an 'argBox'. The comment is printed to the right of the box in normal comment -- style. ppDocInstance :: Bool -> DocInstance DocName -> LaTeX -ppDocInstance unicode (instHead, doc) = +ppDocInstance unicode (instHead, doc, _) = declWithDoc (ppInstDecl unicode instHead) (fmap docToLaTeX $ fmap _doc doc) @@ -560,12 +544,13 @@ ppInstDecl unicode instHead = keyword "instance" <+> ppInstHead unicode instHead ppInstHead :: Bool -> InstHead DocName -> LaTeX -ppInstHead unicode (n, ks, ts, ClassInst ctx) = ppContextNoLocs ctx unicode <+> ppAppNameTypes n ks ts unicode -ppInstHead unicode (n, ks, ts, TypeInst rhs) = keyword "type" - <+> ppAppNameTypes n ks ts unicode - <+> maybe empty (\t -> equals <+> ppType unicode t) rhs -ppInstHead _unicode (_n, _ks, _ts, DataInst _dd) = - error "data instances not supported by --latex yet" +ppInstHead unicode (InstHead {..}) = case ihdInstType of + ClassInst ctx _ _ _ -> ppContextNoLocs ctx unicode <+> typ + TypeInst rhs -> keyword "type" <+> typ <+> tibody rhs + DataInst _ -> error "data instances not supported by --latex yet" + where + typ = ppAppNameTypes ihdClsName ihdKinds ihdTypes unicode + tibody = maybe empty (\t -> equals <+> ppType unicode t) lookupAnySubdoc :: (Eq name1) => name1 -> [(name1, DocForDecl name2)] -> DocForDecl name2 @@ -591,14 +576,14 @@ ppDataDecl instances subdocs _loc doc dataDecl unicode where cons = dd_cons (tcdDataDefn dataDecl) - resTy = (con_res . unLoc . head) cons + resTy = (unLoc . head) cons body = catMaybes [constrBit, doc >>= documentationToLaTeX] (whereBit, leaders) | null cons = (empty,[]) | otherwise = case resTy of - ResTyGADT _ _ -> (decltt (keyword "where"), repeat empty) + ConDeclGADT{} -> (decltt (keyword "where"), repeat empty) _ -> (empty, (decltt (text "=") : repeat (decltt (text "|")))) constrBit @@ -612,21 +597,85 @@ ppDataDecl instances subdocs _loc doc dataDecl unicode -- ppConstrHdr is for (non-GADT) existentials constructors' syntax -ppConstrHdr :: HsExplicitFlag -> [Name] -> HsContext DocName -> Bool -> LaTeX +ppConstrHdr :: Bool -> [Name] -> HsContext DocName -> Bool -> LaTeX ppConstrHdr forall tvs ctxt unicode = (if null tvs then empty else ppForall) <+> (if null ctxt then empty else ppContextNoArrow ctxt unicode <+> darrow unicode <+> text " ") where ppForall = case forall of - Explicit -> forallSymbol unicode <+> hsep (map ppName tvs) <+> text ". " - Qualified -> empty - Implicit -> empty + True -> forallSymbol unicode <+> hsep (map ppName tvs) <+> text ". " + False -> empty + + +ppSideBySideConstr :: [(DocName, DocForDecl DocName)] -> Bool -> LaTeX + -> LConDecl DocName -> LaTeX +ppSideBySideConstr subdocs unicode leader (L _ con@(ConDeclH98 {})) = + leader <-> + case con_details con of + + PrefixCon args -> + decltt (hsep ((header_ unicode <+> ppOcc) : + map (ppLParendType unicode) args)) + <-> rDoc mbDoc <+> nl + + RecCon (L _ fields) -> + (decltt (header_ unicode <+> ppOcc) + <-> rDoc mbDoc <+> nl) + $$ + doRecordFields fields + + InfixCon arg1 arg2 -> + decltt (hsep [ header_ unicode <+> ppLParendType unicode arg1, + ppOcc, + ppLParendType unicode arg2 ]) + <-> rDoc mbDoc <+> nl + + where + doRecordFields fields = + vcat (map (ppSideBySideField subdocs unicode) (map unLoc fields)) + + + header_ = ppConstrHdr False tyVars context + occ = map (nameOccName . getName . unLoc) $ getConNames con + ppOcc = case occ of + [one] -> ppBinder one + _ -> cat (punctuate comma (map ppBinder occ)) + tyVars = tyvarNames (fromMaybe (HsQTvs PlaceHolder []) (con_qvars con)) + context = unLoc (fromMaybe (noLoc []) (con_cxt con)) + + -- don't use "con_doc con", in case it's reconstructed from a .hi file, + -- or also because we want Haddock to do the doc-parsing, not GHC. + mbDoc = case getConNames con of + [] -> panic "empty con_names" + (cn:_) -> lookup (unLoc cn) subdocs >>= + fmap _doc . combineDocumentation . fst + +ppSideBySideConstr subdocs unicode leader (L _ con@(ConDeclGADT {})) = + leader <-> + doGADTCon (hsib_body $ con_type con) + + where + doGADTCon resTy = decltt (ppOcc <+> dcolon unicode <+> + ppLType unicode resTy + ) <-> rDoc mbDoc + + occ = map (nameOccName . getName . unLoc) $ getConNames con + ppOcc = case occ of + [one] -> ppBinder one + _ -> cat (punctuate comma (map ppBinder occ)) + -- don't use "con_doc con", in case it's reconstructed from a .hi file, + -- or also because we want Haddock to do the doc-parsing, not GHC. + mbDoc = case getConNames con of + [] -> panic "empty con_names" + (cn:_) -> lookup (unLoc cn) subdocs >>= + fmap _doc . combineDocumentation . fst +{- old ppSideBySideConstr :: [(DocName, DocForDecl DocName)] -> Bool -> LaTeX -> LConDecl DocName -> LaTeX -ppSideBySideConstr subdocs unicode leader (L _ con) = +ppSideBySideConstr subdocs unicode leader (L loc con) = leader <-> case con_res con of ResTyH98 -> case con_details con of @@ -660,13 +709,13 @@ ppSideBySideConstr subdocs unicode leader (L _ con) = doRecordFields fields = vcat (map (ppSideBySideField subdocs unicode) (map unLoc fields)) - doGADTCon args resTy = decltt (ppOcc <+> dcolon unicode <+> hsep [ - ppForAll forall ltvs (con_cxt con) unicode, - ppLType unicode (foldr mkFunTy resTy args) ] + doGADTCon args resTy = decltt (ppOcc <+> dcolon unicode <+> + ppLType unicode (mk_forall $ mk_phi $ + foldr mkFunTy resTy args) ) <-> rDoc mbDoc - header_ = ppConstrHdr forall tyVars context + header_ = ppConstrHdr (con_explicit con) tyVars context occ = map (nameOccName . getName . unLoc) $ con_names con ppOcc = case occ of [one] -> ppBinder one @@ -674,7 +723,12 @@ ppSideBySideConstr subdocs unicode leader (L _ con) = ltvs = con_qvars con tyVars = tyvarNames (con_qvars con) context = unLoc (con_cxt con) - forall = con_explicit con + + mk_forall ty | con_explicit con = L loc (HsForAllTy (hsQTvExplicit ltvs) ty) + | otherwise = ty + mk_phi ty | null context = ty + | otherwise = L loc (HsQualTy (con_cxt con) ty) + -- don't use "con_doc con", in case it's reconstructed from a .hi file, -- or also because we want Haddock to do the doc-parsing, not GHC. mbDoc = case con_names con of @@ -682,16 +736,16 @@ ppSideBySideConstr subdocs unicode leader (L _ con) = (cn:_) -> lookup (unLoc cn) subdocs >>= fmap _doc . combineDocumentation . fst mkFunTy a b = noLoc (HsFunTy a b) - +-} ppSideBySideField :: [(DocName, DocForDecl DocName)] -> Bool -> ConDeclField DocName -> LaTeX ppSideBySideField subdocs unicode (ConDeclField names ltype _) = - decltt (cat (punctuate comma (map (ppBinder . nameOccName . getName . unL) names)) + decltt (cat (punctuate comma (map (ppBinder . rdrNameOcc . rdrNameFieldOcc . unLoc) names)) <+> dcolon unicode <+> ppLType unicode ltype) <-> rDoc mbDoc where -- don't use cd_fld_doc for same reason we don't use con_doc above -- Where there is more than one name, they all have the same documentation - mbDoc = lookup (unL $ head names) subdocs >>= fmap _doc . combineDocumentation . fst + mbDoc = lookup (selectorFieldOcc $ unLoc $ head names) subdocs >>= fmap _doc . combineDocumentation . fst -- {- -- ppHsFullConstr :: HsConDecl -> LaTeX @@ -790,9 +844,6 @@ ppLContext, ppLContextNoArrow :: Located (HsContext DocName) -> Bool -> LaTeX ppLContext = ppContext . unLoc ppLContextNoArrow = ppContextNoArrow . unLoc -ppLContextMaybe :: Located (HsContext DocName) -> Bool -> Maybe LaTeX -ppLContextMaybe = ppContextNoLocsMaybe . map unLoc . unLoc - ppContextNoLocsMaybe :: [HsType DocName] -> Bool -> Maybe LaTeX ppContextNoLocsMaybe [] _ = Nothing ppContextNoLocsMaybe cxt unicode = Just $ pp_hs_context cxt unicode @@ -822,9 +873,10 @@ pp_hs_context cxt unicode = parenList (map (ppType unicode) cxt) ------------------------------------------------------------------------------- -ppBang :: HsBang -> LaTeX -ppBang HsNoBang = empty -ppBang _ = char '!' -- Unpacked args is an implementation detail, +ppBang :: HsSrcBang -> LaTeX +ppBang (HsSrcBang _ _ SrcStrict) = char '!' +ppBang (HsSrcBang _ _ SrcLazy) = char '~' +ppBang _ = empty tupleParens :: HsTupleSort -> [LaTeX] -> LaTeX @@ -877,33 +929,22 @@ ppKind unicode ki = ppr_mono_ty pREC_TOP ki unicode -- Drop top-level for-all type variables in user style -- since they are implicit in Haskell -ppForAll :: HsExplicitFlag -> LHsTyVarBndrs DocName - -> Located (HsContext DocName) -> Bool -> LaTeX -ppForAll expl tvs cxt unicode = ppLTyVarBndrs expl tvs unicode <+> ppLContext cxt unicode - -ppLTyVarBndrs :: HsExplicitFlag -> LHsTyVarBndrs DocName - -> Bool -> LaTeX -ppLTyVarBndrs expl tvs unicode - | show_forall = hsep (forallSymbol unicode : ppTyVars tvs) <> dot - | otherwise = empty - where - show_forall = not (null (hsQTvBndrs tvs)) && is_explicit - is_explicit = case expl of {Explicit -> True; Implicit -> False; Qualified -> False} - ppr_mono_lty :: Int -> LHsType DocName -> Bool -> LaTeX ppr_mono_lty ctxt_prec ty unicode = ppr_mono_ty ctxt_prec (unLoc ty) unicode ppr_mono_ty :: Int -> HsType DocName -> Bool -> LaTeX -ppr_mono_ty ctxt_prec (HsForAllTy expl extra tvs ctxt ty) unicode +ppr_mono_ty ctxt_prec (HsForAllTy tvs ty) unicode = maybeParen ctxt_prec pREC_FUN $ - hsep [ppForAll expl tvs ctxt' unicode, ppr_mono_lty pREC_TOP ty unicode] - where ctxt' = case extra of - Just loc -> (++ [L loc HsWildcardTy]) `fmap` ctxt - Nothing -> ctxt + sep [ hsep (forallSymbol unicode : ppTyVars tvs) <> dot + , ppr_mono_lty pREC_TOP ty unicode ] +ppr_mono_ty ctxt_prec (HsQualTy ctxt ty) unicode + = maybeParen ctxt_prec pREC_FUN $ + sep [ ppLContext ctxt unicode + , ppr_mono_lty pREC_TOP ty unicode ] ppr_mono_ty _ (HsBangTy b ty) u = ppBang b <> ppLParendType u ty -ppr_mono_ty _ (HsTyVar name) _ = ppDocName name +ppr_mono_ty _ (HsTyVar (L _ name)) _ = ppDocName name ppr_mono_ty ctxt_prec (HsFunTy ty1 ty2) u = ppr_fun_ty ctxt_prec ty1 ty2 u ppr_mono_ty _ (HsTupleTy con tys) u = tupleParens con (map (ppLType u) tys) ppr_mono_ty _ (HsKindSig ty kind) u = parens (ppr_mono_lty pREC_TOP ty u <+> dcolon u <+> ppLKind u kind) @@ -915,7 +956,6 @@ ppr_mono_ty _ (HsRecTy {}) _ = error "ppr_mono_ty HsRecTy" ppr_mono_ty _ (HsCoreTy {}) _ = error "ppr_mono_ty HsCoreTy" ppr_mono_ty _ (HsExplicitListTy _ tys) u = Pretty.quote $ brackets $ hsep $ punctuate comma $ map (ppLType u) tys ppr_mono_ty _ (HsExplicitTupleTy _ tys) u = Pretty.quote $ parenList $ map (ppLType u) tys -ppr_mono_ty _ (HsWrapTy {}) _ = error "ppr_mono_ty HsWrapTy" ppr_mono_ty ctxt_prec (HsEqTy ty1 ty2) unicode = maybeParen ctxt_prec pREC_OP $ @@ -925,7 +965,7 @@ ppr_mono_ty ctxt_prec (HsAppTy fun_ty arg_ty) unicode = maybeParen ctxt_prec pREC_CON $ hsep [ppr_mono_lty pREC_FUN fun_ty unicode, ppr_mono_lty pREC_CON arg_ty unicode] -ppr_mono_ty ctxt_prec (HsOpTy ty1 (_, op) ty2) unicode +ppr_mono_ty ctxt_prec (HsOpTy ty1 op ty2) unicode = maybeParen ctxt_prec pREC_FUN $ ppr_mono_lty pREC_OP ty1 unicode <+> ppr_op <+> ppr_mono_lty pREC_OP ty2 unicode where @@ -939,12 +979,14 @@ ppr_mono_ty ctxt_prec (HsParTy ty) unicode ppr_mono_ty ctxt_prec (HsDocTy ty _) unicode = ppr_mono_lty ctxt_prec ty unicode -ppr_mono_ty _ HsWildcardTy _ = char '_' +ppr_mono_ty _ (HsWildCardTy (AnonWildCard _)) _ = char '_' -ppr_mono_ty _ (HsNamedWildcardTy name) _ = ppDocName name +ppr_mono_ty _ (HsWildCardTy (NamedWildCard (L _ name))) _ = ppDocName name ppr_mono_ty _ (HsTyLit t) u = ppr_tylit t u +ppr_mono_ty _ (HsAppsTy {}) _ = panic "ppr_mono_ty:HsAppsTy" + ppr_tylit :: HsTyLit -> Bool -> LaTeX ppr_tylit (HsNumTy _ n) _ = integer n diff --git a/haddock-api/src/Haddock/Backends/Xhtml.hs b/haddock-api/src/Haddock/Backends/Xhtml.hs index 6ef1e863..1554a33c 100644 --- a/haddock-api/src/Haddock/Backends/Xhtml.hs +++ b/haddock-api/src/Haddock/Backends/Xhtml.hs @@ -36,7 +36,6 @@ import Haddock.GhcUtils import Control.Monad ( when, unless ) import Data.Char ( toUpper ) -import Data.Functor ( (<$>) ) import Data.List ( sortBy, groupBy, intercalate, isPrefixOf ) import Data.Maybe import System.FilePath hiding ( (</>) ) @@ -305,7 +304,7 @@ mkNode qual ss p (Node s leaf pkg srcPkg short ts) = htmlModule = thespan ! modAttrs << (cBtn +++ if leaf - then ppModule (mkModule (stringToPackageKey (fromMaybe "" pkg)) + then ppModule (mkModule (stringToUnitId (fromMaybe "" pkg)) (mkModuleName mdl)) else toHtml s ) @@ -547,7 +546,7 @@ ifaceToHtml maybe_source_url maybe_wiki_url iface unicode qual synopsis | no_doc_at_all = noHtml | otherwise - = divSynposis $ + = divSynopsis $ paragraph ! collapseControl "syn" False "caption" << "Synopsis" +++ shortDeclList ( mapMaybe (processExport True linksInfo unicode qual) exports @@ -584,7 +583,7 @@ processForMiniSynopsis mdl unicode qual ExportDecl { expItemDecl = L _loc decl0 (DataDecl{}) -> [keyword "data" <+> b] (SynDecl{}) -> [keyword "type" <+> b] (ClassDecl {}) -> [keyword "class" <+> b] - SigD (TypeSig lnames (L _ _) _) -> + SigD (TypeSig lnames _) -> map (ppNameMini Prefix mdl . nameOccName . getName . unLoc) lnames _ -> [] processForMiniSynopsis _ _ qual (ExportGroup lvl _id txt) = diff --git a/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs b/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs index 88aa966c..49149b8c 100644 --- a/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs +++ b/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs @@ -1,4 +1,6 @@ {-# LANGUAGE TransformListComp #-} +{-# LANGUAGE RecordWildCards #-} +{-# LANGUAGE Rank2Types #-} ----------------------------------------------------------------------------- -- | -- Module : Haddock.Backends.Html.Decl @@ -18,7 +20,6 @@ module Haddock.Backends.Xhtml.Decl ( tyvarNames ) where - import Haddock.Backends.Xhtml.DocMarkup import Haddock.Backends.Xhtml.Layout import Haddock.Backends.Xhtml.Names @@ -28,7 +29,6 @@ import Haddock.GhcUtils import Haddock.Types import Haddock.Doc (combineDocumentation) -import Control.Applicative import Data.List ( intersperse, sort ) import qualified Data.Map as Map import Data.Maybe @@ -38,18 +38,20 @@ import GHC import GHC.Exts import Name import BooleanFormula +import RdrName ( rdrNameOcc ) ppDecl :: Bool -> LinksInfo -> LHsDecl DocName -> DocForDecl DocName -> [DocInstance DocName] -> [(DocName, Fixity)] -> [(DocName, DocForDecl DocName)] -> Splice -> Unicode -> Qualification -> Html ppDecl summ links (L loc decl) (mbDoc, fnArgsDoc) instances fixities subdocs splice unicode qual = case decl of - TyClD (FamDecl d) -> ppTyFam summ False links instances fixities loc mbDoc d splice unicode qual - TyClD d@(DataDecl {}) -> ppDataDecl summ links instances fixities subdocs loc mbDoc d splice unicode qual - TyClD d@(SynDecl {}) -> ppTySyn summ links fixities loc (mbDoc, fnArgsDoc) d splice unicode qual - TyClD d@(ClassDecl {}) -> ppClassDecl summ links instances fixities loc mbDoc subdocs d splice unicode qual - SigD (TypeSig lnames lty _) -> ppLFunSig summ links loc (mbDoc, fnArgsDoc) lnames lty fixities splice unicode qual - SigD (PatSynSig lname qtvs prov req ty) -> - ppLPatSig summ links loc (mbDoc, fnArgsDoc) lname qtvs prov req ty fixities splice unicode qual + TyClD (FamDecl d) -> ppTyFam summ False links instances fixities loc mbDoc d splice unicode qual + TyClD d@(DataDecl {}) -> ppDataDecl summ links instances fixities subdocs loc mbDoc d splice unicode qual + TyClD d@(SynDecl {}) -> ppTySyn summ links fixities loc (mbDoc, fnArgsDoc) d splice unicode qual + TyClD d@(ClassDecl {}) -> ppClassDecl summ links instances fixities loc mbDoc subdocs d splice unicode qual + SigD (TypeSig lnames lty) -> ppLFunSig summ links loc (mbDoc, fnArgsDoc) lnames + (hsSigWcType lty) fixities splice unicode qual + SigD (PatSynSig lname ty) -> ppLPatSig summ links loc (mbDoc, fnArgsDoc) lname + ty fixities splice unicode qual ForD d -> ppFor summ links loc (mbDoc, fnArgsDoc) d fixities splice unicode qual InstD _ -> noHtml _ -> error "declaration not supported by ppDecl" @@ -59,26 +61,23 @@ ppLFunSig :: Bool -> LinksInfo -> SrcSpan -> DocForDecl DocName -> [Located DocName] -> LHsType DocName -> [(DocName, Fixity)] -> Splice -> Unicode -> Qualification -> Html ppLFunSig summary links loc doc lnames lty fixities splice unicode qual = - ppFunSig summary links loc doc (map unLoc lnames) (unLoc lty) fixities + ppFunSig summary links loc doc (map unLoc lnames) lty fixities splice unicode qual ppFunSig :: Bool -> LinksInfo -> SrcSpan -> DocForDecl DocName -> - [DocName] -> HsType DocName -> [(DocName, Fixity)] -> + [DocName] -> LHsType DocName -> [(DocName, Fixity)] -> Splice -> Unicode -> Qualification -> Html ppFunSig summary links loc doc docnames typ fixities splice unicode qual = - ppSigLike summary links loc mempty doc docnames fixities (typ, pp_typ) + ppSigLike summary links loc mempty doc docnames fixities (unLoc typ, pp_typ) splice unicode qual where - pp_typ = ppType unicode qual typ + pp_typ = ppLType unicode qual typ ppLPatSig :: Bool -> LinksInfo -> SrcSpan -> DocForDecl DocName -> - Located DocName -> - (HsExplicitFlag, LHsTyVarBndrs DocName) -> - LHsContext DocName -> LHsContext DocName -> - LHsType DocName -> + Located DocName -> LHsSigType DocName -> [(DocName, Fixity)] -> Splice -> Unicode -> Qualification -> Html -ppLPatSig summary links loc (doc, _argDocs) (L _ name) (expl, qtvs) lprov lreq typ fixities splice unicode qual +ppLPatSig summary links loc (doc, _argDocs) (L _ name) typ fixities splice unicode qual | summary = pref1 | otherwise = topDeclElem links loc splice [name] (pref1 <+> ppFixities fixities qual) +++ docSection Nothing qual doc @@ -86,18 +85,9 @@ ppLPatSig summary links loc (doc, _argDocs) (L _ name) (expl, qtvs) lprov lreq t pref1 = hsep [ keyword "pattern" , ppBinder summary occname , dcolon unicode - , ppLTyVarBndrs expl qtvs unicode qual - , cxt - , ppLType unicode qual typ + , ppLType unicode qual (hsSigType typ) ] - cxt = case (ppLContextMaybe lprov unicode qual, ppLContextMaybe lreq unicode qual) of - (Nothing, Nothing) -> noHtml - (Nothing, Just req) -> parens noHtml <+> darr <+> req <+> darr - (Just prov, Nothing) -> prov <+> darr - (Just prov, Just req) -> prov <+> darr <+> req <+> darr - - darr = darrow unicode occname = nameOccName . getName $ name ppSigLike :: Bool -> LinksInfo -> SrcSpan -> Html -> DocForDecl DocName -> @@ -131,22 +121,29 @@ ppTypeOrFunSig summary links loc docnames typ (doc, argDocs) (pref1, pref2, sep) argDoc n = Map.lookup n argDocs do_largs n leader (L _ t) = do_args n leader t + do_args :: Int -> Html -> HsType DocName -> [SubDecl] - do_args n leader (HsForAllTy _ _ tvs lctxt ltype) - = case unLoc lctxt of - [] -> do_largs n leader' ltype - _ -> (leader' <+> ppLContextNoArrow lctxt unicode qual, Nothing, []) - : do_largs n (darrow unicode) ltype - where leader' = leader <+> ppForAll tvs unicode qual + do_args n leader (HsForAllTy tvs ltype) + = do_largs n leader' ltype + where + leader' = leader <+> ppForAll tvs unicode qual + + do_args n leader (HsQualTy lctxt ltype) + | null (unLoc lctxt) + = do_largs n leader ltype + | otherwise + = (leader <+> ppLContextNoArrow lctxt unicode qual, Nothing, []) + : do_largs n (darrow unicode) ltype + do_args n leader (HsFunTy lt r) = (leader <+> ppLFunLhType unicode qual lt, argDoc n, []) : do_largs (n+1) (arrow unicode) r do_args n leader t = [(leader <+> ppType unicode qual t, argDoc n, [])] -ppForAll :: LHsTyVarBndrs DocName -> Unicode -> Qualification -> Html +ppForAll :: [LHsTyVarBndr DocName] -> Unicode -> Qualification -> Html ppForAll tvs unicode qual = - case [ppKTv n k | L _ (KindedTyVar (L _ n) k) <- hsQTvBndrs tvs] of + case [ppKTv n k | L _ (KindedTyVar (L _ n) k) <- tvs] of [] -> noHtml ts -> forallSymbol unicode <+> hsep ts +++ dot where ppKTv n k = parens $ @@ -174,20 +171,19 @@ ppFixities fs qual = foldr1 (+++) (map ppFix uniq_fs) +++ rightEdge rightEdge = thespan ! [theclass "rightedge"] << noHtml -ppTyVars :: LHsTyVarBndrs DocName -> [Html] -ppTyVars tvs = map ppTyName (tyvarNames tvs) - +ppTyVars :: [LHsTyVarBndr DocName] -> [Html] +ppTyVars tvs = map (ppTyName . getName . hsLTyVarName) tvs -tyvarNames :: LHsTyVarBndrs DocName -> [Name] -tyvarNames = map getName . hsLTyVarNames +tyvarNames :: LHsQTyVars DocName -> [Name] +tyvarNames = map (getName . hsLTyVarName) . hsQTvExplicit ppFor :: Bool -> LinksInfo -> SrcSpan -> DocForDecl DocName -> ForeignDecl DocName -> [(DocName, Fixity)] -> Splice -> Unicode -> Qualification -> Html -ppFor summary links loc doc (ForeignImport (L _ name) (L _ typ) _ _) fixities +ppFor summary links loc doc (ForeignImport (L _ name) typ _ _) fixities splice unicode qual - = ppFunSig summary links loc doc [name] typ fixities splice unicode qual + = ppFunSig summary links loc doc [name] (hsSigType typ) fixities splice unicode qual ppFor _ _ _ _ _ _ _ _ _ = error "ppFor" @@ -202,7 +198,8 @@ ppTySyn summary links fixities loc doc (SynDecl { tcdLName = L _ name, tcdTyVars (full <+> fixs, hdr <+> fixs, spaceHtml +++ equals) splice unicode qual where - hdr = hsep ([keyword "type", ppBinder summary occ] ++ ppTyVars ltyvars) + hdr = hsep ([keyword "type", ppBinder summary occ] + ++ ppTyVars (hsQTvExplicit ltyvars)) full = hdr <+> equals <+> ppLType unicode qual ltype occ = nameOccName . getName $ name fixs @@ -222,15 +219,37 @@ ppTyName :: Name -> Html ppTyName = ppName Prefix +ppSimpleSig :: LinksInfo -> Splice -> Unicode -> Qualification -> SrcSpan + -> [DocName] -> HsType DocName + -> Html +ppSimpleSig links splice unicode qual loc names typ = + topDeclElem' names $ ppTypeSig True occNames ppTyp unicode + where + topDeclElem' = topDeclElem links loc splice + ppTyp = ppType unicode qual typ + occNames = map getOccName names + + -------------------------------------------------------------------------------- -- * Type families -------------------------------------------------------------------------------- +ppFamilyInfo :: Bool -> FamilyInfo DocName -> Html +ppFamilyInfo assoc OpenTypeFamily + | assoc = keyword "type" + | otherwise = keyword "type family" +ppFamilyInfo assoc DataFamily + | assoc = keyword "data" + | otherwise = keyword "data family" +ppFamilyInfo _ (ClosedTypeFamily _) = keyword "type family" + + ppTyFamHeader :: Bool -> Bool -> FamilyDecl DocName -> Unicode -> Qualification -> Html ppTyFamHeader summary associated d@(FamilyDecl { fdInfo = info - , fdKindSig = mkind }) + , fdResultSig = L _ result + , fdInjectivityAnn = injectivity }) unicode qual = (case info of OpenTypeFamily @@ -244,12 +263,32 @@ ppTyFamHeader summary associated d@(FamilyDecl { fdInfo = info ) <+> ppFamDeclBinderWithVars summary d <+> + ppResultSig result unicode qual <+> - (case mkind of - Just kind -> dcolon unicode <+> ppLKind unicode qual kind - Nothing -> noHtml + (case injectivity of + Nothing -> noHtml + Just (L _ injectivityAnn) -> ppInjectivityAnn unicode qual injectivityAnn ) +ppResultSig :: FamilyResultSig DocName -> Unicode -> Qualification -> Html +ppResultSig result unicode qual = case result of + NoSig -> noHtml + KindSig kind -> dcolon unicode <+> ppLKind unicode qual kind + TyVarSig (L _ bndr) -> equals <+> ppHsTyVarBndr unicode qual bndr + +ppPseudoFamilyHeader :: Unicode -> Qualification -> PseudoFamilyDecl DocName + -> Html +ppPseudoFamilyHeader unicode qual (PseudoFamilyDecl { .. }) = + ppFamilyInfo True pfdInfo <+> + ppAppNameTypes (unLoc pfdLName) [] (map unLoc pfdTyVars) unicode qual <+> + ppResultSig (unLoc pfdKindSig) unicode qual + +ppInjectivityAnn :: Bool -> Qualification -> InjectivityAnn DocName -> Html +ppInjectivityAnn unicode qual (InjectivityAnn lhs rhs) = + char '|' <+> ppLDocName qual Raw lhs <+> arrow unicode <+> + hsep (map (ppLDocName qual Raw) rhs) + + ppTyFam :: Bool -> Bool -> LinksInfo -> [DocInstance DocName] -> [(DocName, Fixity)] -> SrcSpan -> Documentation DocName -> FamilyDecl DocName -> Splice -> Unicode -> Qualification -> Html @@ -270,15 +309,27 @@ ppTyFam summary associated links instances fixities loc doc decl splice unicode = subEquations qual $ map (ppTyFamEqn . unLoc) $ fromMaybe [] mb_eqns | otherwise - = ppInstances instances docname unicode qual + = ppInstances links (OriginFamily docname) instances splice unicode qual -- Individual equation of a closed type family ppTyFamEqn TyFamEqn { tfe_tycon = n, tfe_rhs = rhs - , tfe_pats = HsWB { hswb_cts = ts }} + , tfe_pats = HsIB { hsib_body = ts }} = ( ppAppNameTypes (unLoc n) [] (map unLoc ts) unicode qual <+> equals <+> ppType unicode qual (unLoc rhs) , Nothing, [] ) + + +ppPseudoFamilyDecl :: LinksInfo -> Splice -> Unicode -> Qualification + -> PseudoFamilyDecl DocName + -> Html +ppPseudoFamilyDecl links splice unicode qual + decl@(PseudoFamilyDecl { pfdLName = L loc name, .. }) = + wrapper $ ppPseudoFamilyHeader unicode qual decl + where + wrapper = topDeclElem links loc splice [name] + + -------------------------------------------------------------------------------- -- * Associated Types -------------------------------------------------------------------------------- @@ -347,10 +398,6 @@ ppLContext, ppLContextNoArrow :: Located (HsContext DocName) -> Unicode ppLContext = ppContext . unLoc ppLContextNoArrow = ppContextNoArrow . unLoc - -ppLContextMaybe :: Located (HsContext DocName) -> Unicode -> Qualification -> Maybe Html -ppLContextMaybe = ppContextNoLocsMaybe . map unLoc . unLoc - ppContextNoArrow :: HsContext DocName -> Unicode -> Qualification -> Html ppContextNoArrow cxt unicode qual = fromMaybe noHtml $ ppContextNoLocsMaybe (map unLoc cxt) unicode qual @@ -381,7 +428,7 @@ ppHsContext cxt unicode qual = parenList (map (ppType unicode qual) cxt) ppClassHdr :: Bool -> Located [LHsType DocName] -> DocName - -> LHsTyVarBndrs DocName -> [Located ([Located DocName], [Located DocName])] + -> LHsQTyVars DocName -> [Located ([Located DocName], [Located DocName])] -> Unicode -> Qualification -> Html ppClassHdr summ lctxt n tvs fds unicode qual = keyword "class" @@ -404,7 +451,7 @@ ppShortClassDecl :: Bool -> LinksInfo -> TyClDecl DocName -> SrcSpan ppShortClassDecl summary links (ClassDecl { tcdCtxt = lctxt, tcdLName = lname, tcdTyVars = tvs , tcdFDs = fds, tcdSigs = sigs, tcdATs = ats }) loc subdocs splice unicode qual = - if not (any isVanillaLSig sigs) && null ats + if not (any isUserLSig sigs) && null ats then (if summary then id else topDeclElem links loc splice [nm]) hdr else (if summary then id else topDeclElem links loc splice [nm]) (hdr <+> keyword "where") +++ shortSubDecls False @@ -414,8 +461,9 @@ ppShortClassDecl summary links (ClassDecl { tcdCtxt = lctxt, tcdLName = lname, t -- ToDo: add associated type defaults - [ ppFunSig summary links loc doc names typ [] splice unicode qual - | L _ (TypeSig lnames (L _ typ) _) <- sigs + [ ppFunSig summary links loc doc names (hsSigWcType typ) + [] splice unicode qual + | L _ (TypeSig lnames typ) <- sigs , let doc = lookupAnySubdoc (head names) subdocs names = map unLoc lnames ] -- FIXME: is taking just the first name ok? Is it possible that @@ -441,8 +489,10 @@ ppClassDecl summary links instances fixities loc d subdocs | otherwise = classheader +++ docSection Nothing qual d +++ minimalBit +++ atBit +++ methodBit +++ instancesBit where + sigs = map unLoc lsigs + classheader - | any isVanillaLSig lsigs = topDeclElem links loc splice [nm] (hdr unicode qual <+> keyword "where" <+> fixs) + | any isUserLSig lsigs = topDeclElem links loc splice [nm] (hdr unicode qual <+> keyword "where" <+> fixs) | otherwise = topDeclElem links loc splice [nm] (hdr unicode qual <+> fixs) -- Only the fixity relevant to the class header @@ -459,8 +509,9 @@ ppClassDecl summary links instances fixities loc d subdocs doc = lookupAnySubdoc (unL $ fdLName $ unL at) subdocs subfixs = [ f | f@(n',_) <- fixities, n == n' ] ] - methodBit = subMethods [ ppFunSig summary links loc doc names typ subfixs splice unicode qual - | L _ (TypeSig lnames (L _ typ) _) <- lsigs + methodBit = subMethods [ ppFunSig summary links loc doc names (hsSigType typ) + subfixs splice unicode qual + | L _ (ClassOpSig _ lnames typ) <- lsigs , let doc = lookupAnySubdoc (head names) subdocs subfixs = [ f | n <- names , f@(n',_) <- fixities @@ -470,15 +521,15 @@ ppClassDecl summary links instances fixities loc d subdocs -- there are different subdocs for different names in a single -- type signature? - minimalBit = case [ s | L _ (MinimalSig _ s) <- lsigs ] of + minimalBit = case [ s | MinimalSig _ (L _ s) <- sigs ] of -- Miminal complete definition = every shown method - And xs : _ | sort [getName n | Var (L _ n) <- xs] == - sort [getName n | L _ (TypeSig ns _ _) <- lsigs, L _ n <- ns] + And xs : _ | sort [getName n | L _ (Var (L _ n)) <- xs] == + sort [getName n | TypeSig ns _ <- sigs, L _ n <- ns] -> noHtml -- Minimal complete definition = the only shown method Var (L _ n) : _ | [getName n] == - [getName n' | L _ (TypeSig ns _ _) <- lsigs, L _ n' <- ns] + [getName n' | L _ (TypeSig ns _) <- lsigs, L _ n' <- ns] -> noHtml -- Minimal complete definition = nothing @@ -488,35 +539,98 @@ ppClassDecl summary links instances fixities loc d subdocs _ -> noHtml ppMinimal _ (Var (L _ n)) = ppDocName qual Prefix True n - ppMinimal _ (And fs) = foldr1 (\a b -> a+++", "+++b) $ map (ppMinimal True) fs - ppMinimal p (Or fs) = wrap $ foldr1 (\a b -> a+++" | "+++b) $ map (ppMinimal False) fs + ppMinimal _ (And fs) = foldr1 (\a b -> a+++", "+++b) $ map (ppMinimal True . unLoc) fs + ppMinimal p (Or fs) = wrap $ foldr1 (\a b -> a+++" | "+++b) $ map (ppMinimal False . unLoc) fs where wrap | p = parens | otherwise = id + ppMinimal p (Parens x) = ppMinimal p (unLoc x) - instancesBit = ppInstances instances nm unicode qual + instancesBit = ppInstances links (OriginClass nm) instances + splice unicode qual ppClassDecl _ _ _ _ _ _ _ _ _ _ _ = error "declaration type not supported by ppShortClassDecl" -ppInstances :: [DocInstance DocName] -> DocName -> Unicode -> Qualification -> Html -ppInstances instances baseName unicode qual - = subInstances qual instName (map instDecl instances) +ppInstances :: LinksInfo + -> InstOrigin DocName -> [DocInstance DocName] + -> Splice -> Unicode -> Qualification + -> Html +ppInstances links origin instances splice unicode qual + = subInstances qual instName links True (zipWith instDecl [1..] instances) + -- force Splice = True to use line URLs where - instName = getOccString $ getName baseName - instDecl :: DocInstance DocName -> SubDecl - instDecl (inst, maybeDoc) = (instHead inst, maybeDoc, []) - instHead (n, ks, ts, ClassInst cs) = ppContextNoLocs cs unicode qual - <+> ppAppNameTypes n ks ts unicode qual - instHead (n, ks, ts, TypeInst rhs) = keyword "type" - <+> ppAppNameTypes n ks ts unicode qual - <+> maybe noHtml (\t -> equals <+> ppType unicode qual t) rhs - instHead (n, ks, ts, DataInst dd) = keyword "data" - <+> ppAppNameTypes n ks ts unicode qual - <+> ppShortDataDecl False True dd unicode qual + instName = getOccString origin + instDecl :: Int -> DocInstance DocName -> (SubDecl,Located DocName) + instDecl no (inst, mdoc, loc) = + ((ppInstHead links splice unicode qual mdoc origin no inst), loc) + + +ppInstHead :: LinksInfo -> Splice -> Unicode -> Qualification + -> Maybe (MDoc DocName) + -> InstOrigin DocName -> Int -> InstHead DocName + -> SubDecl +ppInstHead links splice unicode qual mdoc origin no ihd@(InstHead {..}) = + case ihdInstType of + ClassInst { .. } -> + ( subInstHead iid $ ppContextNoLocs clsiCtx unicode qual <+> typ + , mdoc + , [subInstDetails iid ats sigs] + ) + where + iid = instanceId origin no ihd + sigs = ppInstanceSigs links splice unicode qual clsiSigs + ats = ppInstanceAssocTys links splice unicode qual clsiAssocTys + TypeInst rhs -> + (ptype, mdoc, []) + where + ptype = keyword "type" <+> typ <+> prhs + prhs = maybe noHtml (\t -> equals <+> ppType unicode qual t) rhs + DataInst dd -> + (pdata, mdoc, []) + where + pdata = keyword "data" <+> typ <+> pdecl + pdecl = ppShortDataDecl False True dd unicode qual + where + typ = ppAppNameTypes ihdClsName ihdKinds ihdTypes unicode qual + + +ppInstanceAssocTys :: LinksInfo -> Splice -> Unicode -> Qualification + -> [PseudoFamilyDecl DocName] + -> [Html] +ppInstanceAssocTys links splice unicode qual = + map ppFamilyDecl' + where + ppFamilyDecl' = ppPseudoFamilyDecl links splice unicode qual + + +ppInstanceSigs :: LinksInfo -> Splice -> Unicode -> Qualification + -> [Sig DocName] + -> [Html] +ppInstanceSigs links splice unicode qual sigs = do + TypeSig lnames typ <- sigs + let names = map unLoc lnames + L loc rtyp = get_type typ + return $ ppSimpleSig links splice unicode qual loc names rtyp + where + get_type = hswc_body . hsib_body + lookupAnySubdoc :: Eq id1 => id1 -> [(id1, DocForDecl id2)] -> DocForDecl id2 lookupAnySubdoc n = fromMaybe noDocForDecl . lookup n +instanceId :: InstOrigin DocName -> Int -> InstHead DocName -> String +instanceId origin no ihd = concat + [ qual origin + , ":" ++ getOccString origin + , ":" ++ (occNameString . getOccName . ihdClsName) ihd + , ":" ++ show no + ] + where + qual (OriginClass _) = "ic" + qual (OriginData _) = "id" + qual (OriginFamily _) = "if" + + ------------------------------------------------------------------------------- -- * Data & newtype declarations ------------------------------------------------------------------------------- @@ -528,11 +642,11 @@ ppShortDataDecl summary dataInst dataDecl unicode qual | [] <- cons = dataHeader - | [lcon] <- cons, ResTyH98 <- resTy, + | [lcon] <- cons, isH98, (cHead,cBody,cFoot) <- ppShortConstrParts summary dataInst (unLoc lcon) unicode qual = (dataHeader <+> equals <+> cHead) +++ cBody +++ cFoot - | ResTyH98 <- resTy = dataHeader + | isH98 = dataHeader +++ shortSubDecls dataInst (zipWith doConstr ('=':repeat '|') cons) | otherwise = (dataHeader <+> keyword "where") @@ -546,7 +660,9 @@ ppShortDataDecl summary dataInst dataDecl unicode qual doGADTConstr con = ppShortConstr summary (unLoc con) unicode qual cons = dd_cons (tcdDataDefn dataDecl) - resTy = (con_res . unLoc . head) cons + isH98 = case unLoc (head cons) of + ConDeclH98 {} -> True + ConDeclGADT{} -> False ppDataDecl :: Bool -> LinksInfo -> [DocInstance DocName] -> [(DocName, Fixity)] -> @@ -562,7 +678,9 @@ ppDataDecl summary links instances fixities subdocs loc doc dataDecl where docname = tcdName dataDecl cons = dd_cons (tcdDataDefn dataDecl) - resTy = (con_res . unLoc . head) cons + isH98 = case unLoc (head cons) of + ConDeclH98 {} -> True + ConDeclGADT{} -> False header_ = topDeclElem links loc splice [docname] $ ppDataHeader summary dataDecl unicode qual <+> whereBit <+> fix @@ -571,18 +689,17 @@ ppDataDecl summary links instances fixities subdocs loc doc dataDecl whereBit | null cons = noHtml - | otherwise = case resTy of - ResTyGADT _ _ -> keyword "where" - _ -> noHtml + | otherwise = if isH98 then noHtml else keyword "where" constrBit = subConstructors qual [ ppSideBySideConstr subdocs subfixs unicode qual c | c <- cons , let subfixs = filter (\(n,_) -> any (\cn -> cn == n) - (map unLoc (con_names (unLoc c)))) fixities + (map unLoc (getConNames (unLoc c)))) fixities ] - instancesBit = ppInstances instances docname unicode qual + instancesBit = ppInstances links (OriginData docname) instances + splice unicode qual @@ -595,8 +712,8 @@ ppShortConstr summary con unicode qual = cHead <+> cBody <+> cFoot -- returns three pieces: header, body, footer so that header & footer can be -- incorporated into the declaration ppShortConstrParts :: Bool -> Bool -> ConDecl DocName -> Unicode -> Qualification -> (Html, Html, Html) -ppShortConstrParts summary dataInst con unicode qual = case con_res con of - ResTyH98 -> case con_details con of +ppShortConstrParts summary dataInst con unicode qual = case con of + ConDeclH98{} -> case con_details con of PrefixCon args -> (header_ unicode qual +++ hsep (ppOcc : map (ppLParendType unicode qual) args), noHtml, noHtml) @@ -609,28 +726,15 @@ ppShortConstrParts summary dataInst con unicode qual = case con_res con of ppOccInfix, ppLParendType unicode qual arg2], noHtml, noHtml) - ResTyGADT _ resTy -> case con_details con of - -- prefix & infix could use hsConDeclArgTys if it seemed to - -- simplify the code. - PrefixCon args -> (doGADTCon args resTy, noHtml, noHtml) - -- display GADT records with the new syntax, - -- Constr :: (Context) => { field :: a, field2 :: b } -> Ty (a, b) - -- (except each field gets its own line in docs, to match - -- non-GADT records) - RecCon (L _ fields) -> (ppOcc <+> dcolon unicode <+> - ppForAllCon forall_ ltvs lcontext unicode qual <+> char '{', - doRecordFields fields, - char '}' <+> arrow unicode <+> ppLType unicode qual resTy) - InfixCon arg1 arg2 -> (doGADTCon [arg1, arg2] resTy, noHtml, noHtml) + ConDeclGADT {} -> (ppOcc <+> dcolon unicode <+> ppLType unicode qual resTy,noHtml,noHtml) where + resTy = hsib_body (con_type con) + doRecordFields fields = shortSubDecls dataInst (map (ppShortField summary unicode qual) (map unLoc fields)) - doGADTCon args resTy = ppOcc <+> dcolon unicode <+> hsep [ - ppForAllCon forall_ ltvs lcontext unicode qual, - ppLType unicode qual (foldr mkFunTy resTy args) ] header_ = ppConstrHdr forall_ tyVars context - occ = map (nameOccName . getName . unLoc) $ con_names con + occ = map (nameOccName . getName . unLoc) $ getConNames con ppOcc = case occ of [one] -> ppBinder summary one @@ -640,35 +744,34 @@ ppShortConstrParts summary dataInst con unicode qual = case con_res con of [one] -> ppBinderInfix summary one _ -> hsep (punctuate comma (map (ppBinderInfix summary) occ)) - ltvs = con_qvars con + ltvs = fromMaybe (HsQTvs PlaceHolder []) (con_qvars con) tyVars = tyvarNames ltvs - lcontext = con_cxt con - context = unLoc (con_cxt con) - forall_ = con_explicit con - mkFunTy a b = noLoc (HsFunTy a b) + lcontext = fromMaybe (noLoc []) (con_cxt con) + context = unLoc lcontext + forall_ = False -- ppConstrHdr is for (non-GADT) existentials constructors' syntax -ppConstrHdr :: HsExplicitFlag -> [Name] -> HsContext DocName -> Unicode +ppConstrHdr :: Bool -> [Name] -> HsContext DocName -> Unicode -> Qualification -> Html ppConstrHdr forall_ tvs ctxt unicode qual = (if null tvs then noHtml else ppForall) +++ - (if null ctxt then noHtml else ppContextNoArrow ctxt unicode qual - <+> darrow unicode +++ toHtml " ") + (if null ctxt then noHtml + else ppContextNoArrow ctxt unicode qual + <+> darrow unicode +++ toHtml " ") where - ppForall = case forall_ of - Explicit -> forallSymbol unicode <+> hsep (map (ppName Prefix) tvs) <+> toHtml ". " - Qualified -> noHtml - Implicit -> noHtml - + ppForall | forall_ = forallSymbol unicode <+> hsep (map (ppName Prefix) tvs) + <+> toHtml ". " + | otherwise = noHtml ppSideBySideConstr :: [(DocName, DocForDecl DocName)] -> [(DocName, Fixity)] -> Unicode -> Qualification -> LConDecl DocName -> SubDecl -ppSideBySideConstr subdocs fixities unicode qual (L _ con) = (decl, mbDoc, fieldPart) +ppSideBySideConstr subdocs fixities unicode qual (L _ con) + = (decl, mbDoc, fieldPart) where - decl = case con_res con of - ResTyH98 -> case con_details con of + decl = case con of + ConDeclH98{} -> case con_details con of PrefixCon args -> hsep ((header_ +++ ppOcc) : map (ppLParendType unicode qual) args) @@ -682,28 +785,26 @@ ppSideBySideConstr subdocs fixities unicode qual (L _ con) = (decl, mbDoc, field ppLParendType unicode qual arg2] <+> fixity - ResTyGADT _ resTy -> case con_details con of - -- prefix & infix could also use hsConDeclArgTys if it seemed to - -- simplify the code. - PrefixCon args -> doGADTCon args resTy - cd@(RecCon _) -> doGADTCon (hsConDeclArgTys cd) resTy - InfixCon arg1 arg2 -> doGADTCon [arg1, arg2] resTy + ConDeclGADT{} -> doGADTCon resTy + + resTy = hsib_body (con_type con) - fieldPart = case con_details con of + fieldPart = case getConDetails con of RecCon (L _ fields) -> [doRecordFields fields] _ -> [] doRecordFields fields = subFields qual (map (ppSideBySideField subdocs unicode qual) (map unLoc fields)) - doGADTCon :: [LHsType DocName] -> Located (HsType DocName) -> Html - doGADTCon args resTy = ppOcc <+> dcolon unicode - <+> hsep [ppForAllCon forall_ ltvs (con_cxt con) unicode qual, - ppLType unicode qual (foldr mkFunTy resTy args) ] + + doGADTCon :: Located (HsType DocName) -> Html + doGADTCon ty = ppOcc <+> dcolon unicode + -- ++AZ++ make this prepend "{..}" when it is a record style GADT + <+> ppLType unicode qual ty <+> fixity fixity = ppFixities fixities qual header_ = ppConstrHdr forall_ tyVars context unicode qual - occ = map (nameOccName . getName . unLoc) $ con_names con + occ = map (nameOccName . getName . unLoc) $ getConNames con ppOcc = case occ of [one] -> ppBinder False one @@ -713,32 +814,30 @@ ppSideBySideConstr subdocs fixities unicode qual (L _ con) = (decl, mbDoc, field [one] -> ppBinderInfix False one _ -> hsep (punctuate comma (map (ppBinderInfix False) occ)) - ltvs = con_qvars con - tyVars = tyvarNames (con_qvars con) - context = unLoc (con_cxt con) - forall_ = con_explicit con + tyVars = tyvarNames (fromMaybe (HsQTvs PlaceHolder []) (con_qvars con)) + context = unLoc (fromMaybe (noLoc []) (con_cxt con)) + forall_ = False -- don't use "con_doc con", in case it's reconstructed from a .hi file, -- or also because we want Haddock to do the doc-parsing, not GHC. - mbDoc = lookup (unLoc $ head $ con_names con) subdocs >>= + mbDoc = lookup (unLoc $ head $ getConNames con) subdocs >>= combineDocumentation . fst - mkFunTy a b = noLoc (HsFunTy a b) ppSideBySideField :: [(DocName, DocForDecl DocName)] -> Unicode -> Qualification -> ConDeclField DocName -> SubDecl ppSideBySideField subdocs unicode qual (ConDeclField names ltype _) = - (hsep (punctuate comma (map ((ppBinder False) . nameOccName . getName . unL) names)) <+> dcolon unicode <+> ppLType unicode qual ltype, + (hsep (punctuate comma (map ((ppBinder False) . rdrNameOcc . rdrNameFieldOcc . unLoc) names)) <+> dcolon unicode <+> ppLType unicode qual ltype, mbDoc, []) where -- don't use cd_fld_doc for same reason we don't use con_doc above -- Where there is more than one name, they all have the same documentation - mbDoc = lookup (unL $ head names) subdocs >>= combineDocumentation . fst + mbDoc = lookup (selectorFieldOcc $ unLoc $ head names) subdocs >>= combineDocumentation . fst ppShortField :: Bool -> Unicode -> Qualification -> ConDeclField DocName -> Html ppShortField summary unicode qual (ConDeclField names ltype _) - = hsep (punctuate comma (map ((ppBinder summary) . nameOccName . getName . unL) names)) + = hsep (punctuate comma (map ((ppBinder summary) . rdrNameOcc . rdrNameFieldOcc . unLoc) names)) <+> dcolon unicode <+> ppLType unicode qual ltype @@ -768,10 +867,10 @@ ppDataHeader _ _ _ _ = error "ppDataHeader: illegal argument" -------------------------------------------------------------------------------- -ppBang :: HsBang -> Html -ppBang HsNoBang = noHtml -ppBang _ = toHtml "!" -- Unpacked args is an implementation detail, - -- so we just show the strictness annotation +ppBang :: HsSrcBang -> Html +ppBang (HsSrcBang _ _ SrcStrict) = toHtml "!" +ppBang (HsSrcBang _ _ SrcLazy) = toHtml "~" +ppBang _ = noHtml tupleParens :: HsTupleSort -> [Html] -> Html @@ -817,52 +916,42 @@ ppCtxType unicode qual ty = ppr_mono_ty pREC_CTX ty unicode qual ppParendType unicode qual ty = ppr_mono_ty pREC_CON ty unicode qual ppFunLhType unicode qual ty = ppr_mono_ty pREC_FUN ty unicode qual +ppHsTyVarBndr :: Unicode -> Qualification -> HsTyVarBndr DocName -> Html +ppHsTyVarBndr _ qual (UserTyVar (L _ name)) = + ppDocName qual Raw False name +ppHsTyVarBndr unicode qual (KindedTyVar name kind) = + parens (ppDocName qual Raw False (unLoc name) <+> dcolon unicode <+> + ppLKind unicode qual kind) + ppLKind :: Unicode -> Qualification -> LHsKind DocName -> Html ppLKind unicode qual y = ppKind unicode qual (unLoc y) ppKind :: Unicode -> Qualification -> HsKind DocName -> Html ppKind unicode qual ki = ppr_mono_ty pREC_TOP ki unicode qual --- Drop top-level for-all type variables in user style --- since they are implicit in Haskell - -ppForAllCon :: HsExplicitFlag -> LHsTyVarBndrs DocName - -> Located (HsContext DocName) -> Unicode -> Qualification -> Html -ppForAllCon expl tvs cxt unicode qual = - forall_part <+> ppLContext cxt unicode qual - where - forall_part = ppLTyVarBndrs expl tvs unicode qual - -ppLTyVarBndrs :: HsExplicitFlag -> LHsTyVarBndrs DocName - -> Unicode -> Qualification - -> Html -ppLTyVarBndrs expl tvs unicode _qual - | show_forall = hsep (forallSymbol unicode : ppTyVars tvs) +++ dot - | otherwise = noHtml - where - show_forall = not (null (hsQTvBndrs tvs)) && is_explicit - is_explicit = case expl of {Explicit -> True; Implicit -> False; Qualified -> False} - +ppForAllPart :: [LHsTyVarBndr DocName] -> Unicode -> Html +ppForAllPart tvs unicode = hsep (forallSymbol unicode : ppTyVars tvs) +++ dot ppr_mono_lty :: Int -> LHsType DocName -> Unicode -> Qualification -> Html ppr_mono_lty ctxt_prec ty = ppr_mono_ty ctxt_prec (unLoc ty) ppr_mono_ty :: Int -> HsType DocName -> Unicode -> Qualification -> Html -ppr_mono_ty ctxt_prec (HsForAllTy expl extra tvs ctxt ty) unicode qual - = maybeParen ctxt_prec pREC_FUN $ ppForAllCon expl tvs ctxt' unicode qual - <+> ppr_mono_lty pREC_TOP ty unicode qual - where ctxt' = case extra of - Just loc -> (++ [L loc HsWildcardTy]) `fmap` ctxt - Nothing -> ctxt +ppr_mono_ty ctxt_prec (HsForAllTy tvs ty) unicode qual + = maybeParen ctxt_prec pREC_FUN $ + ppForAllPart tvs unicode <+> ppr_mono_lty pREC_TOP ty unicode qual + +ppr_mono_ty ctxt_prec (HsQualTy ctxt ty) unicode qual + = maybeParen ctxt_prec pREC_FUN $ + ppLContext ctxt unicode qual <+> ppr_mono_lty pREC_TOP ty unicode qual -- UnicodeSyntax alternatives -ppr_mono_ty _ (HsTyVar name) True _ +ppr_mono_ty _ (HsTyVar (L _ name)) True _ | getOccString (getName name) == "*" = toHtml "★" | getOccString (getName name) == "(->)" = toHtml "(→)" ppr_mono_ty _ (HsBangTy b ty) u q = ppBang b +++ ppLParendType u q ty -ppr_mono_ty _ (HsTyVar name) _ q = ppDocName q Prefix True name +ppr_mono_ty _ (HsTyVar (L _ name)) _ q = ppDocName q Prefix True name ppr_mono_ty ctxt_prec (HsFunTy ty1 ty2) u q = ppr_fun_ty ctxt_prec ty1 ty2 u q ppr_mono_ty _ (HsTupleTy con tys) u q = tupleParens con (map (ppLType u q) tys) ppr_mono_ty _ (HsKindSig ty kind) u q = @@ -872,11 +961,14 @@ ppr_mono_ty _ (HsPArrTy ty) u q = pabrackets (ppr_mono_lty pREC_TO ppr_mono_ty ctxt_prec (HsIParamTy n ty) u q = maybeParen ctxt_prec pREC_CTX $ ppIPName n <+> dcolon u <+> ppr_mono_lty pREC_TOP ty u q ppr_mono_ty _ (HsSpliceTy {}) _ _ = error "ppr_mono_ty HsSpliceTy" -ppr_mono_ty _ (HsRecTy {}) _ _ = error "ppr_mono_ty HsRecTy" +ppr_mono_ty _ (HsRecTy {}) _ _ = toHtml "{..}" + -- Can now legally occur in ConDeclGADT, the output here is to provide a + -- placeholder in the signature, which is followed by the field + -- declarations. ppr_mono_ty _ (HsCoreTy {}) _ _ = error "ppr_mono_ty HsCoreTy" -ppr_mono_ty _ (HsExplicitListTy _ tys) u q = quote $ brackets $ hsep $ punctuate comma $ map (ppLType u q) tys -ppr_mono_ty _ (HsExplicitTupleTy _ tys) u q = quote $ parenList $ map (ppLType u q) tys -ppr_mono_ty _ (HsWrapTy {}) _ _ = error "ppr_mono_ty HsWrapTy" +ppr_mono_ty _ (HsExplicitListTy _ tys) u q = promoQuote $ brackets $ hsep $ punctuate comma $ map (ppLType u q) tys +ppr_mono_ty _ (HsExplicitTupleTy _ tys) u q = promoQuote $ parenList $ map (ppLType u q) tys +ppr_mono_ty _ (HsAppsTy {}) _ _ = error "ppr_mono_ty HsAppsTy" ppr_mono_ty ctxt_prec (HsEqTy ty1 ty2) unicode qual = maybeParen ctxt_prec pREC_CTX $ @@ -886,11 +978,16 @@ ppr_mono_ty ctxt_prec (HsAppTy fun_ty arg_ty) unicode qual = maybeParen ctxt_prec pREC_CON $ hsep [ppr_mono_lty pREC_FUN fun_ty unicode qual, ppr_mono_lty pREC_CON arg_ty unicode qual] -ppr_mono_ty ctxt_prec (HsOpTy ty1 (_, op) ty2) unicode qual +ppr_mono_ty ctxt_prec (HsOpTy ty1 op ty2) unicode qual = maybeParen ctxt_prec pREC_FUN $ ppr_mono_lty pREC_OP ty1 unicode qual <+> ppr_op <+> ppr_mono_lty pREC_OP ty2 unicode qual where - ppr_op = ppLDocName qual Infix op + -- `(:)` is valid in type signature only as constructor to promoted list + -- and needs to be quoted in code so we explicitly quote it here too. + ppr_op + | (getOccString . getName . unLoc) op == ":" = promoQuote ppr_op' + | otherwise = ppr_op' + ppr_op' = ppLDocName qual Infix op ppr_mono_ty ctxt_prec (HsParTy ty) unicode qual -- = parens (ppr_mono_lty pREC_TOP ty) @@ -899,9 +996,9 @@ ppr_mono_ty ctxt_prec (HsParTy ty) unicode qual ppr_mono_ty ctxt_prec (HsDocTy ty _) unicode qual = ppr_mono_lty ctxt_prec ty unicode qual -ppr_mono_ty _ HsWildcardTy _ _ = char '_' +ppr_mono_ty _ (HsWildCardTy (AnonWildCard _)) _ _ = char '_' -ppr_mono_ty _ (HsNamedWildcardTy name) _ q = ppDocName q Prefix True name +ppr_mono_ty _ (HsWildCardTy (NamedWildCard (L _ name))) _ q = ppDocName q Prefix True name ppr_mono_ty _ (HsTyLit n) _ _ = ppr_tylit n diff --git a/haddock-api/src/Haddock/Backends/Xhtml/DocMarkup.hs b/haddock-api/src/Haddock/Backends/Xhtml/DocMarkup.hs index 96d734eb..3fe74a82 100644 --- a/haddock-api/src/Haddock/Backends/Xhtml/DocMarkup.hs +++ b/haddock-api/src/Haddock/Backends/Xhtml/DocMarkup.hs @@ -19,8 +19,6 @@ module Haddock.Backends.Xhtml.DocMarkup ( docElement, docSection, docSection_, ) where -import Control.Applicative ((<$>)) - import Data.List import Haddock.Backends.Xhtml.Names import Haddock.Backends.Xhtml.Utils @@ -64,7 +62,10 @@ parHtmlMarkup qual insertAnchors ppId = Markup { then anchor ! [href url] << fromMaybe url mLabel else toHtml $ fromMaybe url mLabel, - markupAName = \aname -> namedAnchor aname << "", + markupAName = \aname + -> if insertAnchors + then namedAnchor aname << "" + else noHtml, markupPic = \(Picture uri t) -> image ! ([src uri] ++ fromMaybe [] (return . title <$> t)), markupProperty = pre . toHtml, markupExample = examplesToHtml, @@ -160,8 +161,9 @@ hackMarkup fmt' h' = UntouchedDoc d -> (markup fmt $ _doc d, [_meta d]) CollapsingHeader (Header lvl titl) par n nm -> let id_ = makeAnchorId $ "ch:" ++ fromMaybe "noid:" nm ++ show n - col' = collapseControl id_ True "caption" - instTable = (thediv ! collapseSection id_ False [] <<) + expanded = False + col' = collapseControl id_ expanded "caption" + instTable = (thediv ! collapseSection id_ expanded [] <<) lvs = zip [1 .. ] [h1, h2, h3, h4, h5, h6] getHeader = fromMaybe caption (lookup lvl lvs) subCaption = getHeader ! col' << markup fmt titl diff --git a/haddock-api/src/Haddock/Backends/Xhtml/Layout.hs b/haddock-api/src/Haddock/Backends/Xhtml/Layout.hs index b2c60534..d24ed9c4 100644 --- a/haddock-api/src/Haddock/Backends/Xhtml/Layout.hs +++ b/haddock-api/src/Haddock/Backends/Xhtml/Layout.hs @@ -14,7 +14,7 @@ module Haddock.Backends.Xhtml.Layout ( miniBody, divPackageHeader, divContent, divModuleHeader, divFooter, - divTableOfContents, divDescription, divSynposis, divInterface, + divTableOfContents, divDescription, divSynopsis, divInterface, divIndex, divAlphabet, divModuleList, sectionName, @@ -31,7 +31,7 @@ module Haddock.Backends.Xhtml.Layout ( subConstructors, subEquations, subFields, - subInstances, + subInstances, subInstHead, subInstDetails, subMethods, subMinimal, @@ -44,7 +44,6 @@ import Haddock.Backends.Xhtml.Types import Haddock.Backends.Xhtml.Utils import Haddock.Types import Haddock.Utils (makeAnchorId) - import qualified Data.Map as Map import Text.XHtml hiding ( name, title, p, quote ) @@ -77,7 +76,7 @@ nonEmptySectionName c divPackageHeader, divContent, divModuleHeader, divFooter, - divTableOfContents, divDescription, divSynposis, divInterface, + divTableOfContents, divDescription, divSynopsis, divInterface, divIndex, divAlphabet, divModuleList :: Html -> Html @@ -87,7 +86,7 @@ divModuleHeader = sectionDiv "module-header" divFooter = sectionDiv "footer" divTableOfContents = sectionDiv "table-of-contents" divDescription = sectionDiv "description" -divSynposis = sectionDiv "synopsis" +divSynopsis = sectionDiv "synopsis" divInterface = sectionDiv "interface" divIndex = sectionDiv "index" divAlphabet = sectionDiv "alphabet" @@ -128,14 +127,12 @@ divSubDecls cssClass captionName = maybe noHtml wrap subDlist :: Qualification -> [SubDecl] -> Maybe Html subDlist _ [] = Nothing -subDlist qual decls = Just $ dlist << map subEntry decls +++ clearDiv +subDlist qual decls = Just $ ulist << map subEntry decls where subEntry (decl, mdoc, subs) = - dterm ! [theclass "src"] << decl - +++ - docElement ddef << (fmap (docToHtml Nothing qual) mdoc +++ subs) - - clearDiv = thediv ! [ theclass "clear" ] << noHtml + li << + (define ! [theclass "src"] << decl +++ + docElement thediv << (fmap (docToHtml Nothing qual) mdoc +++ subs)) subTable :: Qualification -> [SubDecl] -> Maybe Html @@ -149,6 +146,22 @@ subTable qual decls = Just $ table << aboves (concatMap subRow decls) : map (cell . (td <<)) subs +-- | Sub table with source information (optional). +subTableSrc :: Qualification -> LinksInfo -> Bool -> [(SubDecl,Located DocName)] -> Maybe Html +subTableSrc _ _ _ [] = Nothing +subTableSrc qual lnks splice decls = Just $ table << aboves (concatMap subRow decls) + where + subRow ((decl, mdoc, subs),L loc dn) = + (td ! [theclass "src clearfix"] << + (thespan ! [theclass "inst-left"] << decl) + <+> linkHtml loc dn + <-> + docElement td << fmap (docToHtml Nothing qual) mdoc + ) + : map (cell . (td <<)) subs + linkHtml loc@(RealSrcSpan _) dn = links lnks loc splice dn + linkHtml _ _ = noHtml + subBlock :: [Html] -> Maybe Html subBlock [] = Nothing subBlock hs = Just $ toHtml hs @@ -174,17 +187,43 @@ subEquations :: Qualification -> [SubDecl] -> Html subEquations qual = divSubDecls "equations" "Equations" . subTable qual +-- | Generate sub table for instance declarations, with source subInstances :: Qualification -> String -- ^ Class name, used for anchor generation - -> [SubDecl] -> Html -subInstances qual nm = maybe noHtml wrap . instTable + -> LinksInfo -> Bool + -> [(SubDecl,Located DocName)] -> Html +subInstances qual nm lnks splice = maybe noHtml wrap . instTable where wrap = (subSection <<) . (subCaption +++) - instTable = fmap (thediv ! collapseSection id_ True [] <<) . subTable qual + instTable = fmap (thediv ! collapseSection id_ True [] <<) . subTableSrc qual lnks splice subSection = thediv ! [theclass "subs instances"] subCaption = paragraph ! collapseControl id_ True "caption" << "Instances" id_ = makeAnchorId $ "i:" ++ nm + +subInstHead :: String -- ^ Instance unique id (for anchor generation) + -> Html -- ^ Header content (instance name and type) + -> Html +subInstHead iid hdr = + expander noHtml <+> hdr + where + expander = thespan ! collapseControl (instAnchorId iid) False "instance" + + +subInstDetails :: String -- ^ Instance unique id (for anchor generation) + -> [Html] -- ^ Associated type contents + -> [Html] -- ^ Method contents (pretty-printed signatures) + -> Html +subInstDetails iid ats mets = + section << (subAssociatedTypes ats <+> subMethods mets) + where + section = thediv ! collapseSection (instAnchorId iid) False "inst-details" + + +instAnchorId :: String -> String +instAnchorId iid = makeAnchorId $ "i:" ++ iid + + subMethods :: [Html] -> Html subMethods = divSubDecls "methods" "Methods" . subBlock @@ -200,12 +239,19 @@ declElem = paragraph ! [theclass "src"] -- a box for top level documented names -- it adds a source and wiki link at the right hand side of the box topDeclElem :: LinksInfo -> SrcSpan -> Bool -> [DocName] -> Html -> Html -topDeclElem ((_,_,sourceMap,lineMap), (_,_,maybe_wiki_url)) loc splice names html = - declElem << (html <+> srcLink <+> wikiLink) +topDeclElem lnks loc splice names html = + declElem << (html <+> (links lnks loc splice $ head names)) + -- FIXME: is it ok to simply take the first name? + +-- | Adds a source and wiki link at the right hand side of the box. +-- Name must be documented, otherwise we wouldn't get here. +links :: LinksInfo -> SrcSpan -> Bool -> DocName -> Html +links ((_,_,sourceMap,lineMap), (_,_,maybe_wiki_url)) loc splice (Documented n mdl) = + (srcLink <+> wikiLink) where srcLink = let nameUrl = Map.lookup origPkg sourceMap lineUrl = Map.lookup origPkg lineMap mUrl | splice = lineUrl - -- Use the lineUrl as a backup + -- Use the lineUrl as a backup | otherwise = maybe lineUrl Just nameUrl in case mUrl of Nothing -> noHtml @@ -225,12 +271,9 @@ topDeclElem ((_,_,sourceMap,lineMap), (_,_,maybe_wiki_url)) loc splice names htm -- TODO: do something about type instances. They will point to -- the module defining the type family, which is wrong. origMod = nameModule n - origPkg = modulePackageKey origMod - - -- Name must be documented, otherwise we wouldn't get here - Documented n mdl = head names - -- FIXME: is it ok to simply take the first name? + origPkg = moduleUnitId origMod fname = case loc of - RealSrcSpan l -> unpackFS (srcSpanFile l) - UnhelpfulSpan _ -> error "topDeclElem UnhelpfulSpan" + RealSrcSpan l -> unpackFS (srcSpanFile l) + UnhelpfulSpan _ -> error "links: UnhelpfulSpan" +links _ _ _ _ = noHtml diff --git a/haddock-api/src/Haddock/Backends/Xhtml/Names.hs b/haddock-api/src/Haddock/Backends/Xhtml/Names.hs index cf12da40..c69710d1 100644 --- a/haddock-api/src/Haddock/Backends/Xhtml/Names.hs +++ b/haddock-api/src/Haddock/Backends/Xhtml/Names.hs @@ -110,16 +110,21 @@ ppName notation name = wrapInfix notation (getOccName name) $ toHtml (getOccStri ppBinder :: Bool -> OccName -> Html --- The Bool indicates whether we are generating the summary, in which case --- the binder will be a link to the full definition. -ppBinder True n = linkedAnchor (nameAnchorId n) << ppBinder' Prefix n -ppBinder False n = namedAnchor (nameAnchorId n) ! [theclass "def"] - << ppBinder' Prefix n +ppBinder = ppBinderWith Prefix ppBinderInfix :: Bool -> OccName -> Html -ppBinderInfix True n = linkedAnchor (nameAnchorId n) << ppBinder' Infix n -ppBinderInfix False n = namedAnchor (nameAnchorId n) ! [theclass "def"] - << ppBinder' Infix n +ppBinderInfix = ppBinderWith Infix + +ppBinderWith :: Notation -> Bool -> OccName -> Html +-- 'isRef' indicates whether this is merely a reference from another part of +-- the documentation or is the actual definition; in the latter case, we also +-- set the 'id' and 'class' attributes. +ppBinderWith notation isRef n = + linkedAnchor name ! attributes << ppBinder' notation n + where + name = nameAnchorId n + attributes | isRef = [] + | otherwise = [identifier name, theclass "def"] ppBinder' :: Notation -> OccName -> Html ppBinder' notation n = wrapInfix notation n $ ppOccName n diff --git a/haddock-api/src/Haddock/Backends/Xhtml/Themes.hs b/haddock-api/src/Haddock/Backends/Xhtml/Themes.hs index 79b093ec..10d6ab10 100644 --- a/haddock-api/src/Haddock/Backends/Xhtml/Themes.hs +++ b/haddock-api/src/Haddock/Backends/Xhtml/Themes.hs @@ -18,7 +18,6 @@ module Haddock.Backends.Xhtml.Themes ( import Haddock.Options -import Control.Applicative import Control.Monad (liftM) import Data.Char (toLower) import Data.Either (lefts, rights) @@ -206,4 +205,3 @@ liftEither f = either Left (Right . f) concatEither :: [Either a [b]] -> Either a [b] concatEither = liftEither concat . sequenceEither - diff --git a/haddock-api/src/Haddock/Backends/Xhtml/Types.hs b/haddock-api/src/Haddock/Backends/Xhtml/Types.hs index 3d1db887..d1561791 100644 --- a/haddock-api/src/Haddock/Backends/Xhtml/Types.hs +++ b/haddock-api/src/Haddock/Backends/Xhtml/Types.hs @@ -23,7 +23,7 @@ import GHC -- the base, module and entity URLs for the source code and wiki links. -type SourceURLs = (Maybe FilePath, Maybe FilePath, Map PackageKey FilePath, Map PackageKey FilePath) +type SourceURLs = (Maybe FilePath, Maybe FilePath, Map UnitId FilePath, Map UnitId FilePath) type WikiURLs = (Maybe FilePath, Maybe FilePath, Maybe FilePath) diff --git a/haddock-api/src/Haddock/Backends/Xhtml/Utils.hs b/haddock-api/src/Haddock/Backends/Xhtml/Utils.hs index cbcbbd6d..98ff4007 100644 --- a/haddock-api/src/Haddock/Backends/Xhtml/Utils.hs +++ b/haddock-api/src/Haddock/Backends/Xhtml/Utils.hs @@ -14,14 +14,14 @@ module Haddock.Backends.Xhtml.Utils ( renderToString, namedAnchor, linkedAnchor, - spliceURL, + spliceURL, spliceURL', groupId, (<+>), (<=>), char, keyword, punctuate, braces, brackets, pabrackets, parens, parenList, ubxParenList, - arrow, comma, dcolon, dot, darrow, equals, forallSymbol, quote, + arrow, comma, dcolon, dot, darrow, equals, forallSymbol, quote, promoQuote, hsep, vcat, @@ -29,7 +29,6 @@ module Haddock.Backends.Xhtml.Utils ( ) where -import Haddock.GhcUtils import Haddock.Utils import Data.Maybe @@ -38,18 +37,31 @@ import Text.XHtml hiding ( name, title, p, quote ) import qualified Text.XHtml as XHtml import GHC ( SrcSpan(..), srcSpanStartLine, Name ) -import Module ( Module ) +import Module ( Module, ModuleName, moduleName, moduleNameString ) import Name ( getOccString, nameOccName, isValOcc ) +-- | Replace placeholder string elements with provided values. +-- +-- Used to generate URL for customized external paths, usually provided with +-- @--source-module@, @--source-entity@ and related command-line arguments. +-- +-- >>> spliceURL Nothing mmod mname Nothing "output/%{MODULE}.hs#%{NAME}" +-- "output/Foo.hs#foo" spliceURL :: Maybe FilePath -> Maybe Module -> Maybe GHC.Name -> Maybe SrcSpan -> String -> String -spliceURL maybe_file maybe_mod maybe_name maybe_loc = run +spliceURL mfile mmod = spliceURL' mfile (moduleName <$> mmod) + + +-- | Same as 'spliceURL' but takes 'ModuleName' instead of 'Module'. +spliceURL' :: Maybe FilePath -> Maybe ModuleName -> Maybe GHC.Name -> + Maybe SrcSpan -> String -> String +spliceURL' maybe_file maybe_mod maybe_name maybe_loc = run where file = fromMaybe "" maybe_file mdl = case maybe_mod of Nothing -> "" - Just m -> moduleString m + Just m -> moduleNameString m (name, kind) = case maybe_name of @@ -138,6 +150,11 @@ quote :: Html -> Html quote h = char '`' +++ h +++ '`' +-- | Promoted type quote (e.g. @'[a, b]@, @'(a, b, c)@). +promoQuote :: Html -> Html +promoQuote h = char '\'' +++ h + + parens, brackets, pabrackets, braces :: Html -> Html parens h = char '(' +++ h +++ char ')' brackets h = char '[' +++ h +++ char ']' @@ -203,7 +220,7 @@ collapseSection id_ state classes = [ identifier sid, theclass cs ] collapseToggle :: String -> [HtmlAttr] collapseToggle id_ = [ strAttr "onclick" js ] where js = "toggleSection('" ++ id_ ++ "')"; - + -- | Attributes for an area that toggles a collapsed area, -- and displays a control. collapseControl :: String -> Bool -> String -> [HtmlAttr] diff --git a/haddock-api/src/Haddock/Convert.hs b/haddock-api/src/Haddock/Convert.hs index d841aecc..bc293731 100644 --- a/haddock-api/src/Haddock/Convert.hs +++ b/haddock-api/src/Haddock/Convert.hs @@ -22,26 +22,27 @@ import Class import CoAxiom import ConLike import Data.Either (lefts, rights) -import Data.List( partition ) -import Data.Monoid (mempty) import DataCon import FamInstEnv -import Haddock.Types import HsSyn -import Kind ( splitKindFunTys, synTyConResKind, isKind ) import Name +import RdrName ( mkVarUnqual ) import PatSyn -import PrelNames (ipClassName) -import SrcLoc ( Located, noLoc, unLoc, noSrcSpan ) +import SrcLoc ( Located, noLoc, unLoc ) import TcType ( tcSplitSigmaTy ) import TyCon -import Type (isStrLitTy, mkFunTys) -import TypeRep +import Type +import TyCoRep import TysPrim ( alphaTyVars ) -import TysWiredIn ( listTyConName, eqTyCon ) +import TysWiredIn ( listTyConName, ipTyCon ) +import PrelNames ( hasKey, eqTyConKey ) import Unique ( getUnique ) +import Util ( filterByList, filterOut ) import Var +import Haddock.Types +import Haddock.Interface.Specialize + -- the main function here! yay! @@ -77,7 +78,7 @@ tyThingToLHsDecl t = case t of , tcdFDs = map (\ (l,r) -> noLoc (map (noLoc . getName) l, map (noLoc . getName) r) ) $ snd $ classTvsFds cl - , tcdSigs = noLoc (MinimalSig mempty . fmap noLoc $ classMinimalDef cl) : + , tcdSigs = noLoc (MinimalSig mempty . noLoc . fmap noLoc $ classMinimalDef cl) : map (noLoc . synifyIdSig DeleteTopLevelQuantification) (classMethods cl) , tcdMeths = emptyBag --ignore default method definitions, they don't affect signature @@ -95,17 +96,11 @@ tyThingToLHsDecl t = case t of -- a data-constructor alone just gets rendered as a function: AConLike (RealDataCon dc) -> allOK $ SigD (TypeSig [synifyName dc] - (synifyType ImplicitizeForAll (dataConUserType dc)) []) + (synifySigWcType ImplicitizeForAll (dataConUserType dc))) AConLike (PatSynCon ps) -> - let (univ_tvs, ex_tvs, req_theta, prov_theta, arg_tys, res_ty) = patSynSig ps - qtvs = univ_tvs ++ ex_tvs - ty = mkFunTys arg_tys res_ty - in allOK . SigD $ PatSynSig (synifyName ps) - (Implicit, synifyTyVars qtvs) - (synifyCtx req_theta) - (synifyCtx prov_theta) - (synifyType WithinType ty) + allOK . SigD $ PatSynSig (synifyName ps) (synifySigType WithinType + (patSynType ps)) where withErrs e x = return (e, x) allOK x = return (mempty, x) @@ -115,12 +110,9 @@ synifyAxBranch tc (CoAxBranch { cab_tvs = tkvs, cab_lhs = args, cab_rhs = rhs }) = let name = synifyName tc typats = map (synifyType WithinType) args hs_rhs = synifyType WithinType rhs - (kvs, tvs) = partition isKindVar tkvs in TyFamEqn { tfe_tycon = name - , tfe_pats = HsWB { hswb_cts = typats - , hswb_kvs = map tyVarName kvs - , hswb_tvs = map tyVarName tvs - , hswb_wcs = [] } + , tfe_pats = HsIB { hsib_body = typats + , hsib_vars = map tyVarName tkvs } , tfe_rhs = hs_rhs } synifyAxiom :: CoAxiom br -> Either ErrMsg (HsDecl Name) @@ -140,7 +132,7 @@ synifyAxiom ax@(CoAxiom { co_ax_tc = tc }) -- | Turn type constructors into type class declarations synifyTyCon :: Maybe (CoAxiom br) -> TyCon -> Either ErrMsg (TyClDecl Name) -synifyTyCon coax tc +synifyTyCon _coax tc | isFunTyCon tc || isPrimTyCon tc = return $ DataDecl { tcdLName = synifyName tc @@ -148,8 +140,8 @@ synifyTyCon coax tc let mk_hs_tv realKind fakeTyVar = noLoc $ KindedTyVar (noLoc (getName fakeTyVar)) (synifyKindSig realKind) - in HsQTvs { hsq_kvs = [] -- No kind polymorphism - , hsq_tvs = zipWith mk_hs_tv (fst (splitKindFunTys (tyConKind tc))) + in HsQTvs { hsq_implicit = [] -- No kind polymorphism + , hsq_explicit = zipWith mk_hs_tv (fst (splitFunTys (tyConKind tc))) alphaTyVars --a, b, c... which are unfortunately all kind * } @@ -163,37 +155,38 @@ synifyTyCon coax tc , dd_derivs = Nothing } , tcdFVs = placeHolderNamesTc } - | isTypeFamilyTyCon tc - = case famTyConFlav_maybe tc of - Just rhs -> - let info = case rhs of - OpenSynFamilyTyCon -> return OpenTypeFamily - ClosedSynFamilyTyCon mb -> case mb of - Just (CoAxiom { co_ax_branches = branches }) - -> return $ ClosedTypeFamily $ Just $ - brListMap (noLoc . synifyAxBranch tc) branches - Nothing -> return $ ClosedTypeFamily $ Just [] - BuiltInSynFamTyCon {} - -> return $ ClosedTypeFamily $ Just [] - AbstractClosedSynFamilyTyCon {} - -> return $ ClosedTypeFamily Nothing - in info >>= \i -> - return (FamDecl - (FamilyDecl { fdInfo = i - , fdLName = synifyName tc - , fdTyVars = synifyTyVars (tyConTyVars tc) - , fdKindSig = - Just (synifyKindSig (synTyConResKind tc)) - })) - Nothing -> Left "synifyTyCon: impossible open type synonym?" - - | isDataFamilyTyCon tc - = --(why no "isOpenAlgTyCon"?) - case algTyConRhs tc of - DataFamilyTyCon -> return $ - FamDecl (FamilyDecl DataFamily (synifyName tc) (synifyTyVars (tyConTyVars tc)) - Nothing) --always kind '*' - _ -> Left "synifyTyCon: impossible open data type?" +synifyTyCon _coax tc + | Just flav <- famTyConFlav_maybe tc + = case flav of + -- Type families + OpenSynFamilyTyCon -> mkFamDecl OpenTypeFamily + ClosedSynFamilyTyCon mb + | Just (CoAxiom { co_ax_branches = branches }) <- mb + -> mkFamDecl $ ClosedTypeFamily $ Just + $ map (noLoc . synifyAxBranch tc) (fromBranches branches) + | otherwise + -> mkFamDecl $ ClosedTypeFamily $ Just [] + BuiltInSynFamTyCon {} + -> mkFamDecl $ ClosedTypeFamily $ Just [] + AbstractClosedSynFamilyTyCon {} + -> mkFamDecl $ ClosedTypeFamily Nothing + DataFamilyTyCon {} + -> mkFamDecl DataFamily + where + resultVar = famTcResVar tc + mkFamDecl i = return $ FamDecl $ + FamilyDecl { fdInfo = i + , fdLName = synifyName tc + , fdTyVars = synifyTyVars (tyConTyVars tc) + , fdResultSig = + synifyFamilyResultSig resultVar tyConResKind + , fdInjectivityAnn = + synifyInjectivityAnn resultVar (tyConTyVars tc) + (familyTyConInjectivityInfo tc) + } + tyConResKind = piResultTys (tyConKind tc) (mkTyVarTys (tyConTyVars tc)) + +synifyTyCon coax tc | Just ty <- synTyConRhs_maybe tc = return $ SynDecl { tcdLName = synifyName tc , tcdTyVars = synifyTyVars (tyConTyVars tc) @@ -243,6 +236,20 @@ synifyTyCon coax tc , tcdFVs = placeHolderNamesTc } dataConErrs -> Left $ unlines dataConErrs +synifyInjectivityAnn :: Maybe Name -> [TyVar] -> Injectivity + -> Maybe (LInjectivityAnn Name) +synifyInjectivityAnn Nothing _ _ = Nothing +synifyInjectivityAnn _ _ NotInjective = Nothing +synifyInjectivityAnn (Just lhs) tvs (Injective inj) = + let rhs = map (noLoc . tyVarName) (filterByList inj tvs) + in Just $ noLoc $ InjectivityAnn (noLoc lhs) rhs + +synifyFamilyResultSig :: Maybe Name -> Kind -> LFamilyResultSig Name +synifyFamilyResultSig Nothing kind = + noLoc $ KindSig (synifyKindSig kind) +synifyFamilyResultSig (Just name) kind = + noLoc $ TyVarSig (noLoc $ KindedTyVar (noLoc name) (synifyKindSig kind)) + -- User beware: it is your responsibility to pass True (use_gadt_syntax) -- for any constructor that would be misrepresented by omitting its -- result-type. @@ -266,21 +273,18 @@ synifyDataCon use_gadt_syntax dc = -- skip any EqTheta, use 'orig'inal syntax ctx = synifyCtx theta - linear_tys = zipWith (\ty bang -> - let tySyn = synifyType WithinType ty - src_bang = case bang of - HsUnpack {} -> HsSrcBang Nothing (Just True) True - HsStrict -> HsSrcBang Nothing (Just False) True - _ -> bang - in case src_bang of - HsNoBang -> tySyn - _ -> noLoc $ HsBangTy bang tySyn - -- HsNoBang never appears, it's implied instead. - ) - arg_tys (dataConSrcBangs dc) - field_tys = zipWith (\field synTy -> noLoc $ ConDeclField - [synifyName field] synTy Nothing) - (dataConFieldLabels dc) linear_tys + linear_tys = + zipWith (\ty bang -> + let tySyn = synifyType WithinType ty + in case bang of + (HsSrcBang _ NoSrcUnpack NoSrcStrict) -> tySyn + bang' -> noLoc $ HsBangTy bang' tySyn) + arg_tys (dataConSrcBangs dc) + + field_tys = zipWith con_decl_field (dataConFieldLabels dc) linear_tys + con_decl_field fl synTy = noLoc $ + ConDeclField [noLoc $ FieldOcc (mkVarUnqual $ flLabel fl) (flSelector fl)] synTy + Nothing hs_arg_tys = case (use_named_field_syntax, use_infix_syntax) of (True,True) -> Left "synifyDataCon: contradiction!" (True,False) -> return $ RecCon (noLoc field_tys) @@ -288,39 +292,45 @@ synifyDataCon use_gadt_syntax dc = (False,True) -> case linear_tys of [a,b] -> return $ InfixCon a b _ -> Left "synifyDataCon: infix with non-2 args?" - hs_res_ty = if use_gadt_syntax - then ResTyGADT noSrcSpan (synifyType WithinType res_ty) - else ResTyH98 + gadt_ty = HsIB [] (synifyType WithinType res_ty) -- finally we get synifyDataCon's result! in hs_arg_tys >>= - \hat -> return . noLoc $ ConDecl [name] Implicit -- we don't know nor care - qvars ctx hat hs_res_ty Nothing - -- we don't want any "deprecated GADT syntax" warnings! - False + \hat -> + if use_gadt_syntax + then return $ noLoc $ + ConDeclGADT { con_names = [name] + , con_type = gadt_ty + , con_doc = Nothing } + else return $ noLoc $ + ConDeclH98 { con_name = name + , con_qvars = Just qvars + , con_cxt = Just ctx + , con_details = hat + , con_doc = Nothing } synifyName :: NamedThing n => n -> Located Name synifyName = noLoc . getName synifyIdSig :: SynifyTypeState -> Id -> Sig Name -synifyIdSig s i = TypeSig [synifyName i] (synifyType s (varType i)) [] +synifyIdSig s i = TypeSig [synifyName i] (synifySigWcType s (varType i)) synifyCtx :: [PredType] -> LHsContext Name synifyCtx = noLoc . map (synifyType WithinType) -synifyTyVars :: [TyVar] -> LHsTyVarBndrs Name -synifyTyVars ktvs = HsQTvs { hsq_kvs = map tyVarName kvs - , hsq_tvs = map synifyTyVar tvs } +synifyTyVars :: [TyVar] -> LHsQTyVars Name +synifyTyVars ktvs = HsQTvs { hsq_implicit = [] + , hsq_explicit = map synifyTyVar ktvs } + +synifyTyVar :: TyVar -> LHsTyVarBndr Name +synifyTyVar tv + | isLiftedTypeKind kind = noLoc (UserTyVar (noLoc name)) + | otherwise = noLoc (KindedTyVar (noLoc name) (synifyKindSig kind)) where - (kvs, tvs) = partition isKindVar ktvs - synifyTyVar tv - | isLiftedTypeKind kind = noLoc (UserTyVar name) - | otherwise = noLoc (KindedTyVar (noLoc name) (synifyKindSig kind)) - where - kind = tyVarKind tv - name = getName tv + kind = tyVarKind tv + name = getName tv --states of what to do with foralls: data SynifyTypeState @@ -338,8 +348,17 @@ data SynifyTypeState -- the defining class gets to quantify all its functions for free! +synifySigType :: SynifyTypeState -> Type -> LHsSigType Name +-- The empty binders is a bit suspicious; +-- what if the type has free variables? +synifySigType s ty = mkEmptyImplicitBndrs (synifyType s ty) + +synifySigWcType :: SynifyTypeState -> Type -> LHsSigWcType Name +-- Ditto (see synifySigType) +synifySigWcType s ty = mkEmptyImplicitBndrs (mkEmptyWildCardBndrs (synifyType s ty)) + synifyType :: SynifyTypeState -> Type -> LHsType Name -synifyType _ (TyVarTy tv) = noLoc $ HsTyVar (getName tv) +synifyType _ (TyVarTy tv) = noLoc $ HsTyVar $ noLoc (getName tv) synifyType _ (TyConApp tc tys) -- Use non-prefix tuple syntax where possible, because it looks nicer. | Just sort <- tyConTuple_maybe tc @@ -353,40 +372,42 @@ synifyType _ (TyConApp tc tys) | getName tc == listTyConName, [ty] <- tys = noLoc $ HsListTy (synifyType WithinType ty) -- ditto for implicit parameter tycons - | tyConName tc == ipClassName + | tc == ipTyCon , [name, ty] <- tys , Just x <- isStrLitTy name = noLoc $ HsIParamTy (HsIPName x) (synifyType WithinType ty) -- and equalities - | tc == eqTyCon + | tc `hasKey` eqTyConKey , [ty1, ty2] <- tys = noLoc $ HsEqTy (synifyType WithinType ty1) (synifyType WithinType ty2) -- Most TyCons: | otherwise = foldl (\t1 t2 -> noLoc (HsAppTy t1 t2)) - (noLoc $ HsTyVar (getName tc)) - (map (synifyType WithinType) tys) + (noLoc $ HsTyVar $ noLoc (getName tc)) + (map (synifyType WithinType) $ + filterOut isCoercionTy tys) +synifyType s (AppTy t1 (CoercionTy {})) = synifyType s t1 synifyType _ (AppTy t1 t2) = let s1 = synifyType WithinType t1 s2 = synifyType WithinType t2 in noLoc $ HsAppTy s1 s2 -synifyType _ (FunTy t1 t2) = let +synifyType _ (ForAllTy (Anon t1) t2) = let s1 = synifyType WithinType t1 s2 = synifyType WithinType t2 in noLoc $ HsFunTy s1 s2 synifyType s forallty@(ForAllTy _tv _ty) = let (tvs, ctx, tau) = tcSplitSigmaTy forallty - sTvs = synifyTyVars tvs - sCtx = synifyCtx ctx - sTau = synifyType WithinType tau - mkHsForAllTy forallPlicitness = - noLoc $ HsForAllTy forallPlicitness Nothing sTvs sCtx sTau + sPhi = HsQualTy { hst_ctxt = synifyCtx ctx + , hst_body = synifyType WithinType tau } in case s of DeleteTopLevelQuantification -> synifyType ImplicitizeForAll tau - WithinType -> mkHsForAllTy Explicit - ImplicitizeForAll -> mkHsForAllTy Implicit + WithinType -> noLoc $ HsForAllTy { hst_bndrs = map synifyTyVar tvs + , hst_body = noLoc sPhi } + ImplicitizeForAll -> noLoc sPhi synifyType _ (LitTy t) = noLoc $ HsTyLit $ synifyTyLit t +synifyType s (CastTy t _) = synifyType s t +synifyType _ (CoercionTy {}) = error "synifyType:Coercion" synifyTyLit :: TyLit -> HsTyLit synifyTyLit (NumTyLit n) = HsNumTy mempty n @@ -396,23 +417,38 @@ synifyKindSig :: Kind -> LHsKind Name synifyKindSig k = synifyType WithinType k synifyInstHead :: ([TyVar], [PredType], Class, [Type]) -> InstHead Name -synifyInstHead (_, preds, cls, types) = - ( getName cls - , map (unLoc . synifyType WithinType) ks - , map (unLoc . synifyType WithinType) ts - , ClassInst $ map (unLoc . synifyType WithinType) preds - ) - where (ks,ts) = break (not . isKind) types +synifyInstHead (_, preds, cls, types) = specializeInstHead $ InstHead + { ihdClsName = getName cls + , ihdKinds = map (unLoc . synifyType WithinType) ks + , ihdTypes = map (unLoc . synifyType WithinType) ts + , ihdInstType = ClassInst + { clsiCtx = map (unLoc . synifyType WithinType) preds + , clsiTyVars = synifyTyVars $ classTyVars cls + , clsiSigs = map synifyClsIdSig $ classMethods cls + , clsiAssocTys = do + (Right (FamDecl fam)) <- map (synifyTyCon Nothing) $ classATs cls + pure $ mkPseudoFamilyDecl fam + } + } + where + (ks,ts) = partitionInvisibles (classTyCon cls) id types + synifyClsIdSig = synifyIdSig DeleteTopLevelQuantification -- Convert a family instance, this could be a type family or data family synifyFamInst :: FamInst -> Bool -> Either ErrMsg (InstHead Name) -synifyFamInst fi opaque = - let fff = case fi_flavor fi of - SynFamilyInst | opaque -> return $ TypeInst Nothing - SynFamilyInst -> - return . TypeInst . Just . unLoc . synifyType WithinType $ fi_rhs fi - DataFamilyInst c -> - synifyTyCon (Just $ famInstAxiom fi) c >>= return . DataInst - in fff >>= \f' -> return (fi_fam fi , map (unLoc . synifyType WithinType) ks, - map (unLoc . synifyType WithinType) ts , f') - where (ks,ts) = break (not . isKind) $ fi_tys fi +synifyFamInst fi opaque = do + ityp' <- ityp $ fi_flavor fi + return InstHead + { ihdClsName = fi_fam fi + , ihdKinds = synifyTypes ks + , ihdTypes = synifyTypes ts + , ihdInstType = ityp' + } + where + ityp SynFamilyInst | opaque = return $ TypeInst Nothing + ityp SynFamilyInst = + return . TypeInst . Just . unLoc . synifyType WithinType $ fi_rhs fi + ityp (DataFamilyInst c) = + DataInst <$> synifyTyCon (Just $ famInstAxiom fi) c + (ks,ts) = partitionInvisibles (famInstTyCon fi) id $ fi_tys fi + synifyTypes = map (unLoc. synifyType WithinType) diff --git a/haddock-api/src/Haddock/GhcUtils.hs b/haddock-api/src/Haddock/GhcUtils.hs index 5caefa77..4e5e008b 100644 --- a/haddock-api/src/Haddock/GhcUtils.hs +++ b/haddock-api/src/Haddock/GhcUtils.hs @@ -16,7 +16,6 @@ module Haddock.GhcUtils where -import Control.Applicative ( (<$>) ) import Control.Arrow import Data.Function @@ -69,7 +68,7 @@ getMainDeclBinder _ = [] -- to correlate InstDecls with their Instance/CoAxiom Names, via the -- instanceMap. getInstLoc :: InstDecl name -> SrcSpan -getInstLoc (ClsInstD (ClsInstDecl { cid_poly_ty = L l _ })) = l +getInstLoc (ClsInstD (ClsInstDecl { cid_poly_ty = ty })) = getLoc (hsSigType ty) getInstLoc (DataFamInstD (DataFamInstDecl { dfid_tycon = L l _ })) = l getInstLoc (TyFamInstD (TyFamInstDecl -- Since CoAxioms' Names refer to the whole line for type family instances @@ -92,10 +91,14 @@ filterSigNames p (FixSig (FixitySig ns ty)) = [] -> Nothing filtered -> Just (FixSig (FixitySig filtered ty)) filterSigNames _ orig@(MinimalSig _ _) = Just orig -filterSigNames p (TypeSig ns ty nwcs) = +filterSigNames p (TypeSig ns ty) = case filter (p . unLoc) ns of [] -> Nothing - filtered -> Just (TypeSig filtered ty nwcs) + filtered -> Just (TypeSig filtered ty) +filterSigNames p (ClassOpSig is_default ns ty) = + case filter (p . unLoc) ns of + [] -> Nothing + filtered -> Just (ClassOpSig is_default filtered ty) filterSigNames _ _ = Nothing ifTrueJust :: Bool -> name -> Maybe name @@ -106,13 +109,19 @@ sigName :: LSig name -> [name] sigName (L _ sig) = sigNameNoLoc sig sigNameNoLoc :: Sig name -> [name] -sigNameNoLoc (TypeSig ns _ _) = map unLoc ns -sigNameNoLoc (PatSynSig n _ _ _ _) = [unLoc n] -sigNameNoLoc (SpecSig n _ _) = [unLoc n] -sigNameNoLoc (InlineSig n _) = [unLoc n] +sigNameNoLoc (TypeSig ns _) = map unLoc ns +sigNameNoLoc (ClassOpSig _ ns _) = map unLoc ns +sigNameNoLoc (PatSynSig n _) = [unLoc n] +sigNameNoLoc (SpecSig n _ _) = [unLoc n] +sigNameNoLoc (InlineSig n _) = [unLoc n] sigNameNoLoc (FixSig (FixitySig ns _)) = map unLoc ns sigNameNoLoc _ = [] +-- | Was this signature given by the user? +isUserLSig :: LSig name -> Bool +isUserLSig (L _(TypeSig {})) = True +isUserLSig (L _(ClassOpSig {})) = True +isUserLSig _ = False isTyClD :: HsDecl a -> Bool isTyClD (TyClD _) = True @@ -188,17 +197,18 @@ class Parent a where instance Parent (ConDecl Name) where children con = - case con_details con of - RecCon fields -> map unL $ concatMap (cd_fld_names . unL) (unL fields) + case getConDetails con of + RecCon fields -> map (selectorFieldOcc . unL) $ + concatMap (cd_fld_names . unL) (unL fields) _ -> [] instance Parent (TyClDecl Name) where children d - | isDataDecl d = map unL $ concatMap (con_names . unL) + | isDataDecl d = map unL $ concatMap (getConNames . unL) $ (dd_cons . tcdDataDefn) $ d | isClassDecl d = map (unL . fdLName . unL) (tcdATs d) ++ - [ unL n | L _ (TypeSig ns _ _) <- tcdSigs d, n <- ns ] + [ unL n | L _ (TypeSig ns _) <- tcdSigs d, n <- ns ] | otherwise = [] @@ -208,7 +218,7 @@ family = getName &&& children familyConDecl :: ConDecl Name -> [(Name, [Name])] -familyConDecl d = zip (map unL (con_names d)) (repeat $ children d) +familyConDecl d = zip (map unL (getConNames d)) (repeat $ children d) -- | A mapping from the parent (main-binder) to its children and from each -- child to its grand-children, recursively. diff --git a/haddock-api/src/Haddock/Interface/AttachInstances.hs b/haddock-api/src/Haddock/Interface/AttachInstances.hs index 080de6ff..faf043aa 100644 --- a/haddock-api/src/Haddock/Interface/AttachInstances.hs +++ b/haddock-api/src/Haddock/Interface/AttachInstances.hs @@ -22,6 +22,7 @@ import Control.Arrow hiding ((<+>)) import Data.List import Data.Ord (comparing) import Data.Function (on) +import Data.Maybe ( maybeToList, mapMaybe ) import qualified Data.Map as Map import qualified Data.Set as Set @@ -32,16 +33,15 @@ import FamInstEnv import FastString import GHC import GhcMonad (withSession) -import Id import InstEnv import MonadUtils (liftIO) import Name import Outputable (text, sep, (<+>)) import PrelNames +import SrcLoc import TcRnDriver (tcRnGetInfo) -import TcType (tcSplitSigmaTy) import TyCon -import TypeRep +import TyCoRep import TysPrim( funTyCon ) import Var hiding (varName) #define FSLIT(x) (mkFastString# (x#)) @@ -68,25 +68,26 @@ attachToExportItem :: ExportInfo -> Interface -> IfaceMap -> InstIfaceMap -> Ghc (ExportItem Name) attachToExportItem expInfo iface ifaceMap instIfaceMap export = case attachFixities export of - e@ExportDecl { expItemDecl = L _ (TyClD d) } -> do + e@ExportDecl { expItemDecl = L eSpan (TyClD d) } -> do mb_info <- getAllInfo (tcdName d) insts <- case mb_info of Just (_, _, cls_instances, fam_instances) -> - let fam_insts = [ (synifyFamInst i opaque, n) + let fam_insts = [ (synifyFamInst i opaque, doc,spanNameE n (synifyFamInst i opaque) (L eSpan (tcdName d)) ) | i <- sortBy (comparing instFam) fam_instances - , let n = instLookup instDocMap (getName i) iface ifaceMap instIfaceMap + , let n = getName i + , let doc = instLookup instDocMap n iface ifaceMap instIfaceMap , not $ isNameHidden expInfo (fi_fam i) , not $ any (isTypeHidden expInfo) (fi_tys i) , let opaque = isTypeHidden expInfo (fi_rhs i) ] - cls_insts = [ (synifyInstHead i, instLookup instDocMap n iface ifaceMap instIfaceMap) + cls_insts = [ (synifyInstHead i, instLookup instDocMap n iface ifaceMap instIfaceMap, spanName n (synifyInstHead i) (L eSpan (tcdName d))) | let is = [ (instanceSig i, getName i) | i <- cls_instances ] , (i@(_,_,cls,tys), n) <- sortBy (comparing $ first instHead) is , not $ isInstanceHidden expInfo cls tys ] -- fam_insts but with failing type fams filtered out - cleanFamInsts = [ (fi, n) | (Right fi, n) <- fam_insts ] - famInstErrs = [ errm | (Left errm, _) <- fam_insts ] + cleanFamInsts = [ (fi, n, L l r) | (Right fi, n, L l (Right r)) <- fam_insts ] + famInstErrs = [ errm | (Left errm, _, _) <- fam_insts ] in do dfs <- getDynFlags let mkBug = (text "haddock-bug:" <+>) . text @@ -105,6 +106,18 @@ attachToExportItem expInfo iface ifaceMap instIfaceMap export = ] } attachFixities e = e + -- spanName: attach the location to the name that is the same file as the instance location + spanName s (InstHead { ihdClsName = clsn }) (L instL instn) = + let s1 = getSrcSpan s + sn = if srcSpanFileName_maybe s1 == srcSpanFileName_maybe instL + then instn + else clsn + in L (getSrcSpan s) sn + -- spanName on Either + spanNameE s (Left e) _ = L (getSrcSpan s) (Left e) + spanNameE s (Right ok) linst = + let L l r = spanName s ok linst + in L l (Right r) instLookup :: (InstalledInterface -> Map.Map Name a) -> Name @@ -146,18 +159,26 @@ instHead (_, _, cls, args) argCount :: Type -> Int argCount (AppTy t _) = argCount t + 1 argCount (TyConApp _ ts) = length ts -argCount (FunTy _ _ ) = 2 +argCount (ForAllTy (Anon _) _ ) = 2 argCount (ForAllTy _ t) = argCount t +argCount (CastTy t _) = argCount t argCount _ = 0 simplify :: Type -> SimpleType +simplify (ForAllTy (Anon t1) t2) = SimpleType funTyConName [simplify t1, simplify t2] simplify (ForAllTy _ t) = simplify t -simplify (FunTy t1 t2) = SimpleType funTyConName [simplify t1, simplify t2] -simplify (AppTy t1 t2) = SimpleType s (ts ++ [simplify t2]) +simplify (AppTy t1 t2) = SimpleType s (ts ++ maybeToList (simplify_maybe t2)) where (SimpleType s ts) = simplify t1 simplify (TyVarTy v) = SimpleType (tyVarName v) [] -simplify (TyConApp tc ts) = SimpleType (tyConName tc) (map simplify ts) +simplify (TyConApp tc ts) = SimpleType (tyConName tc) + (mapMaybe simplify_maybe ts) simplify (LitTy l) = SimpleTyLit l +simplify (CastTy ty _) = simplify ty +simplify (CoercionTy _) = error "simplify:Coercion" + +simplify_maybe :: Type -> Maybe SimpleType +simplify_maybe (CoercionTy {}) = Nothing +simplify_maybe ty = Just (simplify ty) -- Used for sorting instFam :: FamInst -> ([Int], Name, [SimpleType], Int, SimpleType) @@ -207,9 +228,10 @@ isTypeHidden expInfo = typeHidden TyVarTy {} -> False AppTy t1 t2 -> typeHidden t1 || typeHidden t2 TyConApp tcon args -> nameHidden (getName tcon) || any typeHidden args - FunTy t1 t2 -> typeHidden t1 || typeHidden t2 - ForAllTy _ ty -> typeHidden ty + ForAllTy bndr ty -> typeHidden (binderType bndr) || typeHidden ty LitTy _ -> False + CastTy ty _ -> typeHidden ty + CoercionTy {} -> False nameHidden :: Name -> Bool nameHidden = isNameHidden expInfo diff --git a/haddock-api/src/Haddock/Interface/Create.hs b/haddock-api/src/Haddock/Interface/Create.hs index 9ef3d1b1..c41946f5 100644 --- a/haddock-api/src/Haddock/Interface/Create.hs +++ b/haddock-api/src/Haddock/Interface/Create.hs @@ -21,6 +21,9 @@ import Haddock.GhcUtils import Haddock.Utils import Haddock.Convert import Haddock.Interface.LexParseRn +import Haddock.Backends.Hyperlinker.Types +import Haddock.Backends.Hyperlinker.Ast as Hyperlinker +import Haddock.Backends.Hyperlinker.Parser as Hyperlinker import qualified Data.Map as M import Data.Map (Map) @@ -45,7 +48,9 @@ import Bag import RdrName import TcRnTypes import FastString (concatFS) +import BasicTypes ( StringLiteral(..) ) import qualified Outputable as O +import HsDecls ( gadtDeclDetails,getConDetails ) -- | Use a 'TypecheckedModule' to produce an 'Interface'. -- To do this, we need access to already processed modules in the topological @@ -122,6 +127,8 @@ createInterface tm flags modMap instIfaceMap = do mkAliasMap dflags $ tm_renamed_source tm modWarn = moduleWarning dflags gre warnings + tokenizedSrc <- mkMaybeTokenizedSrc flags tm + return $! Interface { ifaceMod = mdl , ifaceOrigFilename = msHsFilePath ms @@ -145,6 +152,7 @@ createInterface tm flags modMap instIfaceMap = do , ifaceFamInstances = fam_instances , ifaceHaddockCoverage = coverage , ifaceWarningMap = warningMap + , ifaceTokenizedSrc = tokenizedSrc } mkAliasMap :: DynFlags -> Maybe RenamedSource -> M.Map Module ModuleName @@ -157,21 +165,21 @@ mkAliasMap dflags mRenamedSource = alias <- ideclAs impDecl return $ (lookupModuleDyn dflags - (fmap Module.fsToPackageKey $ - ideclPkgQual impDecl) + (fmap Module.fsToUnitId $ + fmap sl_fs $ ideclPkgQual impDecl) (case ideclName impDecl of SrcLoc.L _ name -> name), alias)) impDecls -- similar to GHC.lookupModule lookupModuleDyn :: - DynFlags -> Maybe PackageKey -> ModuleName -> Module + DynFlags -> Maybe UnitId -> ModuleName -> Module lookupModuleDyn _ (Just pkgId) mdlName = Module.mkModule pkgId mdlName lookupModuleDyn dflags Nothing mdlName = case Packages.lookupModuleInAllPackages dflags mdlName of (m,_):_ -> m - [] -> Module.mkModule Module.mainPackageKey mdlName + [] -> Module.mkModule Module.mainUnitId mdlName ------------------------------------------------------------------------------- @@ -194,8 +202,8 @@ moduleWarning dflags gre (WarnAll w) = Just $ parseWarning dflags gre w parseWarning :: DynFlags -> GlobalRdrEnv -> WarningTxt -> Doc Name parseWarning dflags gre w = force $ case w of - DeprecatedTxt _ msg -> format "Deprecated: " (concatFS $ map unLoc msg) - WarningTxt _ msg -> format "Warning: " (concatFS $ map unLoc msg) + DeprecatedTxt _ msg -> format "Deprecated: " (concatFS $ map (sl_fs . unLoc) msg) + WarningTxt _ msg -> format "Warning: " (concatFS $ map (sl_fs . unLoc) msg) where format x xs = DocWarning . DocParagraph . DocAppend (DocString x) . processDocString dflags gre $ HsDocString xs @@ -328,30 +336,30 @@ subordinates instMap decl = case decl of classSubs dd = [ (name, doc, typeDocs d) | (L _ d, doc) <- classDecls dd , name <- getMainDeclBinder d, not (isValD d) ] + dataSubs :: HsDataDefn Name -> [(Name, [HsDocString], Map Int HsDocString)] dataSubs dd = constrs ++ fields where cons = map unL $ (dd_cons dd) constrs = [ (unL cname, maybeToList $ fmap unL $ con_doc c, M.empty) - | c <- cons, cname <- con_names c ] - fields = [ (unL n, maybeToList $ fmap unL doc, M.empty) - | RecCon flds <- map con_details cons + | c <- cons, cname <- getConNames c ] + fields = [ (selectorFieldOcc n, maybeToList $ fmap unL doc, M.empty) + | RecCon flds <- map getConDetails cons , L _ (ConDeclField ns _ doc) <- (unLoc flds) - , n <- ns ] + , L _ n <- ns ] -- | Extract function argument docs from inside types. typeDocs :: HsDecl Name -> Map Int HsDocString typeDocs d = let docs = go 0 in case d of - SigD (TypeSig _ ty _) -> docs (unLoc ty) - SigD (PatSynSig _ _ req prov ty) -> - let allTys = ty : concat [ unLoc req, unLoc prov ] - in F.foldMap (docs . unLoc) allTys - ForD (ForeignImport _ ty _ _) -> docs (unLoc ty) + SigD (TypeSig _ ty) -> docs (unLoc (hsSigWcType ty)) + SigD (PatSynSig _ ty) -> docs (unLoc (hsSigType ty)) + ForD (ForeignImport _ ty _ _) -> docs (unLoc (hsSigType ty)) TyClD (SynDecl { tcdRhs = ty }) -> docs (unLoc ty) _ -> M.empty where - go n (HsForAllTy _ _ _ _ ty) = go n (unLoc ty) + go n (HsForAllTy { hst_body = ty }) = go n (unLoc ty) + go n (HsQualTy { hst_body = ty }) = go n (unLoc ty) go n (HsFunTy (L _ (HsDocTy _ (L _ x))) (L _ ty)) = M.insert n x $ go (n+1) ty go n (HsFunTy _ ty) = go (n+1) (unLoc ty) go n (HsDocTy _ (L _ doc)) = M.singleton n doc @@ -394,7 +402,7 @@ ungroup group_ = mkDecls (typesigs . hs_valds) SigD group_ ++ mkDecls (valbinds . hs_valds) ValD group_ where - typesigs (ValBindsOut _ sigs) = filter isVanillaLSig sigs + typesigs (ValBindsOut _ sigs) = filter isUserLSig sigs typesigs _ = error "expected ValBindsOut" valbinds (ValBindsOut binds _) = concatMap bagToList . snd . unzip $ binds @@ -426,7 +434,7 @@ filterDecls = filter (isHandled . unL . fst) isHandled (ForD (ForeignImport {})) = True isHandled (TyClD {}) = True isHandled (InstD {}) = True - isHandled (SigD d) = isVanillaLSig (reL d) + isHandled (SigD d) = isUserLSig (reL d) isHandled (ValD _) = True -- we keep doc declarations to be able to get at named docs isHandled (DocD _) = True @@ -439,7 +447,7 @@ filterClasses decls = [ if isClassD d then (L loc (filterClass d), doc) else x | x@(L loc d, doc) <- decls ] where filterClass (TyClD c) = - TyClD $ c { tcdSigs = filter (liftA2 (||) isVanillaLSig isMinimalLSig) $ tcdSigs c } + TyClD $ c { tcdSigs = filter (liftA2 (||) isUserLSig isMinimalLSig) $ tcdSigs c } filterClass _ = error "expected TyClD" @@ -498,7 +506,7 @@ mkExportItems lookupExport (IEVar (L _ x)) = declWith x lookupExport (IEThingAbs (L _ t)) = declWith t lookupExport (IEThingAll (L _ t)) = declWith t - lookupExport (IEThingWith (L _ t) _) = declWith t + lookupExport (IEThingWith (L _ t) _ _ _) = declWith t lookupExport (IEModuleContents (L _ m)) = moduleExports thisMod m dflags warnings gre exportedNames decls modMap instIfaceMap maps fixMap splices lookupExport (IEGroup lev docStr) = return $ @@ -517,7 +525,7 @@ mkExportItems case findDecl t of ([L l (ValD _)], (doc, _)) -> do -- Top-level binding without type signature - export <- hiValExportItem dflags t doc (l `elem` splices) $ M.lookup t fixMap + export <- hiValExportItem dflags t l doc (l `elem` splices) $ M.lookup t fixMap return [export] (ds, docs_) | decl : _ <- filter (not . isValD . unLoc) ds -> let declNames = getMainDeclBinder (unL decl) @@ -553,7 +561,7 @@ mkExportItems L loc (TyClD cl@ClassDecl{}) -> do mdef <- liftGhcToErrMsgGhc $ minimalDef t - let sig = maybeToList $ fmap (noLoc . MinimalSig mempty . fmap noLoc) mdef + let sig = maybeToList $ fmap (noLoc . MinimalSig mempty . noLoc . fmap noLoc) mdef return [ mkExportDecl t (L loc $ TyClD cl { tcdSigs = sig ++ tcdSigs cl }) docs_ ] @@ -620,13 +628,19 @@ hiDecl dflags t = do O.text "-- Please report this on Haddock issue tracker!" bugWarn = O.showSDoc dflags . warnLine -hiValExportItem :: DynFlags -> Name -> DocForDecl Name -> Bool -> Maybe Fixity -> ErrMsgGhc (ExportItem Name) -hiValExportItem dflags name doc splice fixity = do +-- | This function is called for top-level bindings without type signatures. +-- It gets the type signature from GHC and that means it's not going to +-- have a meaningful 'SrcSpan'. So we pass down 'SrcSpan' for the +-- declaration and use it instead - 'nLoc' here. +hiValExportItem :: DynFlags -> Name -> SrcSpan -> DocForDecl Name -> Bool + -> Maybe Fixity -> ErrMsgGhc (ExportItem Name) +hiValExportItem dflags name nLoc doc splice fixity = do mayDecl <- hiDecl dflags name case mayDecl of Nothing -> return (ExportNoDecl name []) - Just decl -> return (ExportDecl decl doc [] [] fixities splice) + Just decl -> return (ExportDecl (fixSpan decl) doc [] [] fixities splice) where + fixSpan (L l t) = L (SrcLoc.combineSrcSpans l nLoc) t fixities = case fixity of Just f -> [(name, f)] Nothing -> [] @@ -689,8 +703,8 @@ moduleExports thisMod expMod dflags warnings gre _exports decls ifaceMap instIfa "documentation for exported module: " ++ pretty dflags expMod] return [] where - m = mkModule packageKey expMod - packageKey = modulePackageKey thisMod + m = mkModule unitId expMod + unitId = moduleUnitId thisMod -- Note [1]: @@ -724,8 +738,8 @@ fullModuleContents dflags warnings gre (docMap, argMap, subMap, declMap, instMap expandSig = foldr f [] where f :: LHsDecl name -> [LHsDecl name] -> [LHsDecl name] - f (L l (SigD (TypeSig names t nwcs))) xs = foldr (\n acc -> L l (SigD (TypeSig [n] t nwcs)) : acc) xs names - f (L l (SigD (GenericSig names t))) xs = foldr (\n acc -> L l (SigD (GenericSig [n] t)) : acc) xs names + f (L l (SigD (TypeSig names t))) xs = foldr (\n acc -> L l (SigD (TypeSig [n] t)) : acc) xs names + f (L l (SigD (ClassOpSig b names t))) xs = foldr (\n acc -> L l (SigD (ClassOpSig b [n] t)) : acc) xs names f x xs = x : xs mkExportItem :: LHsDecl Name -> ErrMsgGhc (Maybe (ExportItem Name)) @@ -737,7 +751,7 @@ fullModuleContents dflags warnings gre (docMap, argMap, subMap, declMap, instMap | name:_ <- collectHsBindBinders d, Just [L _ (ValD _)] <- M.lookup name declMap = -- Top-level binding without type signature. let (doc, _) = lookupDocs name warnings docMap argMap subMap in - fmap Just (hiValExportItem dflags name doc (l `elem` splices) $ M.lookup name fixMap) + fmap Just (hiValExportItem dflags name l doc (l `elem` splices) $ M.lookup name fixMap) | otherwise = return Nothing mkExportItem decl@(L l (InstD d)) | Just name <- M.lookup (getInstLoc d) instMap = @@ -745,7 +759,7 @@ fullModuleContents dflags warnings gre (docMap, argMap, subMap, declMap, instMap return $ Just (ExportDecl decl doc subs [] (fixities name subs) (l `elem` splices)) mkExportItem (L l (TyClD cl@ClassDecl{ tcdLName = L _ name, tcdSigs = sigs })) = do mdef <- liftGhcToErrMsgGhc $ minimalDef name - let sig = maybeToList $ fmap (noLoc . MinimalSig mempty . fmap noLoc) mdef + let sig = maybeToList $ fmap (noLoc . MinimalSig mempty . noLoc . fmap noLoc) mdef expDecl (L l (TyClD cl { tcdSigs = sig ++ sigs })) l name mkExportItem decl@(L l d) | name:_ <- getMainDeclBinder d = expDecl decl l name @@ -769,64 +783,49 @@ extractDecl name mdl decl case unLoc decl of TyClD d@ClassDecl {} -> let matches = [ sig | sig <- tcdSigs d, name `elem` sigName sig, - isVanillaLSig sig ] -- TODO: document fixity + isTypeLSig sig ] -- TODO: document fixity in case matches of - [s0] -> let (n, tyvar_names) = (tcdName d, getTyVars d) - L pos sig = extractClassDecl n tyvar_names s0 + [s0] -> let (n, tyvar_names) = (tcdName d, tyClDeclTyVars d) + L pos sig = addClassContext n tyvar_names s0 in L pos (SigD sig) _ -> error "internal: extractDecl (ClassDecl)" TyClD d@DataDecl {} -> - let (n, tyvar_names) = (tcdName d, map toTypeNoLoc $ getTyVars d) - in SigD <$> extractRecSel name mdl n tyvar_names (dd_cons (tcdDataDefn d)) + let (n, tyvar_tys) = (tcdName d, lHsQTyVarsToTypes (tyClDeclTyVars d)) + in SigD <$> extractRecSel name mdl n tyvar_tys (dd_cons (tcdDataDefn d)) InstD (DataFamInstD DataFamInstDecl { dfid_tycon = L _ n - , dfid_pats = HsWB { hswb_cts = tys } + , dfid_pats = HsIB { hsib_body = tys } , dfid_defn = defn }) -> SigD <$> extractRecSel name mdl n tys (dd_cons defn) InstD (ClsInstD ClsInstDecl { cid_datafam_insts = insts }) -> let matches = [ d | L _ d <- insts - , L _ ConDecl { con_details = RecCon rec } <- dd_cons (dfid_defn d) + -- , L _ ConDecl { con_details = RecCon rec } <- dd_cons (dfid_defn d) + , RecCon rec <- map (getConDetails . unLoc) (dd_cons (dfid_defn d)) , ConDeclField { cd_fld_names = ns } <- map unLoc (unLoc rec) , L _ n <- ns - , n == name + , selectorFieldOcc n == name ] in case matches of [d0] -> extractDecl name mdl (noLoc . InstD $ DataFamInstD d0) _ -> error "internal: extractDecl (ClsInstD)" _ -> error "internal: extractDecl" - where - getTyVars = hsLTyVarLocNames . tyClDeclTyVars - - -toTypeNoLoc :: Located Name -> LHsType Name -toTypeNoLoc = noLoc . HsTyVar . unLoc - - -extractClassDecl :: Name -> [Located Name] -> LSig Name -> LSig Name -extractClassDecl c tvs0 (L pos (TypeSig lname ltype _)) = case ltype of - L _ (HsForAllTy expl _ tvs (L _ preds) ty) -> - L pos (TypeSig lname (noLoc (HsForAllTy expl Nothing tvs (lctxt preds) ty)) []) - _ -> L pos (TypeSig lname (noLoc (HsForAllTy Implicit Nothing emptyHsQTvs (lctxt []) ltype)) []) - where - lctxt = noLoc . ctxt - ctxt preds = nlHsTyConApp c (map toTypeNoLoc tvs0) : preds -extractClassDecl _ _ _ = error "extractClassDecl: unexpected decl" - extractRecSel :: Name -> Module -> Name -> [LHsType Name] -> [LConDecl Name] -> LSig Name extractRecSel _ _ _ _ [] = error "extractRecSel: selector not found" extractRecSel nm mdl t tvs (L _ con : rest) = - case con_details con of - RecCon (L _ fields) | ((n,L _ (ConDeclField _nn ty _)) : _) <- matching_fields fields -> - L (getLoc n) (TypeSig [noLoc nm] (noLoc (HsFunTy data_ty (getBangType ty))) []) + case getConDetails con of + RecCon (L _ fields) | ((l,L _ (ConDeclField _nn ty _)) : _) <- matching_fields fields -> + L l (TypeSig [noLoc nm] (mkEmptySigWcType (noLoc (HsFunTy data_ty (getBangType ty))))) _ -> extractRecSel nm mdl t tvs rest where - matching_fields flds = [ (n,f) | f@(L _ (ConDeclField ns _ _)) <- flds, n <- ns, unLoc n == nm ] + matching_fields :: [LConDeclField Name] -> [(SrcSpan, LConDeclField Name)] + matching_fields flds = [ (l,f) | f@(L _ (ConDeclField ns _ _)) <- flds + , L l n <- ns, selectorFieldOcc n == nm ] data_ty - | ResTyGADT _ ty <- con_res con = ty - | otherwise = foldl' (\x y -> noLoc (HsAppTy x y)) (noLoc (HsTyVar t)) tvs - + -- | ResTyGADT _ ty <- con_res con = ty + | ConDeclGADT{} <- con = hsib_body $ con_type con + | otherwise = foldl' (\x y -> noLoc (HsAppTy x y)) (noLoc (HsTyVar (noLoc t))) tvs -- | Keep export items with docs. pruneExportItems :: [ExportItem Name] -> [ExportItem Name] @@ -855,6 +854,30 @@ seqList :: [a] -> () seqList [] = () seqList (x : xs) = x `seq` seqList xs +mkMaybeTokenizedSrc :: [Flag] -> TypecheckedModule + -> ErrMsgGhc (Maybe [RichToken]) +mkMaybeTokenizedSrc flags tm + | Flag_HyperlinkedSource `elem` flags = case renamedSource tm of + Just src -> do + tokens <- liftGhcToErrMsgGhc . liftIO $ mkTokenizedSrc summary src + return $ Just tokens + Nothing -> do + liftErrMsg . tell . pure $ concat + [ "Warning: Cannot hyperlink module \"" + , moduleNameString . ms_mod_name $ summary + , "\" because renamed source is not available" + ] + return Nothing + | otherwise = return Nothing + where + summary = pm_mod_summary . tm_parsed_module $ tm + +mkTokenizedSrc :: ModSummary -> RenamedSource -> IO [RichToken] +mkTokenizedSrc ms src = + Hyperlinker.enrich src . Hyperlinker.parse <$> rawSrc + where + rawSrc = readFile $ msHsFilePath ms + -- | Find a stand-alone documentation comment by its name. findNamedDoc :: String -> [HsDecl Name] -> ErrMsgM (Maybe HsDocString) findNamedDoc name = search diff --git a/haddock-api/src/Haddock/Interface/LexParseRn.hs b/haddock-api/src/Haddock/Interface/LexParseRn.hs index ac823da3..3c14498c 100644 --- a/haddock-api/src/Haddock/Interface/LexParseRn.hs +++ b/haddock-api/src/Haddock/Interface/LexParseRn.hs @@ -18,20 +18,20 @@ module Haddock.Interface.LexParseRn , processModuleHeader ) where -import Control.Applicative import Data.IntSet (toList) import Data.List import Documentation.Haddock.Doc (metaDocConcat) -import DynFlags (ExtensionFlag(..), languageExtensions) +import DynFlags (languageExtensions) +import qualified GHC.LanguageExtensions as LangExt import FastString import GHC import Haddock.Interface.ParseModuleHeader import Haddock.Parser import Haddock.Types import Name -import RdrHsSyn ( setRdrNameSpace ) import Outputable ( showPpr ) import RdrName +import RnEnv (dataTcOccs) processDocStrings :: DynFlags -> GlobalRdrEnv -> [HsDocString] -> Maybe (MDoc Name) @@ -65,7 +65,7 @@ processModuleHeader dflags gre safety mayStr = do doc' = overDoc (rename dflags gre) doc return (hmi', Just doc') - let flags :: [ExtensionFlag] + let flags :: [LangExt.Extension] -- We remove the flags implied by the language setting and we display the language instead flags = map toEnum (toList $ extensionFlags dflags) \\ languageExtensions (language dflags) return (hmi { hmi_safety = Just $ showPpr dflags safety @@ -75,7 +75,13 @@ processModuleHeader dflags gre safety mayStr = do where failure = (emptyHaddockModInfo, Nothing) - +-- | Takes a 'GlobalRdrEnv' which (hopefully) contains all the +-- definitions and a parsed comment and we attempt to make sense of +-- where the identifiers in the comment point to. We're in effect +-- trying to convert 'RdrName's to 'Name's, with some guesswork and +-- fallbacks in case we can't locate the identifiers. +-- +-- See the comments in the source for implementation commentary. rename :: DynFlags -> GlobalRdrEnv -> Doc RdrName -> Doc Name rename dflags gre = rn where @@ -83,19 +89,36 @@ rename dflags gre = rn DocAppend a b -> DocAppend (rn a) (rn b) DocParagraph doc -> DocParagraph (rn doc) DocIdentifier x -> do - let choices = dataTcOccs' x + -- Generate the choices for the possible kind of thing this + -- is. + let choices = dataTcOccs x + -- Try to look up all the names in the GlobalRdrEnv that match + -- the names. let names = concatMap (\c -> map gre_name (lookupGRE_RdrName c gre)) choices + case names of + -- We found no names in the env so we start guessing. [] -> case choices of [] -> DocMonospaced (DocString (showPpr dflags x)) - [a] -> outOfScope dflags a - a:b:_ | isRdrTc a -> outOfScope dflags a - | otherwise -> outOfScope dflags b + -- There was nothing in the environment so we need to + -- pick some default from what's available to us. We + -- diverge here from the old way where we would default + -- to type constructors as we're much more likely to + -- actually want anchors to regular definitions than + -- type constructor names (such as in #253). So now we + -- only get type constructor links if they are actually + -- in scope. + a:_ -> outOfScope dflags a + + -- There is only one name in the environment that matches so + -- use it. [a] -> DocIdentifier a - a:b:_ | isTyConName a -> DocIdentifier a | otherwise -> DocIdentifier b - -- If an id can refer to multiple things, we give precedence to type - -- constructors. + -- But when there are multiple names available, default to + -- type constructors: somewhat awfully GHC returns the + -- values in the list positionally. + a:b:_ | isTyConName a -> DocIdentifier a + | otherwise -> DocIdentifier b DocWarning doc -> DocWarning (rn doc) DocEmphasis doc -> DocEmphasis (rn doc) @@ -116,21 +139,14 @@ rename dflags gre = rn DocString str -> DocString str DocHeader (Header l t) -> DocHeader $ Header l (rn t) -dataTcOccs' :: RdrName -> [RdrName] --- If the input is a data constructor, return both it and a type --- constructor. This is useful when we aren't sure which we are --- looking at. --- --- We use this definition instead of the GHC's to provide proper linking to --- functions accross modules. See ticket #253 on Haddock Trac. -dataTcOccs' rdr_name - | isDataOcc occ = [rdr_name, rdr_name_tc] - | otherwise = [rdr_name] - where - occ = rdrNameOcc rdr_name - rdr_name_tc = setRdrNameSpace rdr_name tcName - - +-- | Wrap an identifier that's out of scope (i.e. wasn't found in +-- 'GlobalReaderEnv' during 'rename') in an appropriate doc. Currently +-- we simply monospace the identifier in most cases except when the +-- identifier is qualified: if the identifier is qualified then we can +-- still try to guess and generate anchors accross modules but the +-- users shouldn't rely on this doing the right thing. See tickets +-- #253 and #375 on the confusion this causes depending on which +-- default we pick in 'rename'. outOfScope :: DynFlags -> RdrName -> Doc a outOfScope dflags x = case x of diff --git a/haddock-api/src/Haddock/Interface/ParseModuleHeader.hs b/haddock-api/src/Haddock/Interface/ParseModuleHeader.hs index d92e8b2a..e7d2a085 100644 --- a/haddock-api/src/Haddock/Interface/ParseModuleHeader.hs +++ b/haddock-api/src/Haddock/Interface/ParseModuleHeader.hs @@ -11,7 +11,6 @@ ----------------------------------------------------------------------------- module Haddock.Interface.ParseModuleHeader (parseModuleHeader) where -import Control.Applicative ((<$>)) import Control.Monad (mplus) import Data.Char import DynFlags diff --git a/haddock-api/src/Haddock/Interface/Rename.hs b/haddock-api/src/Haddock/Interface/Rename.hs index 56e5b07f..2478ce23 100644 --- a/haddock-api/src/Haddock/Interface/Rename.hs +++ b/haddock-api/src/Haddock/Interface/Rename.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE RecordWildCards #-} ---------------------------------------------------------------------------- -- | -- Module : Haddock.Interface.Rename @@ -13,7 +13,7 @@ module Haddock.Interface.Rename (renameInterface) where -import Data.Traversable (traverse, Traversable) +import Data.Traversable (mapM) import Haddock.GhcUtils import Haddock.Types @@ -21,14 +21,11 @@ import Haddock.Types import Bag (emptyBag) import GHC hiding (NoLink) import Name -import NameSet -import Coercion import Control.Applicative import Control.Monad hiding (mapM) import Data.List import qualified Data.Map as Map hiding ( Map ) -import Data.Traversable (mapM) import Prelude hiding (mapM) @@ -94,13 +91,13 @@ newtype RnM a = instance Monad RnM where (>>=) = thenRn - return = returnRn + return = pure instance Functor RnM where fmap f x = do a <- x; return (f a) instance Applicative RnM where - pure = return + pure = returnRn (<*>) = ap returnRn :: a -> RnM a @@ -173,22 +170,51 @@ renameFnArgsDoc = mapM renameDoc renameLType :: LHsType Name -> RnM (LHsType DocName) renameLType = mapM renameType +renameLSigType :: LHsSigType Name -> RnM (LHsSigType DocName) +renameLSigType = renameImplicit renameLType + +renameLSigWcType :: LHsSigWcType Name -> RnM (LHsSigWcType DocName) +renameLSigWcType = renameImplicit (renameWc renameLType) + renameLKind :: LHsKind Name -> RnM (LHsKind DocName) renameLKind = renameLType renameMaybeLKind :: Maybe (LHsKind Name) -> RnM (Maybe (LHsKind DocName)) renameMaybeLKind = traverse renameLKind +renameFamilyResultSig :: LFamilyResultSig Name -> RnM (LFamilyResultSig DocName) +renameFamilyResultSig (L loc NoSig) + = return (L loc NoSig) +renameFamilyResultSig (L loc (KindSig ki)) + = do { ki' <- renameLKind ki + ; return (L loc (KindSig ki')) } +renameFamilyResultSig (L loc (TyVarSig bndr)) + = do { bndr' <- renameLTyVarBndr bndr + ; return (L loc (TyVarSig bndr')) } + +renameInjectivityAnn :: LInjectivityAnn Name -> RnM (LInjectivityAnn DocName) +renameInjectivityAnn (L loc (InjectivityAnn lhs rhs)) + = do { lhs' <- renameL lhs + ; rhs' <- mapM renameL rhs + ; return (L loc (InjectivityAnn lhs' rhs')) } + +renameMaybeInjectivityAnn :: Maybe (LInjectivityAnn Name) + -> RnM (Maybe (LInjectivityAnn DocName)) +renameMaybeInjectivityAnn = traverse renameInjectivityAnn renameType :: HsType Name -> RnM (HsType DocName) renameType t = case t of - HsForAllTy expl extra tyvars lcontext ltype -> do - tyvars' <- renameLTyVarBndrs tyvars + HsForAllTy { hst_bndrs = tyvars, hst_body = ltype } -> do + tyvars' <- mapM renameLTyVarBndr tyvars + ltype' <- renameLType ltype + return (HsForAllTy { hst_bndrs = tyvars', hst_body = ltype' }) + + HsQualTy { hst_ctxt = lcontext , hst_body = ltype } -> do lcontext' <- renameLContext lcontext ltype' <- renameLType ltype - return (HsForAllTy expl extra tyvars' lcontext' ltype') + return (HsQualTy { hst_ctxt = lcontext', hst_body = ltype' }) - HsTyVar n -> return . HsTyVar =<< rename n + HsTyVar (L l n) -> return . HsTyVar . L l =<< rename n HsBangTy b ltype -> return . HsBangTy b =<< renameLType ltype HsAppTy a b -> do @@ -208,11 +234,11 @@ renameType t = case t of HsTupleTy b ts -> return . HsTupleTy b =<< mapM renameLType ts - HsOpTy a (w, L loc op) b -> do + HsOpTy a (L loc op) b -> do op' <- rename op a' <- renameLType a b' <- renameLType b - return (HsOpTy a' (w, L loc op') b') + return (HsOpTy a' (L loc op') b') HsParTy ty -> return . HsParTy =<< renameLType ty @@ -228,25 +254,24 @@ renameType t = case t of HsTyLit x -> return (HsTyLit x) - HsWrapTy a b -> HsWrapTy a <$> renameType b HsRecTy a -> HsRecTy <$> mapM renameConDeclFieldField a HsCoreTy a -> pure (HsCoreTy a) HsExplicitListTy a b -> HsExplicitListTy a <$> mapM renameLType b HsExplicitTupleTy a b -> HsExplicitTupleTy a <$> mapM renameLType b HsSpliceTy _ _ -> error "renameType: HsSpliceTy" - HsWildcardTy -> pure HsWildcardTy - HsNamedWildcardTy a -> HsNamedWildcardTy <$> rename a + HsWildCardTy a -> HsWildCardTy <$> renameWildCardInfo a + HsAppsTy _ -> error "renameType: HsAppsTy" -renameLTyVarBndrs :: LHsTyVarBndrs Name -> RnM (LHsTyVarBndrs DocName) -renameLTyVarBndrs (HsQTvs { hsq_kvs = _, hsq_tvs = tvs }) +renameLHsQTyVars :: LHsQTyVars Name -> RnM (LHsQTyVars DocName) +renameLHsQTyVars (HsQTvs { hsq_implicit = _, hsq_explicit = tvs }) = do { tvs' <- mapM renameLTyVarBndr tvs - ; return (HsQTvs { hsq_kvs = error "haddock:renameLTyVarBndrs", hsq_tvs = tvs' }) } + ; return (HsQTvs { hsq_implicit = error "haddock:renameLHsQTyVars", hsq_explicit = tvs' }) } -- This is rather bogus, but I'm not sure what else to do renameLTyVarBndr :: LHsTyVarBndr Name -> RnM (LHsTyVarBndr DocName) -renameLTyVarBndr (L loc (UserTyVar n)) +renameLTyVarBndr (L loc (UserTyVar (L l n))) = do { n' <- rename n - ; return (L loc (UserTyVar n')) } + ; return (L loc (UserTyVar (L l n'))) } renameLTyVarBndr (L loc (KindedTyVar (L lv n) kind)) = do { n' <- rename n ; kind' <- renameLKind kind @@ -257,17 +282,29 @@ renameLContext (L loc context) = do context' <- mapM renameLType context return (L loc context') +renameWildCardInfo :: HsWildCardInfo Name -> RnM (HsWildCardInfo DocName) +renameWildCardInfo (AnonWildCard (L l name)) = AnonWildCard . L l <$> rename name +renameWildCardInfo (NamedWildCard (L l name)) = NamedWildCard . L l <$> rename name + renameInstHead :: InstHead Name -> RnM (InstHead DocName) -renameInstHead (className, k, types, rest) = do - className' <- rename className - k' <- mapM renameType k - types' <- mapM renameType types - rest' <- case rest of - ClassInst cs -> ClassInst <$> mapM renameType cs +renameInstHead InstHead {..} = do + cname <- rename ihdClsName + kinds <- mapM renameType ihdKinds + types <- mapM renameType ihdTypes + itype <- case ihdInstType of + ClassInst { .. } -> ClassInst + <$> mapM renameType clsiCtx + <*> renameLHsQTyVars clsiTyVars + <*> mapM renameSig clsiSigs + <*> mapM renamePseudoFamilyDecl clsiAssocTys TypeInst ts -> TypeInst <$> traverse renameType ts DataInst dd -> DataInst <$> renameTyClD dd - return (className', k', types', rest') - + return InstHead + { ihdClsName = cname + , ihdKinds = kinds + , ihdTypes = types + , ihdInstType = itype + } renameLDecl :: LHsDecl Name -> RnM (LHsDecl DocName) renameLDecl (L loc d) = return . L loc =<< renameDecl d @@ -301,13 +338,13 @@ renameTyClD d = case d of SynDecl { tcdLName = lname, tcdTyVars = tyvars, tcdRhs = rhs, tcdFVs = _fvs } -> do lname' <- renameL lname - tyvars' <- renameLTyVarBndrs tyvars + tyvars' <- renameLHsQTyVars tyvars rhs' <- renameLType rhs return (SynDecl { tcdLName = lname', tcdTyVars = tyvars', tcdRhs = rhs', tcdFVs = placeHolderNames }) DataDecl { tcdLName = lname, tcdTyVars = tyvars, tcdDataDefn = defn, tcdFVs = _fvs } -> do lname' <- renameL lname - tyvars' <- renameLTyVarBndrs tyvars + tyvars' <- renameLHsQTyVars tyvars defn' <- renameDataDefn defn return (DataDecl { tcdLName = lname', tcdTyVars = tyvars', tcdDataDefn = defn', tcdFVs = placeHolderNames }) @@ -315,7 +352,7 @@ renameTyClD d = case d of , tcdFDs = lfundeps, tcdSigs = lsigs, tcdATs = ats, tcdATDefs = at_defs } -> do lcontext' <- renameLContext lcontext lname' <- renameL lname - ltyvars' <- renameLTyVarBndrs ltyvars + ltyvars' <- renameLHsQTyVars ltyvars lfundeps' <- mapM renameLFunDep lfundeps lsigs' <- mapM renameLSig lsigs ats' <- mapM (renameLThing renameFamilyDecl) ats @@ -335,13 +372,26 @@ renameTyClD d = case d of renameFamilyDecl :: FamilyDecl Name -> RnM (FamilyDecl DocName) renameFamilyDecl (FamilyDecl { fdInfo = info, fdLName = lname - , fdTyVars = ltyvars, fdKindSig = tckind }) = do - info' <- renameFamilyInfo info - lname' <- renameL lname - ltyvars' <- renameLTyVarBndrs ltyvars - tckind' <- renameMaybeLKind tckind + , fdTyVars = ltyvars, fdResultSig = result + , fdInjectivityAnn = injectivity }) = do + info' <- renameFamilyInfo info + lname' <- renameL lname + ltyvars' <- renameLHsQTyVars ltyvars + result' <- renameFamilyResultSig result + injectivity' <- renameMaybeInjectivityAnn injectivity return (FamilyDecl { fdInfo = info', fdLName = lname' - , fdTyVars = ltyvars', fdKindSig = tckind' }) + , fdTyVars = ltyvars', fdResultSig = result' + , fdInjectivityAnn = injectivity' }) + + +renamePseudoFamilyDecl :: PseudoFamilyDecl Name + -> RnM (PseudoFamilyDecl DocName) +renamePseudoFamilyDecl (PseudoFamilyDecl { .. }) = PseudoFamilyDecl + <$> renameFamilyInfo pfdInfo + <*> renameL pfdLName + <*> mapM renameLType pfdTyVars + <*> renameFamilyResultSig pfdKindSig + renameFamilyInfo :: FamilyInfo Name -> RnM (FamilyInfo DocName) renameFamilyInfo DataFamily = return DataFamily @@ -361,17 +411,16 @@ renameDataDefn (HsDataDefn { dd_ND = nd, dd_ctxt = lcontext, dd_cType = cType , dd_kindSig = k', dd_cons = cons', dd_derivs = Nothing }) renameCon :: ConDecl Name -> RnM (ConDecl DocName) -renameCon decl@(ConDecl { con_names = lnames, con_qvars = ltyvars - , con_cxt = lcontext, con_details = details - , con_res = restype, con_doc = mbldoc }) = do - lnames' <- mapM renameL lnames - ltyvars' <- renameLTyVarBndrs ltyvars - lcontext' <- renameLContext lcontext +renameCon decl@(ConDeclH98 { con_name = lname, con_qvars = ltyvars + , con_cxt = lcontext, con_details = details + , con_doc = mbldoc }) = do + lname' <- renameL lname + ltyvars' <- traverse renameLHsQTyVars ltyvars + lcontext' <- traverse renameLContext lcontext details' <- renameDetails details - restype' <- renameResType restype mbldoc' <- mapM renameLDocHsSyn mbldoc - return (decl { con_names = lnames', con_qvars = ltyvars', con_cxt = lcontext' - , con_details = details', con_res = restype', con_doc = mbldoc' }) + return (decl { con_name = lname', con_qvars = ltyvars', con_cxt = lcontext' + , con_details = details', con_doc = mbldoc' }) where renameDetails (RecCon (L l fields)) = do @@ -383,35 +432,47 @@ renameCon decl@(ConDecl { con_names = lnames, con_qvars = ltyvars b' <- renameLType b return (InfixCon a' b') - renameResType (ResTyH98) = return ResTyH98 - renameResType (ResTyGADT l t) = return . ResTyGADT l =<< renameLType t - +renameCon decl@(ConDeclGADT { con_names = lnames + , con_type = lty + , con_doc = mbldoc }) = do + lnames' <- mapM renameL lnames + lty' <- renameLSigType lty + mbldoc' <- mapM renameLDocHsSyn mbldoc + return (decl { con_names = lnames' + , con_type = lty', con_doc = mbldoc' }) renameConDeclFieldField :: LConDeclField Name -> RnM (LConDeclField DocName) renameConDeclFieldField (L l (ConDeclField names t doc)) = do - names' <- mapM renameL names + names' <- mapM renameLFieldOcc names t' <- renameLType t doc' <- mapM renameLDocHsSyn doc return $ L l (ConDeclField names' t' doc') +renameLFieldOcc :: LFieldOcc Name -> RnM (LFieldOcc DocName) +renameLFieldOcc (L l (FieldOcc lbl sel)) = do + sel' <- rename sel + return $ L l (FieldOcc lbl sel') renameSig :: Sig Name -> RnM (Sig DocName) renameSig sig = case sig of - TypeSig lnames ltype _ -> do + TypeSig lnames ltype -> do lnames' <- mapM renameL lnames - ltype' <- renameLType ltype - return (TypeSig lnames' ltype' PlaceHolder) - PatSynSig lname (flag, qtvs) lreq lprov lty -> do + ltype' <- renameLSigWcType ltype + return (TypeSig lnames' ltype') + ClassOpSig is_default lnames sig_ty -> do + lnames' <- mapM renameL lnames + ltype' <- renameLSigType sig_ty + return (ClassOpSig is_default lnames' ltype') + PatSynSig lname sig_ty -> do lname' <- renameL lname - qtvs' <- renameLTyVarBndrs qtvs - lreq' <- renameLContext lreq - lprov' <- renameLContext lprov - lty' <- renameLType lty - return $ PatSynSig lname' (flag, qtvs') lreq' lprov' lty' + sig_ty' <- renameLSigType sig_ty + return $ PatSynSig lname' sig_ty' FixSig (FixitySig lnames fixity) -> do lnames' <- mapM renameL lnames return $ FixSig (FixitySig lnames' fixity) - MinimalSig src s -> MinimalSig src <$> traverse renameL s + MinimalSig src (L l s) -> do + s' <- traverse renameL s + return $ MinimalSig src (L l s') -- we have filtered out all other kinds of signatures in Interface.Create _ -> error "expected TypeSig" @@ -419,11 +480,11 @@ renameSig sig = case sig of renameForD :: ForeignDecl Name -> RnM (ForeignDecl DocName) renameForD (ForeignImport lname ltype co x) = do lname' <- renameL lname - ltype' <- renameLType ltype + ltype' <- renameLSigType ltype return (ForeignImport lname' ltype' co x) renameForD (ForeignExport lname ltype co x) = do lname' <- renameL lname - ltype' <- renameLType ltype + ltype' <- renameLSigType ltype return (ForeignExport lname' ltype' co x) @@ -442,7 +503,7 @@ renameClsInstD :: ClsInstDecl Name -> RnM (ClsInstDecl DocName) renameClsInstD (ClsInstDecl { cid_overlap_mode = omode , cid_poly_ty =ltype, cid_tyfam_insts = lATs , cid_datafam_insts = lADTs }) = do - ltype' <- renameLType ltype + ltype' <- renameLSigType ltype lATs' <- mapM (mapM renameTyFamInstD) lATs lADTs' <- mapM (mapM renameDataFamInstD) lADTs return (ClsInstDecl { cid_overlap_mode = omode @@ -458,33 +519,48 @@ renameTyFamInstD (TyFamInstDecl { tfid_eqn = eqn }) , tfid_fvs = placeHolderNames }) } renameLTyFamInstEqn :: LTyFamInstEqn Name -> RnM (LTyFamInstEqn DocName) -renameLTyFamInstEqn (L loc (TyFamEqn { tfe_tycon = tc, tfe_pats = pats_w_bndrs, tfe_rhs = rhs })) +renameLTyFamInstEqn (L loc (TyFamEqn { tfe_tycon = tc, tfe_pats = pats, tfe_rhs = rhs })) = do { tc' <- renameL tc - ; pats' <- mapM renameLType (hswb_cts pats_w_bndrs) + ; pats' <- renameImplicit (mapM renameLType) pats ; rhs' <- renameLType rhs ; return (L loc (TyFamEqn { tfe_tycon = tc' - , tfe_pats = HsWB pats' PlaceHolder PlaceHolder PlaceHolder + , tfe_pats = pats' , tfe_rhs = rhs' })) } renameLTyFamDefltEqn :: LTyFamDefltEqn Name -> RnM (LTyFamDefltEqn DocName) renameLTyFamDefltEqn (L loc (TyFamEqn { tfe_tycon = tc, tfe_pats = tvs, tfe_rhs = rhs })) - = do { tc' <- renameL tc - ; tvs' <- renameLTyVarBndrs tvs + = do { tc' <- renameL tc + ; tvs' <- renameLHsQTyVars tvs ; rhs' <- renameLType rhs ; return (L loc (TyFamEqn { tfe_tycon = tc' , tfe_pats = tvs' , tfe_rhs = rhs' })) } renameDataFamInstD :: DataFamInstDecl Name -> RnM (DataFamInstDecl DocName) -renameDataFamInstD (DataFamInstDecl { dfid_tycon = tc, dfid_pats = pats_w_bndrs, dfid_defn = defn }) +renameDataFamInstD (DataFamInstDecl { dfid_tycon = tc, dfid_pats = pats, dfid_defn = defn }) = do { tc' <- renameL tc - ; pats' <- mapM renameLType (hswb_cts pats_w_bndrs) + ; pats' <- renameImplicit (mapM renameLType) pats ; defn' <- renameDataDefn defn ; return (DataFamInstDecl { dfid_tycon = tc' - , dfid_pats - = HsWB pats' PlaceHolder PlaceHolder PlaceHolder + , dfid_pats = pats' , dfid_defn = defn', dfid_fvs = placeHolderNames }) } +renameImplicit :: (in_thing -> RnM out_thing) + -> HsImplicitBndrs Name in_thing + -> RnM (HsImplicitBndrs DocName out_thing) +renameImplicit rn_thing (HsIB { hsib_body = thing }) + = do { thing' <- rn_thing thing + ; return (HsIB { hsib_body = thing' + , hsib_vars = PlaceHolder }) } + +renameWc :: (in_thing -> RnM out_thing) + -> HsWildCardBndrs Name in_thing + -> RnM (HsWildCardBndrs DocName out_thing) +renameWc rn_thing (HsWC { hswc_body = thing }) + = do { thing' <- rn_thing thing + ; return (HsWC { hswc_body = thing' + , hswc_wcs = PlaceHolder, hswc_ctx = Nothing }) } + renameExportItem :: ExportItem Name -> RnM (ExportItem DocName) renameExportItem item = case item of ExportModule mdl -> return (ExportModule mdl) @@ -495,10 +571,11 @@ renameExportItem item = case item of decl' <- renameLDecl decl doc' <- renameDocForDecl doc subs' <- mapM renameSub subs - instances' <- forM instances $ \(inst, idoc) -> do + instances' <- forM instances $ \(inst, idoc, L l n) -> do inst' <- renameInstHead inst + n' <- rename n idoc' <- mapM renameDoc idoc - return (inst', idoc') + return (inst', idoc',L l n') fixities' <- forM fixities $ \(name, fixity) -> do name' <- lookupRn name return (name', fixity) @@ -517,12 +594,3 @@ renameSub (n,doc) = do n' <- rename n doc' <- renameDocForDecl doc return (n', doc') - -type instance PostRn DocName NameSet = PlaceHolder -type instance PostRn DocName Fixity = PlaceHolder -type instance PostRn DocName Bool = PlaceHolder -type instance PostRn DocName [Name] = PlaceHolder - -type instance PostTc DocName Kind = PlaceHolder -type instance PostTc DocName Type = PlaceHolder -type instance PostTc DocName Coercion = PlaceHolder diff --git a/haddock-api/src/Haddock/Interface/Specialize.hs b/haddock-api/src/Haddock/Interface/Specialize.hs new file mode 100644 index 00000000..ab719fe8 --- /dev/null +++ b/haddock-api/src/Haddock/Interface/Specialize.hs @@ -0,0 +1,406 @@ +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE Rank2Types #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE RecordWildCards #-} + + +module Haddock.Interface.Specialize + ( specializeInstHead + ) where + + +import Haddock.Syb +import Haddock.Types + +import GHC +import Name +import FastString + +import Control.Monad +import Control.Monad.Trans.Reader +import Control.Monad.Trans.State + +import Data.Data +import qualified Data.List as List +import Data.Maybe +import Data.Map (Map) +import qualified Data.Map as Map +import Data.Set (Set) +import qualified Data.Set as Set + + +-- | Instantiate all occurrences of given name with particular type. +specialize :: (Eq name, Typeable name) + => Data a + => name -> HsType name -> a -> a +specialize name details = + everywhere $ mkT step + where + step (HsTyVar (L _ name')) | name == name' = details + step typ = typ + + +-- | Instantiate all occurrences of given names with corresponding types. +-- +-- It is just a convenience function wrapping 'specialize' that supports more +-- that one specialization. +specialize' :: (Eq name, Typeable name) + => Data a + => [(name, HsType name)] -> a -> a +specialize' = flip $ foldr (uncurry specialize) + + +-- | Instantiate given binders with corresponding types. +-- +-- Again, it is just a convenience function around 'specialize'. Note that +-- length of type list should be the same as the number of binders. +specializeTyVarBndrs :: (Eq name, DataId name) + => Data a + => LHsQTyVars name -> [HsType name] + -> a -> a +specializeTyVarBndrs bndrs typs = + specialize' $ zip bndrs' typs + where + bndrs' = map (bname . unLoc) . hsq_explicit $ bndrs + bname (UserTyVar (L _ name)) = name + bname (KindedTyVar (L _ name) _) = name + + +specializePseudoFamilyDecl :: (Eq name, DataId name) + => LHsQTyVars name -> [HsType name] + -> PseudoFamilyDecl name + -> PseudoFamilyDecl name +specializePseudoFamilyDecl bndrs typs decl = + decl { pfdTyVars = map specializeTyVars (pfdTyVars decl) } + where + specializeTyVars = specializeTyVarBndrs bndrs typs + + +specializeSig :: forall name . (Eq name, DataId name, SetName name) + => LHsQTyVars name -> [HsType name] + -> Sig name + -> Sig name +specializeSig bndrs typs (TypeSig lnames typ) = + TypeSig lnames (typ { hsib_body = (hsib_body typ) { hswc_body = noLoc typ'}}) + where + true_type :: HsType name + true_type = unLoc (hswc_body (hsib_body typ)) + typ' :: HsType name + typ' = rename fv . sugar $ specializeTyVarBndrs bndrs typs true_type + fv = foldr Set.union Set.empty . map freeVariables $ typs +specializeSig _ _ sig = sig + + +-- | Make all details of instance head (signatures, associated types) +-- specialized to that particular instance type. +specializeInstHead :: (Eq name, DataId name, SetName name) + => InstHead name -> InstHead name +specializeInstHead ihd@InstHead { ihdInstType = clsi@ClassInst { .. }, .. } = + ihd { ihdInstType = instType' } + where + instType' = clsi + { clsiSigs = map specializeSig' clsiSigs + , clsiAssocTys = map specializeFamilyDecl' clsiAssocTys + } + specializeSig' = specializeSig clsiTyVars ihdTypes + specializeFamilyDecl' = specializePseudoFamilyDecl clsiTyVars ihdTypes +specializeInstHead ihd = ihd + + +-- | Make given type use tuple and list literals where appropriate. +-- +-- After applying 'specialize' function some terms may not use idiomatic list +-- and tuple literals resulting in types like @[] a@ or @(,,) a b c@. This +-- can be fixed using 'sugar' function, that will turn such types into @[a]@ +-- and @(a, b, c)@. +sugar :: forall name. (NamedThing name, DataId name) + => HsType name -> HsType name +sugar = + everywhere $ mkT step + where + step :: HsType name -> HsType name + step = sugarOperators . sugarTuples . sugarLists + + +sugarLists :: NamedThing name => HsType name -> HsType name +sugarLists (HsAppTy (L _ (HsTyVar (L _ name))) ltyp) + | isBuiltInSyntax name' && strName == "[]" = HsListTy ltyp + where + name' = getName name + strName = occNameString . nameOccName $ name' +sugarLists typ = typ + + +sugarTuples :: NamedThing name => HsType name -> HsType name +sugarTuples typ = + aux [] typ + where + aux apps (HsAppTy (L _ ftyp) atyp) = aux (atyp:apps) ftyp + aux apps (HsParTy (L _ typ')) = aux apps typ' + aux apps (HsTyVar (L _ name)) + | isBuiltInSyntax name' && suitable = HsTupleTy HsBoxedTuple apps + where + name' = getName name + strName = occNameString . nameOccName $ name' + suitable = case parseTupleArity strName of + Just arity -> arity == length apps + Nothing -> False + aux _ _ = typ + + +sugarOperators :: NamedThing name => HsType name -> HsType name +sugarOperators (HsAppTy (L _ (HsAppTy (L _ (HsTyVar (L l name))) la)) lb) + | isSymOcc $ getOccName name' = mkHsOpTy la (L l name) lb + | isBuiltInSyntax name' && getOccString name == "(->)" = HsFunTy la lb + where + name' = getName name +sugarOperators typ = typ + + +-- | Compute arity of given tuple operator. +-- +-- >>> parseTupleArity "(,,)" +-- Just 3 +-- +-- >>> parseTupleArity "(,,,,)" +-- Just 5 +-- +-- >>> parseTupleArity "abc" +-- Nothing +-- +-- >>> parseTupleArity "()" +-- Nothing +parseTupleArity :: String -> Maybe Int +parseTupleArity ('(':commas) = do + n <- parseCommas commas + guard $ n /= 0 + return $ n + 1 + where + parseCommas (',':rest) = (+ 1) <$> parseCommas rest + parseCommas ")" = Just 0 + parseCommas _ = Nothing +parseTupleArity _ = Nothing + + +-- | Haskell AST type representation. +-- +-- This type is used for renaming (more below), essentially the ambiguous (!) +-- version of 'Name'. So, why is this 'FastString' instead of 'OccName'? Well, +-- it was 'OccName' before, but turned out that 'OccName' sometimes also +-- contains namespace information, differentiating visually same types. +-- +-- And 'FastString' is used because it is /visual/ part of 'OccName' - it is +-- not converted to 'String' or alike to avoid new allocations. Additionally, +-- since it is stored mostly in 'Set', fast comparison of 'FastString' is also +-- quite nice. +type NameRep = FastString + +getNameRep :: NamedThing name => name -> NameRep +getNameRep = occNameFS . getOccName + +nameRepString :: NameRep -> String +nameRepString = unpackFS + +stringNameRep :: String -> NameRep +stringNameRep = mkFastString + +setInternalNameRep :: SetName name => NameRep -> name -> name +setInternalNameRep = setInternalOccName . mkVarOccFS + +setInternalOccName :: SetName name => OccName -> name -> name +setInternalOccName occ name = + setName nname' name + where + nname = getName name + nname' = mkInternalName (nameUnique nname) occ (nameSrcSpan nname) + + +-- | Compute set of free variables of given type. +freeVariables :: forall name. (NamedThing name, DataId name) + => HsType name -> Set NameRep +freeVariables = + everythingWithState Set.empty Set.union query + where + query term ctx = case cast term :: Maybe (HsType name) of + Just (HsForAllTy bndrs _) -> + (Set.empty, Set.union ctx (bndrsNames bndrs)) + Just (HsTyVar (L _ name)) + | getName name `Set.member` ctx -> (Set.empty, ctx) + | otherwise -> (Set.singleton $ getNameRep name, ctx) + _ -> (Set.empty, ctx) + bndrsNames = Set.fromList . map (getName . tyVarName . unLoc) + + +-- | Make given type visually unambiguous. +-- +-- After applying 'specialize' method, some free type variables may become +-- visually ambiguous - for example, having @a -> b@ and specializing @a@ to +-- @(a -> b)@ we get @(a -> b) -> b@ where first occurrence of @b@ refers to +-- different type variable than latter one. Applying 'rename' function +-- will fix that type to be visually unambiguous again (making it something +-- like @(a -> c) -> b@). +rename :: SetName name => Set NameRep -> HsType name -> HsType name +rename fv typ = runReader (renameType typ) $ RenameEnv + { rneFV = fv + , rneCtx = Map.empty + } + + +-- | Renaming monad. +type Rename name = Reader (RenameEnv name) + +-- | Binding generation monad. +type Rebind name = State (RenameEnv name) + +data RenameEnv name = RenameEnv + { rneFV :: Set NameRep + , rneCtx :: Map Name name + } + + +renameType :: SetName name => HsType name -> Rename name (HsType name) +renameType (HsForAllTy bndrs lt) = rebind bndrs $ \bndrs' -> + HsForAllTy + <$> pure bndrs' + <*> renameLType lt +renameType (HsQualTy lctxt lt) = + HsQualTy + <$> located renameContext lctxt + <*> renameLType lt +renameType (HsTyVar name) = HsTyVar <$> located renameName name +renameType (HsAppTy lf la) = HsAppTy <$> renameLType lf <*> renameLType la +renameType (HsFunTy la lr) = HsFunTy <$> renameLType la <*> renameLType lr +renameType (HsListTy lt) = HsListTy <$> renameLType lt +renameType (HsPArrTy lt) = HsPArrTy <$> renameLType lt +renameType (HsTupleTy srt lt) = HsTupleTy srt <$> mapM renameLType lt +renameType (HsOpTy la lop lb) = + HsOpTy <$> renameLType la <*> located renameName lop <*> renameLType lb +renameType (HsParTy lt) = HsParTy <$> renameLType lt +renameType (HsIParamTy ip lt) = HsIParamTy ip <$> renameLType lt +renameType (HsEqTy la lb) = HsEqTy <$> renameLType la <*> renameLType lb +renameType (HsKindSig lt lk) = HsKindSig <$> renameLType lt <*> pure lk +renameType t@(HsSpliceTy _ _) = pure t +renameType (HsDocTy lt doc) = HsDocTy <$> renameLType lt <*> pure doc +renameType (HsBangTy bang lt) = HsBangTy bang <$> renameLType lt +renameType t@(HsRecTy _) = pure t +renameType t@(HsCoreTy _) = pure t +renameType (HsExplicitListTy ph ltys) = + HsExplicitListTy ph <$> renameLTypes ltys +renameType (HsExplicitTupleTy phs ltys) = + HsExplicitTupleTy phs <$> renameLTypes ltys +renameType t@(HsTyLit _) = pure t +renameType (HsWildCardTy wc) = pure (HsWildCardTy wc) +renameType (HsAppsTy _) = error "HsAppsTy: Only used before renaming" + + +renameLType :: SetName name => LHsType name -> Rename name (LHsType name) +renameLType = located renameType + + +renameLTypes :: SetName name => [LHsType name] -> Rename name [LHsType name] +renameLTypes = mapM renameLType + + +renameContext :: SetName name => HsContext name -> Rename name (HsContext name) +renameContext = renameLTypes + +{- +renameLTyOp :: SetName name => LHsTyOp name -> Rename name (LHsTyOp name) +renameLTyOp (wrap, lname) = (,) wrap <$> located renameName lname +-} + + +renameName :: SetName name => name -> Rename name name +renameName name = do + RenameEnv { rneCtx = ctx } <- ask + pure $ fromMaybe name (Map.lookup (getName name) ctx) + + +rebind :: SetName name + => [LHsTyVarBndr name] -> ([LHsTyVarBndr name] -> Rename name a) + -> Rename name a +rebind lbndrs action = do + (lbndrs', env') <- runState (rebindLTyVarBndrs lbndrs) <$> ask + local (const env') (action lbndrs') + + +rebindLTyVarBndrs :: SetName name + => [LHsTyVarBndr name] -> Rebind name [LHsTyVarBndr name] +rebindLTyVarBndrs lbndrs = mapM (located rebindTyVarBndr) lbndrs + + +rebindTyVarBndr :: SetName name + => HsTyVarBndr name -> Rebind name (HsTyVarBndr name) +rebindTyVarBndr (UserTyVar (L l name)) = + UserTyVar . L l <$> rebindName name +rebindTyVarBndr (KindedTyVar name kinds) = + KindedTyVar <$> located rebindName name <*> pure kinds + + +rebindName :: SetName name => name -> Rebind name name +rebindName name = do + RenameEnv { .. } <- get + taken <- takenNames + case Map.lookup (getName name) rneCtx of + Just name' -> pure name' + Nothing | getNameRep name `Set.member` taken -> freshName name + Nothing -> reuseName name + + +-- | Generate fresh occurrence name, put it into context and return. +freshName :: SetName name => name -> Rebind name name +freshName name = do + env@RenameEnv { .. } <- get + taken <- takenNames + let name' = setInternalNameRep (findFreshName taken rep) name + put $ env { rneCtx = Map.insert nname name' rneCtx } + return name' + where + nname = getName name + rep = getNameRep nname + + +reuseName :: SetName name => name -> Rebind name name +reuseName name = do + env@RenameEnv { .. } <- get + put $ env { rneCtx = Map.insert (getName name) name rneCtx } + return name + + +takenNames :: NamedThing name => Rebind name (Set NameRep) +takenNames = do + RenameEnv { .. } <- get + return $ Set.union rneFV (ctxElems rneCtx) + where + ctxElems = Set.fromList . map getNameRep . Map.elems + + +findFreshName :: Set NameRep -> NameRep -> NameRep +findFreshName taken = + fromJust . List.find isFresh . alternativeNames + where + isFresh = not . flip Set.member taken + + +alternativeNames :: NameRep -> [NameRep] +alternativeNames name + | [_] <- nameRepString name = letterNames ++ alternativeNames' name + where + letterNames = map (stringNameRep . pure) ['a'..'z'] +alternativeNames name = alternativeNames' name + + +alternativeNames' :: NameRep -> [NameRep] +alternativeNames' name = + [ stringNameRep $ str ++ show i | i :: Int <- [0..] ] + where + str = nameRepString name + + +located :: Functor f => (a -> f b) -> Located a -> f (Located b) +located f (L loc e) = L loc <$> f e + + +tyVarName :: HsTyVarBndr name -> name +tyVarName (UserTyVar name) = unLoc name +tyVarName (KindedTyVar (L _ name) _) = name diff --git a/haddock-api/src/Haddock/InterfaceFile.hs b/haddock-api/src/Haddock/InterfaceFile.hs index e8db3cfb..73185092 100644 --- a/haddock-api/src/Haddock/InterfaceFile.hs +++ b/haddock-api/src/Haddock/InterfaceFile.hs @@ -14,7 +14,7 @@ -- Reading and writing the .haddock interface file ----------------------------------------------------------------------------- module Haddock.InterfaceFile ( - InterfaceFile(..), ifPackageKey, + InterfaceFile(..), ifUnitId, ifModule, readInterfaceFile, nameCacheFromGhc, freshNameCache, NameCacheAccessor, writeInterfaceFile, binaryInterfaceVersion, binaryInterfaceVersionCompatibility ) where @@ -25,7 +25,6 @@ import Haddock.Utils hiding (out) import Control.Monad import Data.Array -import Data.Functor ((<$>)) import Data.IORef import Data.List import qualified Data.Map as Map @@ -52,11 +51,17 @@ data InterfaceFile = InterfaceFile { } -ifPackageKey :: InterfaceFile -> PackageKey -ifPackageKey if_ = +ifModule :: InterfaceFile -> Module +ifModule if_ = case ifInstalledIfaces if_ of [] -> error "empty InterfaceFile" - iface:_ -> modulePackageKey $ instMod iface + iface:_ -> instMod iface + +ifUnitId :: InterfaceFile -> UnitId +ifUnitId if_ = + case ifInstalledIfaces if_ of + [] -> error "empty InterfaceFile" + iface:_ -> moduleUnitId $ instMod iface binaryInterfaceMagic :: Word32 @@ -310,7 +315,7 @@ getSymbolTable bh namecache = do return (namecache', arr) -type OnDiskName = (PackageKey, ModuleName, OccName) +type OnDiskName = (UnitId, ModuleName, OccName) fromOnDiskName @@ -340,7 +345,7 @@ fromOnDiskName _ nc (pid, mod_name, occ) = serialiseName :: BinHandle -> Name -> UniqFM (Int,Name) -> IO () serialiseName bh name _ = do let modu = nameModule name - put_ bh (modulePackageKey modu, moduleName modu, nameOccName name) + put_ bh (moduleUnitId modu, moduleName modu, nameOccName name) ------------------------------------------------------------------------------- diff --git a/haddock-api/src/Haddock/ModuleTree.hs b/haddock-api/src/Haddock/ModuleTree.hs index 2f731214..e6cf8201 100644 --- a/haddock-api/src/Haddock/ModuleTree.hs +++ b/haddock-api/src/Haddock/ModuleTree.hs @@ -15,7 +15,7 @@ module Haddock.ModuleTree ( ModuleTree(..), mkModuleTree ) where import Haddock.Types ( MDoc ) import GHC ( Name ) -import Module ( Module, moduleNameString, moduleName, modulePackageKey, packageKeyString ) +import Module ( Module, moduleNameString, moduleName, moduleUnitId, unitIdString ) import DynFlags ( DynFlags ) import Packages ( lookupPackage ) import PackageConfig ( sourcePackageIdString ) @@ -28,10 +28,10 @@ mkModuleTree :: DynFlags -> Bool -> [(Module, Maybe (MDoc Name))] -> [ModuleTree mkModuleTree dflags showPkgs mods = foldr fn [] [ (splitModule mdl, modPkg mdl, modSrcPkg mdl, short) | (mdl, short) <- mods ] where - modPkg mod_ | showPkgs = Just (packageKeyString (modulePackageKey mod_)) + modPkg mod_ | showPkgs = Just (unitIdString (moduleUnitId mod_)) | otherwise = Nothing modSrcPkg mod_ | showPkgs = fmap sourcePackageIdString - (lookupPackage dflags (modulePackageKey mod_)) + (lookupPackage dflags (moduleUnitId mod_)) | otherwise = Nothing fn (mod_,pkg,srcPkg,short) = addToTrees mod_ pkg srcPkg short diff --git a/haddock-api/src/Haddock/Options.hs b/haddock-api/src/Haddock/Options.hs index e847333e..f84989ef 100644 --- a/haddock-api/src/Haddock/Options.hs +++ b/haddock-api/src/Haddock/Options.hs @@ -21,6 +21,7 @@ module Haddock.Options ( optContentsUrl, optIndexUrl, optCssFile, + optSourceCssFile, sourceUrls, wikiUrls, optDumpInterfaceFile, @@ -66,6 +67,8 @@ data Flag | Flag_WikiEntityURL String | Flag_LaTeX | Flag_LaTeXStyle String + | Flag_HyperlinkedSource + | Flag_SourceCss String | Flag_Help | Flag_Verbosity String | Flag_Version @@ -116,6 +119,10 @@ options backwardsCompat = Option ['U'] ["use-unicode"] (NoArg Flag_UseUnicode) "use Unicode in HTML output", Option [] ["hoogle"] (NoArg Flag_Hoogle) "output for Hoogle; you may want --package-name and --package-version too", + Option [] ["hyperlinked-source"] (NoArg Flag_HyperlinkedSource) + "generate highlighted and hyperlinked source code (for use with --html)", + Option [] ["source-css"] (ReqArg Flag_SourceCss "FILE") + "use custom CSS file instead of default one in hyperlinked source", Option [] ["source-base"] (ReqArg Flag_SourceBaseURL "URL") "URL for a source code link on the contents\nand index pages", Option ['s'] (if backwardsCompat then ["source", "source-module"] else ["source-module"]) @@ -239,6 +246,8 @@ optIndexUrl flags = optLast [ url | Flag_UseIndex url <- flags ] optCssFile :: [Flag] -> Maybe FilePath optCssFile flags = optLast [ str | Flag_CSS str <- flags ] +optSourceCssFile :: [Flag] -> Maybe FilePath +optSourceCssFile flags = optLast [ str | Flag_SourceCss str <- flags ] sourceUrls :: [Flag] -> (Maybe String, Maybe String, Maybe String, Maybe String) sourceUrls flags = diff --git a/haddock-api/src/Haddock/Syb.hs b/haddock-api/src/Haddock/Syb.hs new file mode 100644 index 00000000..4847e486 --- /dev/null +++ b/haddock-api/src/Haddock/Syb.hs @@ -0,0 +1,55 @@ +{-# LANGUAGE Rank2Types #-} + + +module Haddock.Syb + ( everything, everythingWithState, everywhere + , mkT + , combine + ) where + + +import Data.Data +import Control.Applicative + + +-- | Perform a query on each level of a tree. +-- +-- This is stolen directly from SYB package and copied here to not introduce +-- additional dependencies. +everything :: (r -> r -> r) -> (forall a. Data a => a -> r) + -> (forall a. Data a => a -> r) +everything k f x = foldl k (f x) (gmapQ (everything k f) x) + + +-- | Perform a query with state on each level of a tree. +-- +-- This is the same as 'everything' but allows for stateful computations. In +-- SYB it is called @everythingWithContext@ but I find this name somewhat +-- nicer. +everythingWithState :: s -> (r -> r -> r) + -> (forall a. Data a => a -> s -> (r, s)) + -> (forall a. Data a => a -> r) +everythingWithState s k f x = + let (r, s') = f x s + in foldl k r (gmapQ (everythingWithState s' k f) x) + + +-- | Apply transformation on each level of a tree. +-- +-- Just like 'everything', this is stolen from SYB package. +everywhere :: (forall a. Data a => a -> a) -> (forall a. Data a => a -> a) +everywhere f = f . gmapT (everywhere f) + +-- | Create generic transformation. +-- +-- Another function stolen from SYB package. +mkT :: (Typeable a, Typeable b) => (b -> b) -> (a -> a) +mkT f = case cast f of + Just f' -> f' + Nothing -> id + +-- | Combine two queries into one using alternative combinator. +combine :: Alternative f => (forall a. Data a => a -> f r) + -> (forall a. Data a => a -> f r) + -> (forall a. Data a => a -> f r) +combine f g x = f x <|> g x diff --git a/haddock-api/src/Haddock/Types.hs b/haddock-api/src/Haddock/Types.hs index e93294a0..b837970b 100644 --- a/haddock-api/src/Haddock/Types.hs +++ b/haddock-api/src/Haddock/Types.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE DeriveDataTypeable, DeriveFunctor, DeriveFoldable, DeriveTraversable, StandaloneDeriving #-} +{-# LANGUAGE DeriveDataTypeable, DeriveFunctor, DeriveFoldable, DeriveTraversable, StandaloneDeriving, TypeFamilies, RecordWildCards #-} {-# OPTIONS_GHC -fno-warn-orphans #-} ----------------------------------------------------------------------------- -- | @@ -27,16 +27,23 @@ import Control.Arrow hiding ((<+>)) import Control.DeepSeq import Data.Typeable import Data.Map (Map) +import Data.Data (Data) import qualified Data.Map as Map import Documentation.Haddock.Types import BasicTypes (Fixity(..)) + import GHC hiding (NoLink) -import DynFlags (ExtensionFlag, Language) +import DynFlags (Language) +import qualified GHC.LanguageExtensions as LangExt +import Coercion +import NameSet import OccName import Outputable import Control.Applicative (Applicative(..)) import Control.Monad (ap) +import Haddock.Backends.Hyperlinker.Types + ----------------------------------------------------------------------------- -- * Convenient synonyms ----------------------------------------------------------------------------- @@ -50,7 +57,6 @@ type SubMap = Map Name [Name] type DeclMap = Map Name [LHsDecl Name] type InstMap = Map SrcSpan Name type FixMap = Map Name Fixity -type SrcMap = Map PackageKey FilePath type DocPaths = (FilePath, Maybe FilePath) -- paths to HTML and sources @@ -126,6 +132,10 @@ data Interface = Interface -- | Warnings for things defined in this module. , ifaceWarningMap :: !WarningMap + + -- | Tokenized source code of module (avaliable if Haddock is invoked with + -- source generation flag). + , ifaceTokenizedSrc :: !(Maybe [RichToken]) } type WarningMap = Map Name (Doc Name) @@ -267,7 +277,6 @@ unrenameDocForDecl (doc, fnArgsDoc) = -- | Type of environment used to cross-reference identifiers in the syntax. type LinkEnv = Map Name Module - -- | Extends 'Name' with cross-reference information. data DocName = Documented Name Module @@ -277,13 +286,46 @@ data DocName | Undocumented Name -- ^ This thing is not part of the (existing or resulting) -- documentation, as far as Haddock knows. - deriving Eq + deriving (Eq, Data) +type instance PostRn DocName NameSet = PlaceHolder +type instance PostRn DocName Fixity = PlaceHolder +type instance PostRn DocName Bool = PlaceHolder +type instance PostRn DocName [Name] = PlaceHolder + +type instance PostTc DocName Kind = PlaceHolder +type instance PostTc DocName Type = PlaceHolder +type instance PostTc DocName Coercion = PlaceHolder instance NamedThing DocName where getName (Documented name _) = name getName (Undocumented name) = name +-- | Useful for debugging +instance Outputable DocName where + ppr = ppr . getName + +instance OutputableBndr DocName where + pprBndr _ = ppr . getName + pprPrefixOcc = pprPrefixOcc . getName + pprInfixOcc = pprInfixOcc . getName + +class NamedThing name => SetName name where + + setName :: Name -> name -> name + + +instance SetName Name where + + setName name' _ = name' + + +instance SetName DocName where + + setName name' (Documented _ mdl) = Documented name' mdl + setName name' (Undocumented _) = Undocumented name' + + ----------------------------------------------------------------------------- -- * Instances @@ -291,21 +333,83 @@ instance NamedThing DocName where -- | The three types of instances data InstType name - = ClassInst [HsType name] -- ^ Context + = ClassInst + { clsiCtx :: [HsType name] + , clsiTyVars :: LHsQTyVars name + , clsiSigs :: [Sig name] + , clsiAssocTys :: [PseudoFamilyDecl name] + } | TypeInst (Maybe (HsType name)) -- ^ Body (right-hand side) | DataInst (TyClDecl name) -- ^ Data constructors instance OutputableBndr a => Outputable (InstType a) where - ppr (ClassInst a) = text "ClassInst" <+> ppr a + ppr (ClassInst { .. }) = text "ClassInst" + <+> ppr clsiCtx + <+> ppr clsiTyVars + <+> ppr clsiSigs ppr (TypeInst a) = text "TypeInst" <+> ppr a ppr (DataInst a) = text "DataInst" <+> ppr a --- | An instance head that may have documentation. -type DocInstance name = (InstHead name, Maybe (MDoc name)) + +-- | Almost the same as 'FamilyDecl' except for type binders. +-- +-- In order to perform type specialization for class instances, we need to +-- substitute class variables to appropriate type. However, type variables in +-- associated type are specified using 'LHsTyVarBndrs' instead of 'HsType'. +-- This makes type substitution impossible and to overcome this issue, +-- 'PseudoFamilyDecl' type is introduced. +data PseudoFamilyDecl name = PseudoFamilyDecl + { pfdInfo :: FamilyInfo name + , pfdLName :: Located name + , pfdTyVars :: [LHsType name] + , pfdKindSig :: LFamilyResultSig name + } + + +mkPseudoFamilyDecl :: FamilyDecl name -> PseudoFamilyDecl name +mkPseudoFamilyDecl (FamilyDecl { .. }) = PseudoFamilyDecl + { pfdInfo = fdInfo + , pfdLName = fdLName + , pfdTyVars = [ L loc (mkType bndr) | L loc bndr <- hsq_explicit fdTyVars ] + , pfdKindSig = fdResultSig + } + where + mkType (KindedTyVar (L loc name) lkind) = + HsKindSig tvar lkind + where + tvar = L loc (HsTyVar (L loc name)) + mkType (UserTyVar name) = HsTyVar name + + +-- | An instance head that may have documentation and a source location. +type DocInstance name = (InstHead name, Maybe (MDoc name), Located name) -- | The head of an instance. Consists of a class name, a list of kind -- parameters, a list of type parameters and an instance type -type InstHead name = (name, [HsType name], [HsType name], InstType name) +data InstHead name = InstHead + { ihdClsName :: name + , ihdKinds :: [HsType name] + , ihdTypes :: [HsType name] + , ihdInstType :: InstType name + } + + +-- | An instance origin information. +-- +-- This is used primarily in HTML backend to generate unique instance +-- identifiers (for expandable sections). +data InstOrigin name + = OriginClass name + | OriginData name + | OriginFamily name + + +instance NamedThing name => NamedThing (InstOrigin name) where + + getName (OriginClass name) = getName name + getName (OriginData name) = getName name + getName (OriginFamily name) = getName name + ----------------------------------------------------------------------------- -- * Documentation comments @@ -399,7 +503,7 @@ data HaddockModInfo name = HaddockModInfo , hmi_portability :: Maybe String , hmi_safety :: Maybe String , hmi_language :: Maybe Language - , hmi_extensions :: [ExtensionFlag] + , hmi_extensions :: [LangExt.Extension] } @@ -491,11 +595,11 @@ instance Functor ErrMsgM where fmap f (Writer (a, msgs)) = Writer (f a, msgs) instance Applicative ErrMsgM where - pure = return - (<*>) = ap + pure a = Writer (a, []) + (<*>) = ap instance Monad ErrMsgM where - return a = Writer (a, []) + return = pure m >>= k = Writer $ let (a, w) = runWriter m (b, w') = runWriter (k a) @@ -544,10 +648,27 @@ instance Functor ErrMsgGhc where fmap f (WriterGhc x) = WriterGhc (fmap (first f) x) instance Applicative ErrMsgGhc where - pure = return + pure a = WriterGhc (return (a, [])) (<*>) = ap instance Monad ErrMsgGhc where - return a = WriterGhc (return (a, [])) + return = pure m >>= k = WriterGhc $ runWriterGhc m >>= \ (a, msgs1) -> fmap (second (msgs1 ++)) (runWriterGhc (k a)) + + +----------------------------------------------------------------------------- +-- * Pass sensitive types +----------------------------------------------------------------------------- + +type instance PostRn DocName NameSet = PlaceHolder +type instance PostRn DocName Fixity = PlaceHolder +type instance PostRn DocName Bool = PlaceHolder +type instance PostRn DocName Name = DocName +type instance PostRn DocName (Located Name) = Located DocName +type instance PostRn DocName [Name] = PlaceHolder +type instance PostRn DocName DocName = DocName + +type instance PostTc DocName Kind = PlaceHolder +type instance PostTc DocName Type = PlaceHolder +type instance PostTc DocName Coercion = PlaceHolder diff --git a/haddock-api/src/Haddock/Utils.hs b/haddock-api/src/Haddock/Utils.hs index 4fed3a1e..3510d908 100644 --- a/haddock-api/src/Haddock/Utils.hs +++ b/haddock-api/src/Haddock/Utils.hs @@ -16,6 +16,7 @@ module Haddock.Utils ( -- * Misc utilities restrictTo, emptyHsQTvs, toDescription, toInstalledDescription, + mkEmptySigWcType, addClassContext, lHsQTyVarsToTypes, -- * Filename utilities moduleHtmlFile, moduleHtmlFile', @@ -63,6 +64,7 @@ import Haddock.GhcUtils import GHC import Name +import HsTypes (selectorFieldOcc) import Control.Monad ( liftM ) import Data.Char ( isAlpha, isAlphaNum, isAscii, ord, chr ) @@ -123,6 +125,34 @@ toInstalledDescription = fmap mkMeta . hmi_description . instInfo mkMeta :: Doc a -> MDoc a mkMeta x = emptyMetaDoc { _doc = x } +mkEmptySigWcType :: LHsType Name -> LHsSigWcType Name +-- Dubious, because the implicit binders are empty even +-- though the type might have free varaiables +mkEmptySigWcType ty = mkEmptyImplicitBndrs (mkEmptyWildCardBndrs ty) + +addClassContext :: Name -> LHsQTyVars Name -> LSig Name -> LSig Name +-- Add the class context to a class-op signature +addClassContext cls tvs0 (L pos (ClassOpSig _ lname ltype)) + = L pos (TypeSig lname (mkEmptySigWcType (go (hsSigType ltype)))) + -- The mkEmptySigWcType is suspicious + where + go (L loc (HsForAllTy { hst_bndrs = tvs, hst_body = ty })) + = L loc (HsForAllTy { hst_bndrs = tvs, hst_body = go ty }) + go (L loc (HsQualTy { hst_ctxt = ctxt, hst_body = ty })) + = L loc (HsQualTy { hst_ctxt = add_ctxt ctxt, hst_body = ty }) + go (L loc ty) + = L loc (HsQualTy { hst_ctxt = add_ctxt (L loc []), hst_body = L loc ty }) + + extra_pred = nlHsTyConApp cls (lHsQTyVarsToTypes tvs0) + add_ctxt (L loc preds) = L loc (extra_pred : preds) + +addClassContext _ _ sig = sig -- E.g. a MinimalSig is fine + +lHsQTyVarsToTypes :: LHsQTyVars Name -> [LHsType Name] +lHsQTyVarsToTypes tvs + = [ noLoc (HsTyVar (noLoc (hsLTyVarName tv))) + | tv <- hsQTvExplicit tvs ] + -------------------------------------------------------------------------------- -- * Making abstract declarations -------------------------------------------------------------------------------- @@ -150,19 +180,36 @@ restrictDataDefn names defn@(HsDataDefn { dd_ND = new_or_data, dd_cons = cons }) restrictCons :: [Name] -> [LConDecl Name] -> [LConDecl Name] restrictCons names decls = [ L p d | L p (Just d) <- map (fmap keep) decls ] where - keep d | any (\n -> n `elem` names) (map unLoc $ con_names d) = - case con_details d of + keep d | any (\n -> n `elem` names) (map unLoc $ getConNames d) = + case getConDetails h98d of PrefixCon _ -> Just d RecCon fields | all field_avail (unL fields) -> Just d - | otherwise -> Just (d { con_details = PrefixCon (field_types (map unL (unL fields))) }) + | otherwise -> Just (h98d { con_details = PrefixCon (field_types (map unL (unL fields))) }) -- if we have *all* the field names available, then -- keep the record declaration. Otherwise degrade to -- a constructor declaration. This isn't quite right, but -- it's the best we can do. InfixCon _ _ -> Just d where - field_avail (L _ (ConDeclField ns _ _)) = all (\n -> unLoc n `elem` names) ns + h98d = h98ConDecl d + h98ConDecl c@ConDeclH98{} = c + h98ConDecl c@ConDeclGADT{} = c' + where + (details,_res_ty,cxt,tvs) = gadtDeclDetails (con_type c) + c' :: ConDecl Name + c' = ConDeclH98 + { con_name = head (con_names c) + , con_qvars = Just $ HsQTvs { hsq_implicit = mempty + , hsq_explicit = tvs } + , con_cxt = Just cxt + , con_details = details + , con_doc = con_doc c + } + + field_avail :: LConDeclField Name -> Bool + field_avail (L _ (ConDeclField fs _ _)) + = all (\f -> selectorFieldOcc (unLoc f) `elem` names) fs field_types flds = [ t | ConDeclField _ t _ <- flds ] keep _ = Nothing @@ -174,11 +221,12 @@ restrictDecls names = mapMaybe (filterLSigNames (`elem` names)) restrictATs :: [Name] -> [LFamilyDecl Name] -> [LFamilyDecl Name] restrictATs names ats = [ at | at <- ats , unL (fdLName (unL at)) `elem` names ] -emptyHsQTvs :: LHsTyVarBndrs Name +emptyHsQTvs :: LHsQTyVars Name -- This function is here, rather than in HsTypes, because it *renamed*, but -- does not necessarily have all the rigt kind variables. It is used -- in Haddock just for printing, so it doesn't matter -emptyHsQTvs = HsQTvs { hsq_kvs = error "haddock:emptyHsQTvs", hsq_tvs = [] } +emptyHsQTvs = HsQTvs { hsq_implicit = error "haddock:emptyHsQTvs" + , hsq_explicit = [] } -------------------------------------------------------------------------------- diff --git a/haddock-api/src/Haddock/Version.hs b/haddock-api/src/Haddock/Version.hs index 2ef3a257..4e9a581a 100644 --- a/haddock-api/src/Haddock/Version.hs +++ b/haddock-api/src/Haddock/Version.hs @@ -9,7 +9,7 @@ -- Stability : experimental -- Portability : portable ----------------------------------------------------------------------------- -module Haddock.Version ( +module Haddock.Version ( projectName, projectVersion, projectUrl ) where diff --git a/haddock-api/test/Haddock/Backends/Hyperlinker/ParserSpec.hs b/haddock-api/test/Haddock/Backends/Hyperlinker/ParserSpec.hs new file mode 100644 index 00000000..8cd2690e --- /dev/null +++ b/haddock-api/test/Haddock/Backends/Hyperlinker/ParserSpec.hs @@ -0,0 +1,98 @@ +module Haddock.Backends.Hyperlinker.ParserSpec (main, spec) where + + +import Test.Hspec +import Test.QuickCheck + +import Haddock.Backends.Hyperlinker.Parser +import Haddock.Backends.Hyperlinker.Types + + +main :: IO () +main = hspec spec + + +spec :: Spec +spec = do + describe "parse" parseSpec + + +parseSpec :: Spec +parseSpec = do + + it "is total" $ + property $ \src -> length (parse src) `shouldSatisfy` (>= 0) + + it "retains file layout" $ + property $ \src -> concatMap tkValue (parse src) == src + + context "when parsing single-line comments" $ do + + it "should ignore content until the end of line" $ + "-- some very simple comment\nidentifier" + `shouldParseTo` + [TkComment, TkSpace, TkIdentifier] + + it "should allow endline escaping" $ + "-- first line\\\nsecond line\\\nand another one" + `shouldParseTo` + [TkComment] + + context "when parsing multi-line comments" $ do + + it "should support nested comments" $ + "{- comment {- nested -} still comment -} {- next comment -}" + `shouldParseTo` + [TkComment, TkSpace, TkComment] + + it "should distinguish compiler pragma" $ + "{- comment -}{-# LANGUAGE GADTs #-}{- comment -}" + `shouldParseTo` + [TkComment, TkPragma, TkComment] + + it "should recognize preprocessor directives" $ do + "\n#define foo bar" `shouldParseTo` [TkSpace, TkCpp] + "x # y" `shouldParseTo` + [TkIdentifier, TkSpace, TkOperator, TkSpace,TkIdentifier] + + it "should distinguish basic language constructs" $ do + "(* 2) <$> (\"abc\", foo)" `shouldParseTo` + [ TkSpecial, TkOperator, TkSpace, TkNumber, TkSpecial + , TkSpace, TkOperator, TkSpace + , TkSpecial, TkString, TkSpecial, TkSpace, TkIdentifier, TkSpecial + ] + "let foo' = foo in foo' + foo'" `shouldParseTo` + [ TkKeyword, TkSpace, TkIdentifier + , TkSpace, TkGlyph, TkSpace + , TkIdentifier, TkSpace, TkKeyword, TkSpace + , TkIdentifier, TkSpace, TkOperator, TkSpace, TkIdentifier + ] + "square x = y^2 where y = x" `shouldParseTo` + [ TkIdentifier, TkSpace, TkIdentifier + , TkSpace, TkGlyph, TkSpace + , TkIdentifier, TkOperator, TkNumber + , TkSpace, TkKeyword, TkSpace + , TkIdentifier, TkSpace, TkGlyph, TkSpace, TkIdentifier + ] + + it "should parse do-notation syntax" $ do + "do { foo <- getLine; putStrLn foo }" `shouldParseTo` + [ TkKeyword, TkSpace, TkSpecial, TkSpace + , TkIdentifier, TkSpace, TkGlyph, TkSpace + , TkIdentifier, TkSpecial, TkSpace + , TkIdentifier, TkSpace, TkIdentifier, TkSpace, TkSpecial + ] + + unlines + [ "do" + , " foo <- getLine" + , " putStrLn foo" + ] `shouldParseTo` + [ TkKeyword, TkSpace, TkIdentifier + , TkSpace, TkGlyph, TkSpace, TkIdentifier, TkSpace + , TkIdentifier, TkSpace, TkIdentifier, TkSpace + ] + + +shouldParseTo :: String -> [TokenType] -> Expectation +str `shouldParseTo` tokens = map tkType (parse str) `shouldBe` tokens diff --git a/haddock-api/test/Spec.hs b/haddock-api/test/Spec.hs new file mode 100644 index 00000000..a824f8c3 --- /dev/null +++ b/haddock-api/test/Spec.hs @@ -0,0 +1 @@ +{-# OPTIONS_GHC -F -pgmF hspec-discover #-} diff --git a/haddock-library/LICENSE b/haddock-library/LICENSE index 1636bfcd..460decfc 100644 --- a/haddock-library/LICENSE +++ b/haddock-library/LICENSE @@ -5,11 +5,11 @@ modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR diff --git a/haddock-library/haddock-library.cabal b/haddock-library/haddock-library.cabal index b0f886cd..f60501f5 100644 --- a/haddock-library/haddock-library.cabal +++ b/haddock-library/haddock-library.cabal @@ -1,5 +1,5 @@ name: haddock-library -version: 1.2.0 +version: 1.2.1 synopsis: Library exposing some functionality of Haddock. description: Haddock is a documentation-generation tool for Haskell libraries. These modules expose some functionality of it @@ -21,7 +21,7 @@ library default-language: Haskell2010 build-depends: - base >= 4.3 && < 4.9 + base >= 4.5 && < 4.10 , bytestring , transformers , deepseq diff --git a/haddock-library/src/Documentation/Haddock/Parser.hs b/haddock-library/src/Documentation/Haddock/Parser.hs index b7ab85b0..ca9e9d8d 100644 --- a/haddock-library/src/Documentation/Haddock/Parser.hs +++ b/haddock-library/src/Documentation/Haddock/Parser.hs @@ -93,7 +93,8 @@ parseParas input = case parseParasState input of } parseParasState :: String -> (ParserState, DocH mod Identifier) -parseParasState = parse (p <* skipSpace) . encodeUtf8 . (++ "\n") +parseParasState = + parse (p <* skipSpace) . encodeUtf8 . (++ "\n") . filter (/= '\r') where p :: Parser (DocH mod Identifier) p = docConcat <$> paragraph `sepBy` many (skipHorizontalSpace *> "\n") @@ -105,7 +106,7 @@ parseParagraphs input = case parseParasState input of -- | Parse a text paragraph. Actually just a wrapper over 'parseStringBS' which -- drops leading whitespace and encodes the string to UTF8 first. parseString :: String -> DocH mod Identifier -parseString = parseStringBS . encodeUtf8 . dropWhile isSpace +parseString = parseStringBS . encodeUtf8 . dropWhile isSpace . filter (/= '\r') parseStringBS :: BS.ByteString -> DocH mod Identifier parseStringBS = snd . parse p @@ -230,18 +231,20 @@ markdownImage = fromHyperlink <$> ("!" *> linkParser) -- | Paragraph parser, called by 'parseParas'. paragraph :: Parser (DocH mod Identifier) -paragraph = examples <|> skipSpace *> ( - since - <|> unorderedList - <|> orderedList - <|> birdtracks - <|> codeblock - <|> property - <|> header - <|> textParagraphThatStartsWithMarkdownLink - <|> definitionList - <|> docParagraph <$> textParagraph - ) +paragraph = examples <|> do + indent <- takeIndent + choice + [ since + , unorderedList indent + , orderedList indent + , birdtracks + , codeblock + , property + , header + , textParagraphThatStartsWithMarkdownLink + , definitionList indent + , docParagraph <$> textParagraph + ] since :: Parser (DocH mod a) since = ("@since " *> version <* skipHorizontalSpace <* endOfLine) >>= setSince >> return DocEmpty @@ -282,16 +285,16 @@ textParagraphThatStartsWithMarkdownLink = docParagraph <$> (docAppend <$> markdo | otherwise = " " -- | Parses unordered (bullet) lists. -unorderedList :: Parser (DocH mod Identifier) -unorderedList = DocUnorderedList <$> p +unorderedList :: BS.ByteString -> Parser (DocH mod Identifier) +unorderedList indent = DocUnorderedList <$> p where - p = ("*" <|> "-") *> innerList p + p = ("*" <|> "-") *> innerList indent p -- | Parses ordered lists (numbered or dashed). -orderedList :: Parser (DocH mod Identifier) -orderedList = DocOrderedList <$> p +orderedList :: BS.ByteString -> Parser (DocH mod Identifier) +orderedList indent = DocOrderedList <$> p where - p = (paren <|> dot) *> innerList p + p = (paren <|> dot) *> innerList indent p dot = (decimal :: Parser Int) <* "." paren = "(" *> decimal <* ")" @@ -300,23 +303,24 @@ orderedList = DocOrderedList <$> p -- same paragraph. Usually used as -- -- > someListFunction = listBeginning *> innerList someListFunction -innerList :: Parser [DocH mod Identifier] -> Parser [DocH mod Identifier] -innerList item = do +innerList :: BS.ByteString -> Parser [DocH mod Identifier] + -> Parser [DocH mod Identifier] +innerList indent item = do c <- takeLine - (cs, items) <- more item + (cs, items) <- more indent item let contents = docParagraph . parseString . dropNLs . unlines $ c : cs return $ case items of Left p -> [contents `docAppend` p] Right i -> contents : i -- | Parses definition lists. -definitionList :: Parser (DocH mod Identifier) -definitionList = DocDefList <$> p +definitionList :: BS.ByteString -> Parser (DocH mod Identifier) +definitionList indent = DocDefList <$> p where p = do label <- "[" *> (parseStringBS <$> takeWhile1 (`notElem` ("]\n" :: String))) <* ("]" <* optional ":") c <- takeLine - (cs, items) <- more p + (cs, items) <- more indent p let contents = parseString . dropNLs . unlines $ c : cs return $ case items of Left x -> [(label, contents `docAppend` x)] @@ -329,32 +333,40 @@ dropNLs = reverse . dropWhile (== '\n') . reverse -- | Main worker for 'innerList' and 'definitionList'. -- We need the 'Either' here to be able to tell in the respective functions -- whether we're dealing with the next list or a nested paragraph. -more :: Monoid a => Parser a +more :: Monoid a => BS.ByteString -> Parser a -> Parser ([String], Either (DocH mod Identifier) a) -more item = innerParagraphs <|> moreListItems item - <|> moreContent item <|> pure ([], Right mempty) +more indent item = innerParagraphs indent + <|> moreListItems indent item + <|> moreContent indent item + <|> pure ([], Right mempty) -- | Used by 'innerList' and 'definitionList' to parse any nested paragraphs. -innerParagraphs :: Parser ([String], Either (DocH mod Identifier) a) -innerParagraphs = (,) [] . Left <$> ("\n" *> indentedParagraphs) +innerParagraphs :: BS.ByteString + -> Parser ([String], Either (DocH mod Identifier) a) +innerParagraphs indent = (,) [] . Left <$> ("\n" *> indentedParagraphs indent) -- | Attempts to fetch the next list if possibly. Used by 'innerList' and -- 'definitionList' to recursively grab lists that aren't separated by a whole -- paragraph. -moreListItems :: Parser a +moreListItems :: BS.ByteString -> Parser a -> Parser ([String], Either (DocH mod Identifier) a) -moreListItems item = (,) [] . Right <$> (skipSpace *> item) +moreListItems indent item = (,) [] . Right <$> indentedItem + where + indentedItem = string indent *> skipSpace *> item -- | Helper for 'innerList' and 'definitionList' which simply takes -- a line of text and attempts to parse more list content with 'more'. -moreContent :: Monoid a => Parser a +moreContent :: Monoid a => BS.ByteString -> Parser a -> Parser ([String], Either (DocH mod Identifier) a) -moreContent item = first . (:) <$> nonEmptyLine <*> more item +moreContent indent item = first . (:) <$> nonEmptyLine <*> more indent item -- | Parses an indented paragraph. -- The indentation is 4 spaces. -indentedParagraphs :: Parser (DocH mod Identifier) -indentedParagraphs = (concat <$> dropFrontOfPara " ") >>= parseParagraphs +indentedParagraphs :: BS.ByteString -> Parser (DocH mod Identifier) +indentedParagraphs indent = + (concat <$> dropFrontOfPara indent') >>= parseParagraphs + where + indent' = string $ BS.append indent " " -- | Grab as many fully indented paragraphs as we can. dropFrontOfPara :: Parser BS.ByteString -> Parser [String] @@ -381,6 +393,15 @@ takeNonEmptyLine :: Parser String takeNonEmptyLine = do (++ "\n") . decodeUtf8 <$> (takeWhile1 (/= '\n') >>= nonSpace) <* "\n" +-- | Takes indentation of first non-empty line. +-- +-- More precisely: skips all whitespace-only lines and returns indentation +-- (horizontal space, might be empty) of that non-empty line. +takeIndent :: Parser BS.ByteString +takeIndent = do + indent <- takeHorizontalSpace + "\n" *> takeIndent <|> return indent + -- | Blocks of text of the form: -- -- >> foo diff --git a/haddock-library/test/Documentation/Haddock/ParserSpec.hs b/haddock-library/test/Documentation/Haddock/ParserSpec.hs index 44ec2988..2ef414fb 100644 --- a/haddock-library/test/Documentation/Haddock/ParserSpec.hs +++ b/haddock-library/test/Documentation/Haddock/ParserSpec.hs @@ -1,4 +1,5 @@ {-# LANGUAGE OverloadedStrings, FlexibleInstances #-} +{-# LANGUAGE LambdaCase #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Documentation.Haddock.ParserSpec (main, spec) where @@ -55,8 +56,10 @@ spec = do it "accepts hexadecimal character references" $ do "e" `shouldParseTo` "e" - it "allows to backslash-escape characters" $ do - property $ \x -> ['\\', x] `shouldParseTo` DocString [x] + it "allows to backslash-escape characters except \\r" $ do + property $ \case + '\r' -> "\\\r" `shouldParseTo` DocString "\\" + x -> ['\\', x] `shouldParseTo` DocString [x] context "when parsing strings contaning numeric character references" $ do it "will implicitly convert digits to characters" $ do @@ -693,6 +696,23 @@ spec = do ] <> DocOrderedList [ DocParagraph "baz" ] + it "allows arbitrary initial indent of a list" $ do + unlines + [ " * foo" + , " * bar" + , "" + , " * quux" + , "" + , " * baz" + ] + `shouldParseTo` + DocUnorderedList + [ DocParagraph "foo" + , DocParagraph "bar" + <> DocUnorderedList [ DocParagraph "quux" ] + , DocParagraph "baz" + ] + it "definition lists can come back to top level with a different list" $ do "[foo]: foov\n\n [bar]: barv\n\n1. baz" `shouldParseTo` DocDefList [ ("foo", "foov" diff --git a/haddock-library/vendor/attoparsec-0.12.1.1/Data/Attoparsec/Internal/Types.hs b/haddock-library/vendor/attoparsec-0.12.1.1/Data/Attoparsec/Internal/Types.hs index 6719e09a..9c7994e9 100644 --- a/haddock-library/vendor/attoparsec-0.12.1.1/Data/Attoparsec/Internal/Types.hs +++ b/haddock-library/vendor/attoparsec-0.12.1.1/Data/Attoparsec/Internal/Types.hs @@ -126,7 +126,7 @@ instance Monad (Parser i) where where msg = "Failed reading: " ++ err {-# INLINE fail #-} - return v = Parser $ \t pos more _lose succ -> succ t pos more v + return = pure {-# INLINE return #-} m >>= k = Parser $ \t !pos more lose succ -> @@ -158,7 +158,7 @@ apP d e = do {-# INLINE apP #-} instance Applicative (Parser i) where - pure = return + pure v = Parser $ \t pos more _lose succ -> succ t pos more v {-# INLINE pure #-} (<*>) = apP {-# INLINE (<*>) #-} @@ -166,7 +166,7 @@ instance Applicative (Parser i) where -- These definitions are equal to the defaults, but this -- way the optimizer doesn't have to work so hard to figure -- that out. - (*>) = (>>) + m *> k = m >>= \_ -> k {-# INLINE (*>) #-} x <* y = x >>= \a -> y >> return a {-# INLINE (<*) #-} diff --git a/haddock.cabal b/haddock.cabal index 3b6002f1..ec2a43bc 100644 --- a/haddock.cabal +++ b/haddock.cabal @@ -1,5 +1,5 @@ name: haddock -version: 2.16.0 +version: 2.16.2 synopsis: A documentation-generation tool for Haskell libraries description: Haddock is a documentation-generation tool for Haskell libraries @@ -29,6 +29,8 @@ extra-source-files: haddock-api/src/haddock.sh html-test/src/*.hs html-test/ref/*.html + hypsrc-test/src/*.hs + hypsrc-test/ref/*.html latex-test/src/Simple/*.hs latex-test/ref/Simple/*.tex latex-test/ref/Simple/*.sty @@ -42,10 +44,10 @@ executable haddock default-language: Haskell2010 main-is: Main.hs hs-source-dirs: driver - ghc-options: -funbox-strict-fields -Wall -fwarn-tabs -O2 + ghc-options: -funbox-strict-fields -Wall -fwarn-tabs -O2 -threaded build-depends: - base >= 4.3 && < 4.9 + base >= 4.3 && < 4.10 if flag(in-ghc-tree) hs-source-dirs: haddock-api/src, haddock-library/vendor/attoparsec-0.12.1.1, haddock-library/src cpp-options: -DIN_GHC_TREE @@ -57,6 +59,7 @@ executable haddock array, xhtml >= 3000.2 && < 3000.3, Cabal >= 1.10, + ghc-boot, ghc >= 7.11 && < 7.13, bytestring, transformers @@ -88,6 +91,7 @@ executable haddock Haddock.Interface.AttachInstances Haddock.Interface.LexParseRn Haddock.Interface.ParseModuleHeader + Haddock.Interface.Specialize Haddock.Parser Haddock.Utils Haddock.Backends.Xhtml @@ -101,6 +105,12 @@ executable haddock Haddock.Backends.LaTeX Haddock.Backends.HaddockDB Haddock.Backends.Hoogle + Haddock.Backends.Hyperlinker + Haddock.Backends.Hyperlinker.Ast + Haddock.Backends.Hyperlinker.Parser + Haddock.Backends.Hyperlinker.Renderer + Haddock.Backends.Hyperlinker.Types + Haddock.Backends.Hyperlinker.Utils Haddock.ModuleTree Haddock.Types Haddock.Doc @@ -108,9 +118,10 @@ executable haddock Haddock.InterfaceFile Haddock.Options Haddock.GhcUtils + Haddock.Syb Haddock.Convert else - build-depends: haddock-api == 2.16.0 + build-depends: haddock-api == 2.16.* test-suite html-test type: exitcode-stdio-1.0 @@ -119,6 +130,14 @@ test-suite html-test hs-source-dirs: html-test build-depends: base, directory, process, filepath, Cabal +test-suite hypsrc-test + type: exitcode-stdio-1.0 + default-language: Haskell2010 + main-is: run.hs + hs-source-dirs: hypsrc-test + build-depends: base, directory, process, filepath, Cabal + ghc-options: -Wall -fwarn-tabs + test-suite latex-test type: exitcode-stdio-1.0 default-language: Haskell2010 diff --git a/html-test/README.markdown b/html-test/README.markdown index 8d57acab..717bac5c 100644 --- a/html-test/README.markdown +++ b/html-test/README.markdown @@ -1,7 +1,7 @@ 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: +To add a new test: 1. Create a module in the `html-test/src` directory. diff --git a/html-test/ref/A.html b/html-test/ref/A.html index 62f99ee0..56c04bc6 100644 --- a/html-test/ref/A.html +++ b/html-test/ref/A.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_A.html");}; ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -88,7 +88,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_A.html");}; ><p class="src" ><span class="keyword" >data</span - > <a name="t:A" class="def" + > <a href="" id="t:A" class="def" >A</a ></p ><div class="subs constructors" @@ -97,7 +97,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_A.html");}; ><table ><tr ><td class="src" - ><a name="v:A" class="def" + ><a href="" id="v:A" class="def" >A</a ></td ><td class="doc empty" @@ -108,7 +108,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_A.html");}; ></div ><div class="top" ><p class="src" - ><a name="v:other" class="def" + ><a href="" id="v:other" class="def" >other</a > :: <a href="" >Int</a @@ -116,7 +116,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_A.html");}; ></div ><div class="top" ><p class="src" - ><a name="v:test2" class="def" + ><a href="" id="v:test2" class="def" >test2</a > :: <a href="" >Bool</a @@ -130,7 +130,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_A.html");}; ><p class="src" ><span class="keyword" >data</span - > <a name="t:X" class="def" + > <a href="" id="t:X" class="def" >X</a ></p ><div class="doc" @@ -143,7 +143,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_A.html");}; ><table ><tr ><td class="src" - ><a name="v:X" class="def" + ><a href="" id="v:X" class="def" >X</a ></td ><td class="doc" @@ -156,7 +156,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_A.html");}; ></div ><div class="top" ><p class="src" - ><a name="v:reExport" class="def" + ><a href="" id="v:reExport" class="def" >reExport</a > :: <a href="" >Int</a @@ -172,7 +172,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_A.html");}; ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/AdvanceTypes.html b/html-test/ref/AdvanceTypes.html deleted file mode 100644 index b918a220..00000000 --- a/html-test/ref/AdvanceTypes.html +++ /dev/null @@ -1,97 +0,0 @@ -<!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 - >AdvanceTypes</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_AdvanceTypes.html");}; -//]]> -</script - ></head - ><body - ><div id="package-header" - ><ul class="links" id="page-menu" - ><li - ><a href="" - >Contents</a - ></li - ><li - ><a href="" - >Index</a - ></li - ></ul - ><p class="caption empty" - > </p - ></div - ><div id="content" - ><div id="module-header" - ><table class="info" - ><tr - ><th - >Safe Haskell</th - ><td - >Safe-Inferred</td - ></tr - ></table - ><p class="caption" - >AdvanceTypes</p - ></div - ><div id="interface" - ><h1 - >Documentation</h1 - ><div class="top" - ><p class="src" - ><span class="keyword" - >data</span - > <a name="t:Pattern" class="def" - >Pattern</a - > :: [*] -> * <span class="keyword" - >where</span - ></p - ><div class="subs constructors" - ><p class="caption" - >Constructors</p - ><table - ><tr - ><td class="src" - ><a name="v:Nil" class="def" - >Nil</a - > :: <a href="" - >Pattern</a - > []</td - ><td class="doc empty" - > </td - ></tr - ><tr - ><td class="src" - ><a name="v:Cons" class="def" - >Cons</a - > :: <a href="" - >Maybe</a - > h -> <a href="" - >Pattern</a - > t -> <a href="" - >Pattern</a - > (h : t)</td - ><td class="doc empty" - > </td - ></tr - ></table - ></div - ></div - ></div - ></div - ><div id="footer" - ><p - >Produced by <a href="" - >Haddock</a - > version 2.15.0</p - ></div - ></body - ></html -> diff --git a/html-test/ref/B.html b/html-test/ref/B.html index 87a3a963..6176cbeb 100644 --- a/html-test/ref/B.html +++ b/html-test/ref/B.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_B.html");}; ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -82,7 +82,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_B.html");}; ></div ><div class="top" ><p class="src" - ><a name="v:test" class="def" + ><a href="" id="v:test" class="def" >test</a > :: <a href="" >Int</a @@ -120,7 +120,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_B.html");}; ></div ><div class="top" ><p class="src" - ><a name="v:reExport" class="def" + ><a href="" id="v:reExport" class="def" >reExport</a > :: <a href="" >Int</a @@ -134,7 +134,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_B.html");}; ><p class="src" ><span class="keyword" >data</span - > <a name="t:X" class="def" + > <a href="" id="t:X" class="def" >X</a ></p ><div class="doc" @@ -147,7 +147,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_B.html");}; ><table ><tr ><td class="src" - ><a name="v:X" class="def" + ><a href="" id="v:X" class="def" >X</a ></td ><td class="doc" @@ -164,7 +164,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_B.html");}; ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/Bold.html b/html-test/ref/Bold.html index 7151862d..904d2239 100644 --- a/html-test/ref/Bold.html +++ b/html-test/ref/Bold.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bold.html");}; ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -56,7 +56,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bold.html");}; >Documentation</h1 ><div class="top" ><p class="src" - ><a name="v:foo" class="def" + ><a href="" id="v:foo" class="def" >foo</a > :: t</p ><div class="doc" @@ -92,7 +92,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bold.html");}; ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/Bug1.html b/html-test/ref/Bug1.html index 0bc166e3..28de3c64 100644 --- a/html-test/ref/Bug1.html +++ b/html-test/ref/Bug1.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug1.html");}; ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -62,7 +62,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug1.html");}; ><p class="src" ><span class="keyword" >data</span - > <a name="t:T" class="def" + > <a href="" id="t:T" class="def" >T</a ></p ><div class="doc" @@ -80,7 +80,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug1.html");}; ><table ><tr ><td class="src" - ><a name="v:T" class="def" + ><a href="" id="v:T" class="def" >T</a ></td ><td class="doc empty" @@ -95,7 +95,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug1.html");}; ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/Bug195.html b/html-test/ref/Bug195.html index c647c02d..39816f32 100644 --- a/html-test/ref/Bug195.html +++ b/html-test/ref/Bug195.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug195.html");}; ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -48,7 +48,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug195.html");}; ><p class="src" ><span class="keyword" >data</span - > <a name="t:T" class="def" + > <a href="" id="t:T" class="def" >T</a ></p ><div class="subs constructors" @@ -57,7 +57,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug195.html");}; ><table ><tr ><td class="src" - ><a name="v:A" class="def" + ><a href="" id="v:A" class="def" >A</a ></td ><td class="doc empty" @@ -68,32 +68,34 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug195.html");}; ><div class="subs fields" ><p class="caption" >Fields</p - ><dl - ><dt class="src" - ><a name="v:someField" class="def" - >someField</a - > :: ()</dt - ><dd class="doc" - ><p - >Doc for someField of A</p - ></dd - ><dt class="src" - ><a name="v:someOtherField" class="def" - >someOtherField</a - > :: ()</dt - ><dd class="doc" - ><p - >Doc for someOtherField of A</p - ></dd - ></dl - ><div class="clear" - ></div + ><ul + ><li + ><dfn class="src" + ><a href="" id="v:someField" class="def" + >someField</a + > :: ()</dfn + ><div class="doc" + ><p + >Doc for someField of A</p + ></div + ></li + ><li + ><dfn class="src" + ><a href="" id="v:someOtherField" class="def" + >someOtherField</a + > :: ()</dfn + ><div class="doc" + ><p + >Doc for someOtherField of A</p + ></div + ></li + ></ul ></div ></td ></tr ><tr ><td class="src" - ><a name="v:B" class="def" + ><a href="" id="v:B" class="def" >B</a ></td ><td class="doc empty" @@ -104,32 +106,34 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug195.html");}; ><div class="subs fields" ><p class="caption" >Fields</p - ><dl - ><dt class="src" - ><a name="v:someField" class="def" - >someField</a - > :: ()</dt - ><dd class="doc" - ><p - >Doc for someField of A</p - ></dd - ><dt class="src" - ><a name="v:someOtherField" class="def" - >someOtherField</a - > :: ()</dt - ><dd class="doc" - ><p - >Doc for someOtherField of A</p - ></dd - ></dl - ><div class="clear" - ></div + ><ul + ><li + ><dfn class="src" + ><a href="" id="v:someField" class="def" + >someField</a + > :: ()</dfn + ><div class="doc" + ><p + >Doc for someField of A</p + ></div + ></li + ><li + ><dfn class="src" + ><a href="" id="v:someOtherField" class="def" + >someOtherField</a + > :: ()</dfn + ><div class="doc" + ><p + >Doc for someOtherField of A</p + ></div + ></li + ></ul ></div ></td ></tr ><tr ><td class="src" - ><a name="v:C" class="def" + ><a href="" id="v:C" class="def" >C</a ></td ><td class="doc empty" @@ -140,26 +144,28 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug195.html");}; ><div class="subs fields" ><p class="caption" >Fields</p - ><dl - ><dt class="src" - ><a name="v:someField" class="def" - >someField</a - > :: ()</dt - ><dd class="doc" - ><p - >Doc for someField of A</p - ></dd - ><dt class="src" - ><a name="v:someOtherField" class="def" - >someOtherField</a - > :: ()</dt - ><dd class="doc" - ><p - >Doc for someOtherField of A</p - ></dd - ></dl - ><div class="clear" - ></div + ><ul + ><li + ><dfn class="src" + ><a href="" id="v:someField" class="def" + >someField</a + > :: ()</dfn + ><div class="doc" + ><p + >Doc for someField of A</p + ></div + ></li + ><li + ><dfn class="src" + ><a href="" id="v:someOtherField" class="def" + >someOtherField</a + > :: ()</dfn + ><div class="doc" + ><p + >Doc for someOtherField of A</p + ></div + ></li + ></ul ></div ></td ></tr @@ -172,7 +178,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug195.html");}; ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/Bug2.html b/html-test/ref/Bug2.html index 356f99d3..c28fb609 100644 --- a/html-test/ref/Bug2.html +++ b/html-test/ref/Bug2.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug2.html");}; ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -46,7 +46,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug2.html");}; >Documentation</h1 ><div class="top" ><p class="src" - ><a name="v:x" class="def" + ><a href="" id="v:x" class="def" >x</a > :: <a href="" >A</a @@ -58,7 +58,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug2.html");}; ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/Bug201.html b/html-test/ref/Bug201.html index 893ccbef..58bed8e8 100644 --- a/html-test/ref/Bug201.html +++ b/html-test/ref/Bug201.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug201.html");}; ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -60,7 +60,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug201.html");}; >Documentation</h1 ><div class="top" ><p class="src" - ><a name="v:f" class="def" + ><a href="" id="v:f" class="def" >f</a > :: ()</p ><div class="doc" @@ -72,7 +72,7 @@ should be dropped ></div ><div class="top" ><p class="src" - ><a name="v:g" class="def" + ><a href="" id="v:g" class="def" >g</a > :: ()</p ><div class="doc" @@ -95,7 +95,7 @@ because there's a space before closing @ ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/Bug253.html b/html-test/ref/Bug253.html new file mode 100644 index 00000000..d8e49bd4 --- /dev/null +++ b/html-test/ref/Bug253.html @@ -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 + >Bug253</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_Bug253.html");}; +//]]> +</script + ></head + ><body + ><div id="package-header" + ><ul class="links" id="page-menu" + ><li + ><a href="index.html" + >Contents</a + ></li + ><li + ><a href="doc-index.html" + >Index</a + ></li + ></ul + ><p class="caption empty" + > </p + ></div + ><div id="content" + ><div id="module-header" + ><table class="info" + ><tr + ><th + >Safe Haskell</th + ><td + >Safe</td + ></tr + ></table + ><p class="caption" + >Bug253</p + ></div + ><div id="description" + ><p class="caption" + >Description</p + ><div class="doc" + ><p + >This module tests that if we're trying to link to a <em + >qualified</em + > + identifier that's not in scope, we get an anchor as if it was a + variable. Previous behaviour was to treat it as a type constructor + so issue like #253 arose. Also see <code + >rename</code + > function comments in + source.</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" + ><a href="#v:foo" + >foo</a + > :: ()</li + ></ul + ></div + ><div id="interface" + ><h1 + >Documentation</h1 + ><div class="top" + ><p class="src" + ><a href="#v:foo" id="v:foo" class="def" + >foo</a + > :: ()</p + ><div class="doc" + ><p + >This link should generate <code + >#v</code + > anchor: <code + ><a href="DoesNotExist.html#v:fakeFakeFake" + >fakeFakeFake</a + ></code + ></p + ></div + ></div + ></div + ></div + ><div id="footer" + ><p + >Produced by <a href="http://www.haskell.org/haddock/" + >Haddock</a + > version 2.16.2</p + ></div + ></body + ></html +> diff --git a/html-test/ref/Bug26.html b/html-test/ref/Bug26.html index 117286ce..bdb51231 100644 --- a/html-test/ref/Bug26.html +++ b/html-test/ref/Bug26.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug26.html");}; ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -86,7 +86,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug26.html");}; >Documentation</h1 ><div class="top" ><p class="src" - ><a name="v:f" class="def" + ><a href="" id="v:f" class="def" >f</a > :: ()</p ><div class="doc" @@ -100,7 +100,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug26.html");}; ></div ><div class="top" ><p class="src" - ><a name="v:g" class="def" + ><a href="" id="v:g" class="def" >g</a > :: ()</p ><div class="doc" @@ -112,7 +112,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug26.html");}; ><p class="src" ><span class="keyword" >class</span - > <a name="t:C" class="def" + > <a href="" id="t:C" class="def" >C</a > a <span class="keyword" >where</span @@ -129,7 +129,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug26.html");}; ><p class="caption" >Methods</p ><p class="src" - ><a name="v:c_f" class="def" + ><a href="" id="v:c_f" class="def" >c_f</a > :: a</p ><div class="doc" @@ -145,10 +145,14 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug26.html");}; ><div id="section.i:C" class="show" ><table ><tr - ><td class="src" - ><a href="" - >C</a - > ()</td + ><td class="src clearfix" + ><span class="inst-left" + ><span id="control.i:ic:C:C:1" class="instance expander" onclick="toggleSection('i:ic:C:C:1')" + ></span + > <a href="" + >C</a + > ()</span + ></td ><td class="doc" ><p >instance for ()</p @@ -158,6 +162,20 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug26.html");}; ></p ></td ></tr + ><tr + ><td colspan="2" + ><div id="section.i:ic:C:C:1" class="inst-details hide" + ><div class="subs methods" + ><p class="caption" + >Methods</p + ><p class="src" + ><a href="" + >c_f</a + > :: ()</p + ></div + ></div + ></td + ></tr ></table ></div ></div @@ -168,7 +186,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug26.html");}; ><p >Produced by <a href="" >Haddock</a - > version 2.15.1</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/Bug294.html b/html-test/ref/Bug294.html index ceae2932..59171bd6 100644 --- a/html-test/ref/Bug294.html +++ b/html-test/ref/Bug294.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug294.html");}; ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -48,7 +48,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug294.html");}; ><p class="src" ><span class="keyword" >data</span - > <a name="t:A" class="def" + > <a href="" id="t:A" class="def" >A</a ></p ><div class="subs instances" @@ -57,31 +57,35 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug294.html");}; ><div id="section.i:A" class="show" ><table ><tr - ><td class="src" - ><span class="keyword" - >data</span - > <a href="" - >DP</a - > <a href="" - >A</a - > = <a name="v:ProblemCtor-39-" class="def" - >ProblemCtor'</a - > <a href="" - >A</a + ><td class="src clearfix" + ><span class="inst-left" + ><span class="keyword" + >data</span + > <a href="" + >DP</a + > <a href="" + >A</a + > = <a href="" id="v:ProblemCtor-39-" class="def" + >ProblemCtor'</a + > <a href="" + >A</a + ></span ></td ><td class="doc empty" > </td ></tr ><tr - ><td class="src" - ><span class="keyword" - >data</span - > TP <a href="" - >A</a - > = <a name="v:ProblemCtor" class="def" - >ProblemCtor</a - > <a href="" - >A</a + ><td class="src clearfix" + ><span class="inst-left" + ><span class="keyword" + >data</span + > TP <a href="" + >A</a + > = <a href="" id="v:ProblemCtor" class="def" + >ProblemCtor</a + > <a href="" + >A</a + ></span ></td ><td class="doc empty" > </td @@ -92,7 +96,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug294.html");}; ></div ><div class="top" ><p class="src" - ><a name="v:problemField" class="def" + ><a href="" id="v:problemField" class="def" >problemField</a > :: TO <a href="" >A</a @@ -102,7 +106,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug294.html");}; ></div ><div class="top" ><p class="src" - ><a name="v:problemField-39-" class="def" + ><a href="" id="v:problemField-39-" class="def" >problemField'</a > :: DO <a href="" >A</a @@ -112,7 +116,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug294.html");}; ></div ><div class="top" ><p class="src" - ><a name="v:gadtField" class="def" + ><a href="" id="v:gadtField" class="def" >gadtField</a > :: GADT <a href="" >A</a @@ -124,7 +128,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug294.html");}; ><p class="src" ><span class="keyword" >data family</span - > <a name="t:DP" class="def" + > <a href="" id="t:DP" class="def" >DP</a > t :: *</p ><div class="subs instances" @@ -133,17 +137,19 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug294.html");}; ><div id="section.i:DP" class="show" ><table ><tr - ><td class="src" - ><span class="keyword" - >data</span - > <a href="" - >DP</a - > <a href="" - >A</a - > = <a name="v:ProblemCtor-39-" class="def" - >ProblemCtor'</a - > <a href="" - >A</a + ><td class="src clearfix" + ><span class="inst-left" + ><span class="keyword" + >data</span + > <a href="" + >DP</a + > <a href="" + >A</a + > = <a href="" id="v:ProblemCtor-39-" class="def" + >ProblemCtor'</a + > <a href="" + >A</a + ></span ></td ><td class="doc empty" > </td @@ -158,7 +164,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug294.html");}; ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/Bug298.html b/html-test/ref/Bug298.html index 040eccc4..9e52da5e 100644 --- a/html-test/ref/Bug298.html +++ b/html-test/ref/Bug298.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug298.html");}; ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -72,31 +72,31 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug298.html");}; >Documentation</h1 ><div class="top" ><p class="src" - ><a name="v:-60--94--62-" class="def" + ><a href="" id="v:-60--94--62-" class="def" >(<^>)</a > :: (a -> a) -> a -> a</p ></div ><div class="top" ><p class="src" - ><a name="v:-60--94-" class="def" + ><a href="" id="v:-60--94-" class="def" >(<^)</a > :: a -> a -> a</p ></div ><div class="top" ><p class="src" - ><a name="v:-94--62-" class="def" + ><a href="" id="v:-94--62-" class="def" >(^>)</a > :: a -> a -> a</p ></div ><div class="top" ><p class="src" - ><a name="v:-8902--94-" class="def" + ><a href="" id="v:-8902--94-" class="def" >(⋆^)</a > :: a -> a -> a</p ></div ><div class="top" ><p class="src" - ><a name="v:f" class="def" + ><a href="" id="v:f" class="def" >f</a > :: ()</p ><div class="doc" @@ -126,7 +126,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug298.html");}; ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/Bug3.html b/html-test/ref/Bug3.html index 7300abfe..70e799be 100644 --- a/html-test/ref/Bug3.html +++ b/html-test/ref/Bug3.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug3.html");}; ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -58,7 +58,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug3.html");}; >Documentation</h1 ><div class="top" ><p class="src" - ><a name="v:foo" class="def" + ><a href="" id="v:foo" class="def" >foo</a > :: <a href="" >Int</a @@ -75,7 +75,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug3.html");}; ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/Bug308.html b/html-test/ref/Bug308.html index 517a1cd9..23761bec 100644 --- a/html-test/ref/Bug308.html +++ b/html-test/ref/Bug308.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug308.html");}; ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -60,7 +60,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug308.html");}; >Documentation</h1 ><div class="top" ><p class="src" - ><a name="v:f" class="def" + ><a href="" id="v:f" class="def" >f</a > :: ()</p ><div class="doc" @@ -76,7 +76,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug308.html");}; ></div ><div class="top" ><p class="src" - ><a name="v:g" class="def" + ><a href="" id="v:g" class="def" >g</a > :: ()</p ><div class="doc" @@ -104,7 +104,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug308.html");}; ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/Bug308CrossModule.html b/html-test/ref/Bug308CrossModule.html index 6a053d3c..fea4c4a5 100644 --- a/html-test/ref/Bug308CrossModule.html +++ b/html-test/ref/Bug308CrossModule.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug308CrossModule.html ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -56,7 +56,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug308CrossModule.html >Documentation</h1 ><div class="top" ><p class="src" - ><a name="v:h" class="def" + ><a href="" id="v:h" class="def" >h</a > :: ()</p ><div class="doc" @@ -84,7 +84,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug308CrossModule.html ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/Bug310.html b/html-test/ref/Bug310.html index 926d6cf2..62717c76 100644 --- a/html-test/ref/Bug310.html +++ b/html-test/ref/Bug310.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug310.html");}; ><th >Safe Haskell</th ><td - >None</td + >Safe</td ></tr ></table ><p class="caption" @@ -62,7 +62,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug310.html");}; ><p class="src" ><span class="keyword" >type family</span - > a <a name="t:-43-" class="def" + > a <a href="" id="t:-43-" class="def" >+</a > b :: <a href="" >Nat</a @@ -82,7 +82,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug310.html");}; ><p >Produced by <a href="" >Haddock</a - > version 2.15.1</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/Bug313.html b/html-test/ref/Bug313.html index 5fa34eff..5477cf2c 100644 --- a/html-test/ref/Bug313.html +++ b/html-test/ref/Bug313.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug313.html");}; ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -73,7 +73,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug313.html");}; >Documentation</h1 ><div class="top" ><p class="src" - ><a name="v:a" class="def" + ><a href="" id="v:a" class="def" >a</a > :: a</p ><div class="doc" @@ -97,7 +97,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug313.html");}; ></div ><div class="top" ><p class="src" - ><a name="v:b" class="def" + ><a href="" id="v:b" class="def" >b</a > :: a</p ><div class="doc" @@ -125,7 +125,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug313.html");}; ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/Bug335.html b/html-test/ref/Bug335.html index 76c39951..6b3dc613 100644 --- a/html-test/ref/Bug335.html +++ b/html-test/ref/Bug335.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug335.html");}; ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -60,13 +60,13 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug335.html");}; >Documentation</h1 ><div class="top" ><p class="src" - ><a name="v:f" class="def" + ><a href="" id="v:f" class="def" >f</a > :: ()</p ><div class="doc" - ><h3 id="control.ch:f0" class="caption collapser" onclick="toggleSection('ch:f0')" + ><h3 id="control.ch:f0" class="caption expander" onclick="toggleSection('ch:f0')" >ExF:</h3 - ><div id="section.ch:f0" class="show" + ><div id="section.ch:f0" class="hide" ><p >abc</p ></div @@ -74,13 +74,13 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug335.html");}; ></div ><div class="top" ><p class="src" - ><a name="v:g" class="def" + ><a href="" id="v:g" class="def" >g</a > :: ()</p ><div class="doc" - ><h3 id="control.ch:g0" class="caption collapser" onclick="toggleSection('ch:g0')" + ><h3 id="control.ch:g0" class="caption expander" onclick="toggleSection('ch:g0')" >ExG:</h3 - ><div id="section.ch:g0" class="show" + ><div id="section.ch:g0" class="hide" ><pre class="screen" ><code class="prompt" >>>> </code @@ -118,7 +118,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug335.html");}; ><p >Produced by <a href="" >Haddock</a - > version 2.15.1</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/Ticket253_2.html b/html-test/ref/Bug387.html index 2e20f6ba..7b605fd0 100644 --- a/html-test/ref/Ticket253_2.html +++ b/html-test/ref/Bug387.html @@ -3,13 +3,13 @@ ><head ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title - >Ticket253_2</title + >Bug387</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_Ticket253_2.html");}; +window.onload = function () {pageLoad();setSynopsis("mini_Bug387.html");}; //]]> </script ></head @@ -35,11 +35,25 @@ window.onload = function () {pageLoad();setSynopsis("mini_Ticket253_2.html");}; ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" - >Ticket253_2</p + >Bug387</p + ></div + ><div id="table-of-contents" + ><p class="caption" + >Contents</p + ><ul + ><li + ><a href="" + >Section1</a + ></li + ><li + ><a href="" + >Section2</a + ></li + ></ul ></div ><div id="synopsis" ><p id="control.syn" class="caption expander" onclick="toggleSection('syn')" @@ -47,56 +61,42 @@ window.onload = function () {pageLoad();setSynopsis("mini_Ticket253_2.html");}; ><ul id="section.syn" class="hide" onclick="toggleSection('syn')" ><li class="src short" ><a href="" - >bar</a + >test1</a > :: <a href="" >Int</a ></li ><li class="src short" - ><span class="keyword" - >data</span - > <a href="" - >Baz</a - > = <a href="" - >Baz</a + ><a href="" + >test2</a + > :: <a href="" + >Int</a ></li ></ul ></div ><div id="interface" - ><h1 - >Documentation</h1 + ><h1 id="g:1" + >Section1<a name="a:section1" + ></a + ></h1 ><div class="top" ><p class="src" - ><a name="v:bar" class="def" - >bar</a + ><a href="" id="v:test1" class="def" + >test1</a > :: <a href="" >Int</a ></p - ><div class="doc" - ><p - >Comment</p - ></div ></div + ><h1 id="g:2" + >Section2<a name="a:section2" + ></a + ></h1 ><div class="top" ><p class="src" - ><span class="keyword" - >data</span - > <a name="t:Baz" class="def" - >Baz</a + ><a href="" id="v:test2" class="def" + >test2</a + > :: <a href="" + >Int</a ></p - ><div class="subs constructors" - ><p class="caption" - >Constructors</p - ><table - ><tr - ><td class="src" - ><a name="v:Baz" class="def" - >Baz</a - ></td - ><td class="doc empty" - > </td - ></tr - ></table - ></div ></div ></div ></div @@ -104,7 +104,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Ticket253_2.html");}; ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/Bug4.html b/html-test/ref/Bug4.html index 5be058a5..f1fab937 100644 --- a/html-test/ref/Bug4.html +++ b/html-test/ref/Bug4.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug4.html");}; ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -58,7 +58,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug4.html");}; >Documentation</h1 ><div class="top" ><p class="src" - ><a name="v:foo" class="def" + ><a href="" id="v:foo" class="def" >foo</a > :: <a href="" >Int</a @@ -74,7 +74,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug4.html");}; ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/Bug6.html b/html-test/ref/Bug6.html index b95b8be8..407a031c 100644 --- a/html-test/ref/Bug6.html +++ b/html-test/ref/Bug6.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug6.html");}; ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -132,7 +132,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug6.html");}; ><p class="src" ><span class="keyword" >data</span - > <a name="t:A" class="def" + > <a href="" id="t:A" class="def" >A</a ></p ><div class="doc" @@ -145,7 +145,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug6.html");}; ><table ><tr ><td class="src" - ><a name="v:A" class="def" + ><a href="" id="v:A" class="def" >A</a > <a href="" >Int</a @@ -160,7 +160,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug6.html");}; ><p class="src" ><span class="keyword" >data</span - > <a name="t:B" class="def" + > <a href="" id="t:B" class="def" >B</a ></p ><div class="doc" @@ -174,7 +174,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug6.html");}; ><table ><tr ><td class="src" - ><a name="v:B" class="def" + ><a href="" id="v:B" class="def" >B</a ></td ><td class="doc empty" @@ -185,18 +185,18 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug6.html");}; ><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 + ><ul + ><li + ><dfn class="src" + ><a href="" id="v:b" class="def" + >b</a + > :: <a href="" + >Int</a + ></dfn + ><div class="doc empty" + > </div + ></li + ></ul ></div ></td ></tr @@ -207,7 +207,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug6.html");}; ><p class="src" ><span class="keyword" >data</span - > <a name="t:C" class="def" + > <a href="" id="t:C" class="def" >C</a ></p ><div class="doc" @@ -220,7 +220,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug6.html");}; ><table ><tr ><td class="src" - ><a name="v:C" class="def" + ><a href="" id="v:C" class="def" >C</a ></td ><td class="doc empty" @@ -231,26 +231,28 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug6.html");}; ><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 + ><ul + ><li + ><dfn class="src" + ><a href="" id="v:c1" class="def" + >c1</a + > :: <a href="" + >Int</a + ></dfn + ><div class="doc empty" + > </div + ></li + ><li + ><dfn class="src" + ><a href="" id="v:c2" class="def" + >c2</a + > :: <a href="" + >Int</a + ></dfn + ><div class="doc empty" + > </div + ></li + ></ul ></div ></td ></tr @@ -261,7 +263,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug6.html");}; ><p class="src" ><span class="keyword" >data</span - > <a name="t:D" class="def" + > <a href="" id="t:D" class="def" >D</a ></p ><div class="doc" @@ -275,7 +277,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug6.html");}; ><table ><tr ><td class="src" - ><a name="v:D" class="def" + ><a href="" id="v:D" class="def" >D</a > <a href="" >Int</a @@ -292,7 +294,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug6.html");}; ><p class="src" ><span class="keyword" >newtype</span - > <a name="t:E" class="def" + > <a href="" id="t:E" class="def" >E</a ></p ><div class="doc" @@ -305,7 +307,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug6.html");}; ><table ><tr ><td class="src" - ><a name="v:E" class="def" + ><a href="" id="v:E" class="def" >E</a > <a href="" >Int</a @@ -322,7 +324,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug6.html");}; ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/Bug7.html b/html-test/ref/Bug7.html index 9afaa9a0..f3bd4db6 100644 --- a/html-test/ref/Bug7.html +++ b/html-test/ref/Bug7.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug7.html");}; ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -77,7 +77,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug7.html");}; ><p class="src" ><span class="keyword" >data</span - > <a name="t:Foo" class="def" + > <a href="" id="t:Foo" class="def" >Foo</a ></p ><div class="doc" @@ -90,7 +90,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug7.html");}; ><table ><tr ><td class="src" - ><a name="v:Foo" class="def" + ><a href="" id="v:Foo" class="def" >Foo</a ></td ><td class="doc empty" @@ -104,19 +104,29 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug7.html");}; ><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 class="src clearfix" + ><span class="inst-left" + ><span id="control.i:id:Foo:Bar:1" class="instance expander" onclick="toggleSection('i:id:Foo:Bar:1')" + ></span + > <a href="" + >Bar</a + > <a href="" + >Foo</a + > <a href="" + >Foo</a + ></span ></td ><td class="doc" ><p >Just one instance</p ></td ></tr + ><tr + ><td colspan="2" + ><div id="section.i:id:Foo:Bar:1" class="inst-details hide" + ></div + ></td + ></tr ></table ></div ></div @@ -125,7 +135,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug7.html");}; ><p class="src" ><span class="keyword" >class</span - > <a name="t:Bar" class="def" + > <a href="" id="t:Bar" class="def" >Bar</a > x y</p ><div class="doc" @@ -138,19 +148,29 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug7.html");}; ><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 class="src clearfix" + ><span class="inst-left" + ><span id="control.i:ic:Bar:Bar:1" class="instance expander" onclick="toggleSection('i:ic:Bar:Bar:1')" + ></span + > <a href="" + >Bar</a + > <a href="" + >Foo</a + > <a href="" + >Foo</a + ></span ></td ><td class="doc" ><p >Just one instance</p ></td ></tr + ><tr + ><td colspan="2" + ><div id="section.i:ic:Bar:Bar:1" class="inst-details hide" + ></div + ></td + ></tr ></table ></div ></div @@ -161,7 +181,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug7.html");}; ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/Bug8.html b/html-test/ref/Bug8.html index 288ee9f5..6f0bc654 100644 --- a/html-test/ref/Bug8.html +++ b/html-test/ref/Bug8.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug8.html");}; ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -48,7 +48,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug8.html");}; ><p class="src" ><span class="keyword" >data</span - > <a name="t:Typ" class="def" + > <a href="" id="t:Typ" class="def" >Typ</a ></p ><div class="subs constructors" @@ -57,7 +57,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug8.html");}; ><table ><tr ><td class="src" - ><a name="v:Type" class="def" + ><a href="" id="v:Type" class="def" >Type</a > (<a href="" >Typ</a @@ -69,7 +69,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug8.html");}; ></tr ><tr ><td class="src" - ><a name="v:TFree" class="def" + ><a href="" id="v:TFree" class="def" >TFree</a > (<a href="" >Typ</a @@ -84,7 +84,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug8.html");}; ></div ><div class="top" ><p class="src" - ><a name="v:-45--45--62-" class="def" + ><a href="" id="v:-45--45--62-" class="def" >(-->)</a > :: t -> t1 -> <a href="" >Typ</a @@ -96,9 +96,11 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug8.html");}; ></div ><div class="top" ><p class="src" - ><a name="v:-45--45--45--62-" class="def" + ><a href="" id="v:-45--45--45--62-" class="def" >(--->)</a - > :: [a] -> <a href="" + > :: <a href="" + >Foldable</a + > t0 => t0 t -> <a href="" >Typ</a > -> <a href="" >Typ</a @@ -110,19 +112,19 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug8.html");}; ></div ><div class="top" ><p class="src" - ><a name="v:s" class="def" + ><a href="" id="v:s" class="def" >s</a > :: t</p ></div ><div class="top" ><p class="src" - ><a name="v:t" class="def" + ><a href="" id="v:t" class="def" >t</a > :: t</p ></div ><div class="top" ><p class="src" - ><a name="v:main" class="def" + ><a href="" id="v:main" class="def" >main</a > :: t</p ></div @@ -132,7 +134,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug8.html");}; ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/Bug85.html b/html-test/ref/Bug85.html index bb1f03a3..e1f0431f 100644 --- a/html-test/ref/Bug85.html +++ b/html-test/ref/Bug85.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug85.html");}; ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -48,7 +48,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug85.html");}; ><p class="src" ><span class="keyword" >data</span - > <a name="t:Foo" class="def" + > <a href="" id="t:Foo" class="def" >Foo</a > :: (* -> *) -> * -> * <span class="keyword" >where</span @@ -59,7 +59,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug85.html");}; ><table ><tr ><td class="src" - ><a name="v:Bar" class="def" + ><a href="" id="v:Bar" class="def" >Bar</a > :: f x -> <a href="" >Foo</a @@ -74,7 +74,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug85.html");}; ><p class="src" ><span class="keyword" >data</span - > <a name="t:Baz" class="def" + > <a href="" id="t:Baz" class="def" >Baz</a > :: * <span class="keyword" >where</span @@ -85,7 +85,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug85.html");}; ><table ><tr ><td class="src" - ><a name="v:Baz-39-" class="def" + ><a href="" id="v:Baz-39-" class="def" >Baz'</a > :: <a href="" >Baz</a @@ -100,7 +100,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug85.html");}; ><p class="src" ><span class="keyword" >data</span - > <a name="t:Qux" class="def" + > <a href="" id="t:Qux" class="def" >Qux</a > <span class="keyword" >where</span @@ -111,7 +111,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug85.html");}; ><table ><tr ><td class="src" - ><a name="v:Quux" class="def" + ><a href="" id="v:Quux" class="def" >Quux</a > :: <a href="" >Qux</a @@ -128,7 +128,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug85.html");}; ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/BugDeprecated.html b/html-test/ref/BugDeprecated.html index 69521b95..28cf89be 100644 --- a/html-test/ref/BugDeprecated.html +++ b/html-test/ref/BugDeprecated.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_BugDeprecated.html");} ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -88,7 +88,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_BugDeprecated.html");} >Documentation</h1 ><div class="top" ><p class="src" - ><a name="v:foo" class="def" + ><a href="" id="v:foo" class="def" >foo</a > :: <a href="" >Int</a @@ -102,7 +102,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_BugDeprecated.html");} ></div ><div class="top" ><p class="src" - ><a name="v:bar" class="def" + ><a href="" id="v:bar" class="def" >bar</a > :: <a href="" >Int</a @@ -116,7 +116,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_BugDeprecated.html");} ></div ><div class="top" ><p class="src" - ><a name="v:baz" class="def" + ><a href="" id="v:baz" class="def" >baz</a > :: <a href="" >Int</a @@ -130,7 +130,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_BugDeprecated.html");} ></div ><div class="top" ><p class="src" - ><a name="v:one" class="def" + ><a href="" id="v:one" class="def" >one</a > :: <a href="" >Int</a @@ -146,7 +146,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_BugDeprecated.html");} ></div ><div class="top" ><p class="src" - ><a name="v:two" class="def" + ><a href="" id="v:two" class="def" >two</a > :: <a href="" >Int</a @@ -160,7 +160,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_BugDeprecated.html");} ></div ><div class="top" ><p class="src" - ><a name="v:three" class="def" + ><a href="" id="v:three" class="def" >three</a > :: <a href="" >Int</a @@ -178,7 +178,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_BugDeprecated.html");} ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/BugExportHeadings.html b/html-test/ref/BugExportHeadings.html index 89811402..d6ae0359 100644 --- a/html-test/ref/BugExportHeadings.html +++ b/html-test/ref/BugExportHeadings.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_BugExportHeadings.html ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -118,7 +118,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_BugExportHeadings.html >Foo</h1 ><div class="top" ><p class="src" - ><a name="v:foo" class="def" + ><a href="" id="v:foo" class="def" >foo</a > :: <a href="" >Int</a @@ -128,7 +128,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_BugExportHeadings.html >Bar</h1 ><div class="top" ><p class="src" - ><a name="v:bar" class="def" + ><a href="" id="v:bar" class="def" >bar</a > :: <a href="" >Int</a @@ -138,7 +138,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_BugExportHeadings.html >Baz</h1 ><div class="top" ><p class="src" - ><a name="v:baz" class="def" + ><a href="" id="v:baz" class="def" >baz</a > :: <a href="" >Int</a @@ -148,7 +148,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_BugExportHeadings.html >One</h1 ><div class="top" ><p class="src" - ><a name="v:one" class="def" + ><a href="" id="v:one" class="def" >one</a > :: <a href="" >Int</a @@ -164,7 +164,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_BugExportHeadings.html >Two</h1 ><div class="top" ><p class="src" - ><a name="v:two" class="def" + ><a href="" id="v:two" class="def" >two</a > :: <a href="" >Int</a @@ -180,7 +180,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_BugExportHeadings.html >Three</h1 ><div class="top" ><p class="src" - ><a name="v:three" class="def" + ><a href="" id="v:three" class="def" >three</a > :: <a href="" >Int</a @@ -198,7 +198,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_BugExportHeadings.html ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/Bugs.html b/html-test/ref/Bugs.html index 326d8bcd..78807f43 100644 --- a/html-test/ref/Bugs.html +++ b/html-test/ref/Bugs.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bugs.html");}; ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -48,7 +48,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bugs.html");}; ><p class="src" ><span class="keyword" >data</span - > <a name="t:A" class="def" + > <a href="" id="t:A" class="def" >A</a > a</p ><div class="subs constructors" @@ -57,7 +57,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bugs.html");}; ><table ><tr ><td class="src" - ><a name="v:A" class="def" + ><a href="" id="v:A" class="def" >A</a > a (a -> <a href="" >Int</a @@ -74,7 +74,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bugs.html");}; ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/CrossPackageDocs.html b/html-test/ref/CrossPackageDocs.html index 0a9a7ad6..39d216e0 100644 --- a/html-test/ref/CrossPackageDocs.html +++ b/html-test/ref/CrossPackageDocs.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_CrossPackageDocs.html" ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" diff --git a/html-test/ref/DeprecatedClass.html b/html-test/ref/DeprecatedClass.html index c8799bf2..7bf4b41c 100644 --- a/html-test/ref/DeprecatedClass.html +++ b/html-test/ref/DeprecatedClass.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedClass.html") ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -82,7 +82,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedClass.html") ><p class="src" ><span class="keyword" >class</span - > <a name="t:SomeClass" class="def" + > <a href="" id="t:SomeClass" class="def" >SomeClass</a > a <span class="keyword" >where</span @@ -99,7 +99,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedClass.html") ><p class="caption" >Methods</p ><p class="src" - ><a name="v:foo" class="def" + ><a href="" id="v:foo" class="def" >foo</a > :: a -> a</p ><div class="doc" @@ -116,7 +116,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedClass.html") ><p class="src" ><span class="keyword" >class</span - > <a name="t:SomeOtherClass" class="def" + > <a href="" id="t:SomeOtherClass" class="def" >SomeOtherClass</a > a <span class="keyword" >where</span @@ -131,7 +131,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedClass.html") ><p class="caption" >Methods</p ><p class="src" - ><a name="v:bar" class="def" + ><a href="" id="v:bar" class="def" >bar</a > :: a -> a</p ><div class="doc" @@ -148,7 +148,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedClass.html") ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/DeprecatedData.html b/html-test/ref/DeprecatedData.html index bccaeb26..0a90e110 100644 --- a/html-test/ref/DeprecatedData.html +++ b/html-test/ref/DeprecatedData.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedData.html"); ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -86,7 +86,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedData.html"); ><p class="src" ><span class="keyword" >data</span - > <a name="t:Foo" class="def" + > <a href="" id="t:Foo" class="def" >Foo</a ></p ><div class="doc" @@ -103,7 +103,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedData.html"); ><table ><tr ><td class="src" - ><a name="v:Foo" class="def" + ><a href="" id="v:Foo" class="def" >Foo</a ></td ><td class="doc" @@ -117,7 +117,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedData.html"); ></tr ><tr ><td class="src" - ><a name="v:Bar" class="def" + ><a href="" id="v:Bar" class="def" >Bar</a ></td ><td class="doc" @@ -136,7 +136,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedData.html"); ><p class="src" ><span class="keyword" >data</span - > <a name="t:One" class="def" + > <a href="" id="t:One" class="def" >One</a ></p ><div class="doc" @@ -151,7 +151,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedData.html"); ><table ><tr ><td class="src" - ><a name="v:One" class="def" + ><a href="" id="v:One" class="def" >One</a ></td ><td class="doc" @@ -163,7 +163,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedData.html"); ></tr ><tr ><td class="src" - ><a name="v:Two" class="def" + ><a href="" id="v:Two" class="def" >Two</a ></td ><td class="doc" @@ -182,7 +182,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedData.html"); ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/DeprecatedFunction.html b/html-test/ref/DeprecatedFunction.html index 53937867..b015bc95 100644 --- a/html-test/ref/DeprecatedFunction.html +++ b/html-test/ref/DeprecatedFunction.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedFunction.htm ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -64,7 +64,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedFunction.htm >Documentation</h1 ><div class="top" ><p class="src" - ><a name="v:foo" class="def" + ><a href="" id="v:foo" class="def" >foo</a > :: <a href="" >Int</a @@ -84,7 +84,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedFunction.htm ></div ><div class="top" ><p class="src" - ><a name="v:bar" class="def" + ><a href="" id="v:bar" class="def" >bar</a > :: <a href="" >Int</a @@ -100,7 +100,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedFunction.htm ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/DeprecatedFunction2.html b/html-test/ref/DeprecatedFunction2.html index 2ca11a32..46a509ee 100644 --- a/html-test/ref/DeprecatedFunction2.html +++ b/html-test/ref/DeprecatedFunction2.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedFunction2.ht ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -58,7 +58,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedFunction2.ht >Documentation</h1 ><div class="top" ><p class="src" - ><a name="v:foo" class="def" + ><a href="" id="v:foo" class="def" >foo</a > :: <a href="" >Int</a @@ -76,7 +76,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedFunction2.ht ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/DeprecatedFunction3.html b/html-test/ref/DeprecatedFunction3.html index 7cbf5a42..1749d024 100644 --- a/html-test/ref/DeprecatedFunction3.html +++ b/html-test/ref/DeprecatedFunction3.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedFunction3.ht ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -58,7 +58,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedFunction3.ht >Documentation</h1 ><div class="top" ><p class="src" - ><a name="v:foo" class="def" + ><a href="" id="v:foo" class="def" >foo</a > :: <a href="" >Integer</a @@ -76,7 +76,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedFunction3.ht ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/DeprecatedModule.html b/html-test/ref/DeprecatedModule.html index 3864ce21..1dd3fb45 100644 --- a/html-test/ref/DeprecatedModule.html +++ b/html-test/ref/DeprecatedModule.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedModule.html" ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -62,7 +62,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedModule.html" >Documentation</h1 ><div class="top" ><p class="src" - ><a name="v:foo" class="def" + ><a href="" id="v:foo" class="def" >foo</a > :: <a href="" >Int</a @@ -74,7 +74,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedModule.html" ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/DeprecatedModule2.html b/html-test/ref/DeprecatedModule2.html index 104f4d97..dea6dc97 100644 --- a/html-test/ref/DeprecatedModule2.html +++ b/html-test/ref/DeprecatedModule2.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedModule2.html ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -56,7 +56,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedModule2.html >Documentation</h1 ><div class="top" ><p class="src" - ><a name="v:foo" class="def" + ><a href="" id="v:foo" class="def" >foo</a > :: <a href="" >Int</a @@ -68,7 +68,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedModule2.html ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/DeprecatedNewtype.html b/html-test/ref/DeprecatedNewtype.html index 143e60b7..c521ec33 100644 --- a/html-test/ref/DeprecatedNewtype.html +++ b/html-test/ref/DeprecatedNewtype.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedNewtype.html ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -74,7 +74,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedNewtype.html ><p class="src" ><span class="keyword" >newtype</span - > <a name="t:SomeNewType" class="def" + > <a href="" id="t:SomeNewType" class="def" >SomeNewType</a ></p ><div class="doc" @@ -91,7 +91,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedNewtype.html ><table ><tr ><td class="src" - ><a name="v:SomeNewTypeConst" class="def" + ><a href="" id="v:SomeNewTypeConst" class="def" >SomeNewTypeConst</a > <a href="" >String</a @@ -112,7 +112,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedNewtype.html ><p class="src" ><span class="keyword" >newtype</span - > <a name="t:SomeOtherNewType" class="def" + > <a href="" id="t:SomeOtherNewType" class="def" >SomeOtherNewType</a ></p ><div class="doc" @@ -127,7 +127,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedNewtype.html ><table ><tr ><td class="src" - ><a name="v:SomeOtherNewTypeConst" class="def" + ><a href="" id="v:SomeOtherNewTypeConst" class="def" >SomeOtherNewTypeConst</a > <a href="" >String</a @@ -148,7 +148,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedNewtype.html ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/DeprecatedReExport.html b/html-test/ref/DeprecatedReExport.html index 5aa29f28..f73c2996 100644 --- a/html-test/ref/DeprecatedReExport.html +++ b/html-test/ref/DeprecatedReExport.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedReExport.htm ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -84,7 +84,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedReExport.htm >Re-exported from an other module</h1 ><div class="top" ><p class="src" - ><a name="v:foo" class="def" + ><a href="" id="v:foo" class="def" >foo</a > :: <a href="" >Int</a @@ -117,7 +117,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedReExport.htm ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/DeprecatedRecord.html b/html-test/ref/DeprecatedRecord.html index 841dbf01..5991b7dc 100644 --- a/html-test/ref/DeprecatedRecord.html +++ b/html-test/ref/DeprecatedRecord.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedRecord.html" ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -76,7 +76,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedRecord.html" ><p class="src" ><span class="keyword" >data</span - > <a name="t:Foo" class="def" + > <a href="" id="t:Foo" class="def" >Foo</a ></p ><div class="doc" @@ -89,7 +89,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedRecord.html" ><table ><tr ><td class="src" - ><a name="v:Foo" class="def" + ><a href="" id="v:Foo" class="def" >Foo</a ></td ><td class="doc empty" @@ -100,34 +100,36 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedRecord.html" ><div class="subs fields" ><p class="caption" >Fields</p - ><dl - ><dt class="src" - ><a name="v:fooName" class="def" - >fooName</a - > :: <a href="" - >String</a - ></dt - ><dd class="doc" - ><p - >some name</p - ></dd - ><dt class="src" - ><a name="v:fooValue" class="def" - >fooValue</a - > :: <a href="" - >Int</a - ></dt - ><dd class="doc" - ><div class="warning" + ><ul + ><li + ><dfn class="src" + ><a href="" id="v:fooName" class="def" + >fooName</a + > :: <a href="" + >String</a + ></dfn + ><div class="doc" ><p - >Deprecated: do not use this</p + >some name</p ></div - ><p - >some value</p - ></dd - ></dl - ><div class="clear" - ></div + ></li + ><li + ><dfn class="src" + ><a href="" id="v:fooValue" class="def" + >fooValue</a + > :: <a href="" + >Int</a + ></dfn + ><div class="doc" + ><div class="warning" + ><p + >Deprecated: do not use this</p + ></div + ><p + >some value</p + ></div + ></li + ></ul ></div ></td ></tr @@ -140,7 +142,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedRecord.html" ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/DeprecatedTypeFamily.html b/html-test/ref/DeprecatedTypeFamily.html index c029ef21..175c1b25 100644 --- a/html-test/ref/DeprecatedTypeFamily.html +++ b/html-test/ref/DeprecatedTypeFamily.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedTypeFamily.h ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -66,7 +66,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedTypeFamily.h ><p class="src" ><span class="keyword" >data family</span - > <a name="t:SomeTypeFamily" class="def" + > <a href="" id="t:SomeTypeFamily" class="def" >SomeTypeFamily</a > k :: * -> *</p ><div class="doc" @@ -82,7 +82,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedTypeFamily.h ><p class="src" ><span class="keyword" >data family</span - > <a name="t:SomeOtherTypeFamily" class="def" + > <a href="" id="t:SomeOtherTypeFamily" class="def" >SomeOtherTypeFamily</a > k :: * -> *</p ><div class="doc" @@ -98,7 +98,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedTypeFamily.h ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/DeprecatedTypeSynonym.html b/html-test/ref/DeprecatedTypeSynonym.html index 346557c0..0f986624 100644 --- a/html-test/ref/DeprecatedTypeSynonym.html +++ b/html-test/ref/DeprecatedTypeSynonym.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedTypeSynonym. ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -70,7 +70,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedTypeSynonym. ><p class="src" ><span class="keyword" >type</span - > <a name="t:TypeSyn" class="def" + > <a href="" id="t:TypeSyn" class="def" >TypeSyn</a > = <a href="" >String</a @@ -88,7 +88,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedTypeSynonym. ><p class="src" ><span class="keyword" >type</span - > <a name="t:OtherTypeSyn" class="def" + > <a href="" id="t:OtherTypeSyn" class="def" >OtherTypeSyn</a > = <a href="" >String</a @@ -106,7 +106,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedTypeSynonym. ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/Examples.html b/html-test/ref/Examples.html index 1d06e32b..57c359df 100644 --- a/html-test/ref/Examples.html +++ b/html-test/ref/Examples.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Examples.html");}; ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -60,7 +60,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Examples.html");}; >Documentation</h1 ><div class="top" ><p class="src" - ><a name="v:fib" class="def" + ><a href="" id="v:fib" class="def" >fib</a > :: <a href="" >Integer</a @@ -167,7 +167,7 @@ bar ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/Extensions.html b/html-test/ref/Extensions.html index b2acb26e..780466b8 100644 --- a/html-test/ref/Extensions.html +++ b/html-test/ref/Extensions.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Extensions.html");}; ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ><tr ><th @@ -68,7 +68,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Extensions.html");}; >Documentation</h1 ><div class="top" ><p class="src" - ><a name="v:foobar" class="def" + ><a href="" id="v:foobar" class="def" >foobar</a > :: t</p ><div class="doc" @@ -82,7 +82,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Extensions.html");}; ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/FunArgs.html b/html-test/ref/FunArgs.html index 5c1fe892..d889b611 100644 --- a/html-test/ref/FunArgs.html +++ b/html-test/ref/FunArgs.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_FunArgs.html");}; ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -46,7 +46,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_FunArgs.html");}; >Documentation</h1 ><div class="top" ><p class="src" - ><a name="v:f" class="def" + ><a href="" id="v:f" class="def" >f</a ></p ><div class="subs arguments" @@ -110,7 +110,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_FunArgs.html");}; ></div ><div class="top" ><p class="src" - ><a name="v:g" class="def" + ><a href="" id="v:g" class="def" >g</a ></p ><div class="subs arguments" @@ -154,7 +154,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_FunArgs.html");}; ></div ><div class="top" ><p class="src" - ><a name="v:h" class="def" + ><a href="" id="v:h" class="def" >h</a ></p ><div class="subs arguments" @@ -198,7 +198,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_FunArgs.html");}; ></div ><div class="top" ><p class="src" - ><a name="v:i" class="def" + ><a href="" id="v:i" class="def" >i</a ></p ><div class="subs arguments" @@ -238,7 +238,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_FunArgs.html");}; ></div ><div class="top" ><p class="src" - ><a name="v:j" class="def" + ><a href="" id="v:j" class="def" >j</a ></p ><div class="subs arguments" @@ -274,7 +274,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_FunArgs.html");}; ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/GADTRecords.html b/html-test/ref/GADTRecords.html index 80e21e69..b5b60d0f 100644 --- a/html-test/ref/GADTRecords.html +++ b/html-test/ref/GADTRecords.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_GADTRecords.html");}; ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -110,7 +110,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_GADTRecords.html");}; ><p class="src" ><span class="keyword" >data</span - > <a name="t:H1" class="def" + > <a href="" id="t:H1" class="def" >H1</a > a b <span class="keyword" >where</span @@ -125,7 +125,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_GADTRecords.html");}; ><table ><tr ><td class="src" - ><a name="v:C1" class="def" + ><a href="" id="v:C1" class="def" >C1</a > :: <a href="" >H1</a @@ -135,7 +135,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_GADTRecords.html");}; ></tr ><tr ><td class="src" - ><a name="v:C2" class="def" + ><a href="" id="v:C2" class="def" >C2</a > :: <a href="" >Ord</a @@ -147,7 +147,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_GADTRecords.html");}; ></tr ><tr ><td class="src" - ><a name="v:C3" class="def" + ><a href="" id="v:C3" class="def" >C3</a > :: <a href="" >Int</a @@ -166,26 +166,26 @@ window.onload = function () {pageLoad();setSynopsis("mini_GADTRecords.html");}; ><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 + ><ul + ><li + ><dfn class="src" + ><a href="" id="v:field" class="def" + >field</a + > :: <a href="" + >Int</a + ></dfn + ><div class="doc" + ><p + >hello docs</p + ></div + ></li + ></ul ></div ></td ></tr ><tr ><td class="src" - ><a name="v:C4" class="def" + ><a href="" id="v:C4" class="def" >C4</a > :: a -> <a href="" >H1</a @@ -200,18 +200,18 @@ window.onload = function () {pageLoad();setSynopsis("mini_GADTRecords.html");}; ><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 + ><ul + ><li + ><dfn class="src" + ><a href="" id="v:field2" class="def" + >field2</a + > :: a</dfn + ><div class="doc" + ><p + >hello2 docs</p + ></div + ></li + ></ul ></div ></td ></tr @@ -224,7 +224,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_GADTRecords.html");}; ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/Hash.html b/html-test/ref/Hash.html index eff422f7..6e15a771 100644 --- a/html-test/ref/Hash.html +++ b/html-test/ref/Hash.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Hash.html");}; ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -147,7 +147,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Hash.html");}; ><p class="src" ><span class="keyword" >data</span - > <a name="t:HashTable" class="def" + > <a href="" id="t:HashTable" class="def" >HashTable</a > key val</p ><div class="doc" @@ -172,7 +172,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Hash.html");}; >s</h2 ><div class="top" ><p class="src" - ><a name="v:new" class="def" + ><a href="" id="v:new" class="def" >new</a > :: (<a href="" >Eq</a @@ -192,7 +192,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Hash.html");}; ></div ><div class="top" ><p class="src" - ><a name="v:insert" class="def" + ><a href="" id="v:insert" class="def" >insert</a > :: (<a href="" >Eq</a @@ -208,7 +208,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Hash.html");}; ></div ><div class="top" ><p class="src" - ><a name="v:lookup" class="def" + ><a href="" id="v:lookup" class="def" >lookup</a > :: <a href="" >Hash</a @@ -241,7 +241,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Hash.html");}; ><p class="src" ><span class="keyword" >class</span - > <a name="t:Hash" class="def" + > <a href="" id="t:Hash" class="def" >Hash</a > a <span class="keyword" >where</span @@ -254,7 +254,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Hash.html");}; ><p class="caption" >Methods</p ><p class="src" - ><a name="v:hash" class="def" + ><a href="" id="v:hash" class="def" >hash</a > :: a -> <a href="" >Int</a @@ -276,37 +276,101 @@ window.onload = function () {pageLoad();setSynopsis("mini_Hash.html");}; ><div id="section.i:Hash" class="show" ><table ><tr - ><td class="src" - ><a href="" - >Hash</a - > <a href="" - >Float</a + ><td class="src clearfix" + ><span class="inst-left" + ><span id="control.i:ic:Hash:Hash:1" class="instance expander" onclick="toggleSection('i:ic:Hash:Hash:1')" + ></span + > <a href="" + >Hash</a + > <a href="" + >Float</a + ></span ></td ><td class="doc empty" > </td ></tr ><tr - ><td class="src" - ><a href="" - >Hash</a - > <a href="" - >Int</a + ><td colspan="2" + ><div id="section.i:ic:Hash:Hash:1" class="inst-details hide" + ><div class="subs methods" + ><p class="caption" + >Methods</p + ><p class="src" + ><a href="" + >hash</a + > :: <a href="" + >Float</a + > -> <a href="" + >Int</a + ></p + ></div + ></div + ></td + ></tr + ><tr + ><td class="src clearfix" + ><span class="inst-left" + ><span id="control.i:ic:Hash:Hash:2" class="instance expander" onclick="toggleSection('i:ic:Hash:Hash:2')" + ></span + > <a href="" + >Hash</a + > <a href="" + >Int</a + ></span ></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 colspan="2" + ><div id="section.i:ic:Hash:Hash:2" class="inst-details hide" + ><div class="subs methods" + ><p class="caption" + >Methods</p + ><p class="src" + ><a href="" + >hash</a + > :: <a href="" + >Int</a + > -> <a href="" + >Int</a + ></p + ></div + ></div + ></td + ></tr + ><tr + ><td class="src clearfix" + ><span class="inst-left" + ><span id="control.i:ic:Hash:Hash:3" class="instance expander" onclick="toggleSection('i:ic:Hash:Hash:3')" + ></span + > (<a href="" + >Hash</a + > a, <a href="" + >Hash</a + > b) => <a href="" + >Hash</a + > (a, b)</span + ></td ><td class="doc empty" > </td ></tr + ><tr + ><td colspan="2" + ><div id="section.i:ic:Hash:Hash:3" class="inst-details hide" + ><div class="subs methods" + ><p class="caption" + >Methods</p + ><p class="src" + ><a href="" + >hash</a + > :: (a, b) -> <a href="" + >Int</a + ></p + ></div + ></div + ></td + ></tr ></table ></div ></div @@ -317,7 +381,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Hash.html");}; ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/HiddenInstances.html b/html-test/ref/HiddenInstances.html index 5a02bb84..3eb94df8 100644 --- a/html-test/ref/HiddenInstances.html +++ b/html-test/ref/HiddenInstances.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_HiddenInstances.html") ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -66,7 +66,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_HiddenInstances.html") ><p class="src" ><span class="keyword" >class</span - > <a name="t:VisibleClass" class="def" + > <a href="" id="t:VisibleClass" class="def" >VisibleClass</a > a</p ><div class="doc" @@ -79,11 +79,15 @@ window.onload = function () {pageLoad();setSynopsis("mini_HiddenInstances.html") ><div id="section.i:VisibleClass" class="show" ><table ><tr - ><td class="src" - ><a href="" - >VisibleClass</a - > <a href="" - >Int</a + ><td class="src clearfix" + ><span class="inst-left" + ><span id="control.i:ic:VisibleClass:VisibleClass:1" class="instance expander" onclick="toggleSection('i:ic:VisibleClass:VisibleClass:1')" + ></span + > <a href="" + >VisibleClass</a + > <a href="" + >Int</a + ></span ></td ><td class="doc" ><p @@ -91,17 +95,33 @@ window.onload = function () {pageLoad();setSynopsis("mini_HiddenInstances.html") ></td ></tr ><tr - ><td class="src" - ><a href="" - >VisibleClass</a - > <a href="" - >VisibleData</a + ><td colspan="2" + ><div id="section.i:ic:VisibleClass:VisibleClass:1" class="inst-details hide" + ></div + ></td + ></tr + ><tr + ><td class="src clearfix" + ><span class="inst-left" + ><span id="control.i:ic:VisibleClass:VisibleClass:2" class="instance expander" onclick="toggleSection('i:ic:VisibleClass:VisibleClass:2')" + ></span + > <a href="" + >VisibleClass</a + > <a href="" + >VisibleData</a + ></span ></td ><td class="doc" ><p >Should be visible</p ></td ></tr + ><tr + ><td colspan="2" + ><div id="section.i:ic:VisibleClass:VisibleClass:2" class="inst-details hide" + ></div + ></td + ></tr ></table ></div ></div @@ -110,7 +130,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_HiddenInstances.html") ><p class="src" ><span class="keyword" >data</span - > <a name="t:VisibleData" class="def" + > <a href="" id="t:VisibleData" class="def" >VisibleData</a ></p ><div class="doc" @@ -123,11 +143,15 @@ window.onload = function () {pageLoad();setSynopsis("mini_HiddenInstances.html") ><div id="section.i:VisibleData" class="show" ><table ><tr - ><td class="src" - ><a href="" - >Num</a - > <a href="" - >VisibleData</a + ><td class="src clearfix" + ><span class="inst-left" + ><span id="control.i:id:VisibleData:Num:1" class="instance expander" onclick="toggleSection('i:id:VisibleData:Num:1')" + ></span + > <a href="" + >Num</a + > <a href="" + >VisibleData</a + ></span ></td ><td class="doc" ><p @@ -135,17 +159,99 @@ window.onload = function () {pageLoad();setSynopsis("mini_HiddenInstances.html") ></td ></tr ><tr - ><td class="src" - ><a href="" - >VisibleClass</a - > <a href="" - >VisibleData</a + ><td colspan="2" + ><div id="section.i:id:VisibleData:Num:1" class="inst-details hide" + ><div class="subs methods" + ><p class="caption" + >Methods</p + ><p class="src" + ><a href="" + >(+)</a + > :: <a href="" + >VisibleData</a + > -> <a href="" + >VisibleData</a + > -> <a href="" + >VisibleData</a + ></p + ><p class="src" + ><a href="" + >(-)</a + > :: <a href="" + >VisibleData</a + > -> <a href="" + >VisibleData</a + > -> <a href="" + >VisibleData</a + ></p + ><p class="src" + ><a href="" + >(*)</a + > :: <a href="" + >VisibleData</a + > -> <a href="" + >VisibleData</a + > -> <a href="" + >VisibleData</a + ></p + ><p class="src" + ><a href="" + >negate</a + > :: <a href="" + >VisibleData</a + > -> <a href="" + >VisibleData</a + ></p + ><p class="src" + ><a href="" + >abs</a + > :: <a href="" + >VisibleData</a + > -> <a href="" + >VisibleData</a + ></p + ><p class="src" + ><a href="" + >signum</a + > :: <a href="" + >VisibleData</a + > -> <a href="" + >VisibleData</a + ></p + ><p class="src" + ><a href="" + >fromInteger</a + > :: <a href="" + >Integer</a + > -> <a href="" + >VisibleData</a + ></p + ></div + ></div + ></td + ></tr + ><tr + ><td class="src clearfix" + ><span class="inst-left" + ><span id="control.i:id:VisibleData:VisibleClass:2" class="instance expander" onclick="toggleSection('i:id:VisibleData:VisibleClass:2')" + ></span + > <a href="" + >VisibleClass</a + > <a href="" + >VisibleData</a + ></span ></td ><td class="doc" ><p >Should be visible</p ></td ></tr + ><tr + ><td colspan="2" + ><div id="section.i:id:VisibleData:VisibleClass:2" class="inst-details hide" + ></div + ></td + ></tr ></table ></div ></div @@ -156,7 +262,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_HiddenInstances.html") ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/HiddenInstancesB.html b/html-test/ref/HiddenInstancesB.html index 8ecbfaae..8a1eb968 100644 --- a/html-test/ref/HiddenInstancesB.html +++ b/html-test/ref/HiddenInstancesB.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_HiddenInstancesB.html" ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -66,7 +66,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_HiddenInstancesB.html" ><p class="src" ><span class="keyword" >class</span - > <a name="t:Foo" class="def" + > <a href="" id="t:Foo" class="def" >Foo</a > a</p ><div class="doc" @@ -79,17 +79,27 @@ window.onload = function () {pageLoad();setSynopsis("mini_HiddenInstancesB.html" ><div id="section.i:Foo" class="show" ><table ><tr - ><td class="src" - ><a href="" - >Foo</a - > <a href="" - >Bar</a + ><td class="src clearfix" + ><span class="inst-left" + ><span id="control.i:ic:Foo:Foo:1" class="instance expander" onclick="toggleSection('i:ic:Foo:Foo:1')" + ></span + > <a href="" + >Foo</a + > <a href="" + >Bar</a + ></span ></td ><td class="doc" ><p >Should be visible</p ></td ></tr + ><tr + ><td colspan="2" + ><div id="section.i:ic:Foo:Foo:1" class="inst-details hide" + ></div + ></td + ></tr ></table ></div ></div @@ -98,7 +108,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_HiddenInstancesB.html" ><p class="src" ><span class="keyword" >data</span - > <a name="t:Bar" class="def" + > <a href="" id="t:Bar" class="def" >Bar</a ></p ><div class="doc" @@ -111,17 +121,27 @@ window.onload = function () {pageLoad();setSynopsis("mini_HiddenInstancesB.html" ><div id="section.i:Bar" class="show" ><table ><tr - ><td class="src" - ><a href="" - >Foo</a - > <a href="" - >Bar</a + ><td class="src clearfix" + ><span class="inst-left" + ><span id="control.i:id:Bar:Foo:1" class="instance expander" onclick="toggleSection('i:id:Bar:Foo:1')" + ></span + > <a href="" + >Foo</a + > <a href="" + >Bar</a + ></span ></td ><td class="doc" ><p >Should be visible</p ></td ></tr + ><tr + ><td colspan="2" + ><div id="section.i:id:Bar:Foo:1" class="inst-details hide" + ></div + ></td + ></tr ></table ></div ></div @@ -132,7 +152,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_HiddenInstancesB.html" ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/Hyperlinks.html b/html-test/ref/Hyperlinks.html index 3454c488..b5547e50 100644 --- a/html-test/ref/Hyperlinks.html +++ b/html-test/ref/Hyperlinks.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Hyperlinks.html");}; ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -58,7 +58,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Hyperlinks.html");}; >Documentation</h1 ><div class="top" ><p class="src" - ><a name="v:foo" class="def" + ><a href="" id="v:foo" class="def" >foo</a > :: <a href="" >Int</a @@ -80,7 +80,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Hyperlinks.html");}; ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/IgnoreExports.html b/html-test/ref/IgnoreExports.html index f64c4ece..6591f0d3 100644 --- a/html-test/ref/IgnoreExports.html +++ b/html-test/ref/IgnoreExports.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_IgnoreExports.html");} ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -64,7 +64,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_IgnoreExports.html");} >Documentation</h1 ><div class="top" ><p class="src" - ><a name="v:foo" class="def" + ><a href="" id="v:foo" class="def" >foo</a > :: <a href="" >Int</a @@ -76,7 +76,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_IgnoreExports.html");} ></div ><div class="top" ><p class="src" - ><a name="v:bar" class="def" + ><a href="" id="v:bar" class="def" >bar</a > :: <a href="" >Int</a @@ -92,7 +92,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_IgnoreExports.html");} ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/ImplicitParams.html b/html-test/ref/ImplicitParams.html index 3874af26..c81f484b 100644 --- a/html-test/ref/ImplicitParams.html +++ b/html-test/ref/ImplicitParams.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_ImplicitParams.html"); ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -48,7 +48,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_ImplicitParams.html"); ><p class="src" ><span class="keyword" >data</span - > <a name="t:X" class="def" + > <a href="" id="t:X" class="def" >X</a ></p ><div class="subs constructors" @@ -57,7 +57,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_ImplicitParams.html"); ><table ><tr ><td class="src" - ><a name="v:X" class="def" + ><a href="" id="v:X" class="def" >X</a ></td ><td class="doc empty" @@ -68,7 +68,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_ImplicitParams.html"); ></div ><div class="top" ><p class="src" - ><a name="v:c" class="def" + ><a href="" id="v:c" class="def" >c</a > :: (?x :: <a href="" >X</a @@ -78,7 +78,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_ImplicitParams.html"); ></div ><div class="top" ><p class="src" - ><a name="v:d" class="def" + ><a href="" id="v:d" class="def" >d</a > :: (?x :: <a href="" >X</a @@ -92,7 +92,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_ImplicitParams.html"); ></div ><div class="top" ><p class="src" - ><a name="v:f" class="def" + ><a href="" id="v:f" class="def" >f</a > :: ((?x :: <a href="" >X</a @@ -104,7 +104,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_ImplicitParams.html"); ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/Minimal.html b/html-test/ref/Minimal.html index 32405540..48c469d1 100644 --- a/html-test/ref/Minimal.html +++ b/html-test/ref/Minimal.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Minimal.html");}; ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -56,7 +56,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Minimal.html");}; ><p class="src" ><span class="keyword" >class</span - > <a name="t:Foo" class="def" + > <a href="" id="t:Foo" class="def" >Foo</a > a <span class="keyword" >where</span @@ -85,7 +85,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Minimal.html");}; ><p class="caption" >Methods</p ><p class="src" - ><a name="v:foo" class="def" + ><a href="" id="v:foo" class="def" >foo</a > :: a</p ><div class="doc" @@ -93,15 +93,15 @@ window.onload = function () {pageLoad();setSynopsis("mini_Minimal.html");}; >Any two of these are required...</p ></div ><p class="src" - ><a name="v:bar" class="def" + ><a href="" id="v:bar" class="def" >bar</a > :: a</p ><p class="src" - ><a name="v:bat" class="def" + ><a href="" id="v:bat" class="def" >bat</a > :: a</p ><p class="src" - ><a name="v:fooBarBat" class="def" + ><a href="" id="v:fooBarBat" class="def" >fooBarBat</a > :: (a, a, a)</p ><div class="doc" @@ -114,7 +114,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Minimal.html");}; ><p class="src" ><span class="keyword" >class</span - > <a name="t:Weird" class="def" + > <a href="" id="t:Weird" class="def" >Weird</a > a <span class="keyword" >where</span @@ -143,31 +143,31 @@ window.onload = function () {pageLoad();setSynopsis("mini_Minimal.html");}; ><p class="caption" >Methods</p ><p class="src" - ><a name="v:a" class="def" + ><a href="" id="v:a" class="def" >a</a > :: a</p ><p class="src" - ><a name="v:b" class="def" + ><a href="" id="v:b" class="def" >b</a > :: a</p ><p class="src" - ><a name="v:c" class="def" + ><a href="" id="v:c" class="def" >c</a > :: a</p ><p class="src" - ><a name="v:d" class="def" + ><a href="" id="v:d" class="def" >d</a > :: a</p ><p class="src" - ><a name="v:e" class="def" + ><a href="" id="v:e" class="def" >e</a > :: a</p ><p class="src" - ><a name="v:f" class="def" + ><a href="" id="v:f" class="def" >f</a > :: a</p ><p class="src" - ><a name="v:g" class="def" + ><a href="" id="v:g" class="def" >g</a > :: a</p ></div @@ -176,7 +176,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Minimal.html");}; ><p class="src" ><span class="keyword" >class</span - > <a name="t:NoMins" class="def" + > <a href="" id="t:NoMins" class="def" >NoMins</a > a <span class="keyword" >where</span @@ -195,15 +195,15 @@ window.onload = function () {pageLoad();setSynopsis("mini_Minimal.html");}; ><p class="caption" >Methods</p ><p class="src" - ><a name="v:x" class="def" + ><a href="" id="v:x" class="def" >x</a > :: a</p ><p class="src" - ><a name="v:y" class="def" + ><a href="" id="v:y" class="def" >y</a > :: a</p ><p class="src" - ><a name="v:z" class="def" + ><a href="" id="v:z" class="def" >z</a > :: a</p ></div @@ -212,7 +212,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Minimal.html");}; ><p class="src" ><span class="keyword" >class</span - > <a name="t:FullMin" class="def" + > <a href="" id="t:FullMin" class="def" >FullMin</a > a <span class="keyword" >where</span @@ -221,11 +221,11 @@ window.onload = function () {pageLoad();setSynopsis("mini_Minimal.html");}; ><p class="caption" >Methods</p ><p class="src" - ><a name="v:aaa" class="def" + ><a href="" id="v:aaa" class="def" >aaa</a > :: a</p ><p class="src" - ><a name="v:bbb" class="def" + ><a href="" id="v:bbb" class="def" >bbb</a > :: a</p ></div @@ -234,7 +234,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Minimal.html");}; ><p class="src" ><span class="keyword" >class</span - > <a name="t:PartialMin" class="def" + > <a href="" id="t:PartialMin" class="def" >PartialMin</a > a <span class="keyword" >where</span @@ -251,7 +251,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Minimal.html");}; ><p class="caption" >Methods</p ><p class="src" - ><a name="v:ccc" class="def" + ><a href="" id="v:ccc" class="def" >ccc</a > :: a</p ></div @@ -260,7 +260,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Minimal.html");}; ><p class="src" ><span class="keyword" >class</span - > <a name="t:EmptyMin" class="def" + > <a href="" id="t:EmptyMin" class="def" >EmptyMin</a > a <span class="keyword" >where</span @@ -275,11 +275,11 @@ window.onload = function () {pageLoad();setSynopsis("mini_Minimal.html");}; ><p class="caption" >Methods</p ><p class="src" - ><a name="v:eee" class="def" + ><a href="" id="v:eee" class="def" >eee</a > :: a</p ><p class="src" - ><a name="v:fff" class="def" + ><a href="" id="v:fff" class="def" >fff</a > :: a</p ></div @@ -290,7 +290,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Minimal.html");}; ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/ModuleWithWarning.html b/html-test/ref/ModuleWithWarning.html index ca3942b6..fa2a6787 100644 --- a/html-test/ref/ModuleWithWarning.html +++ b/html-test/ref/ModuleWithWarning.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_ModuleWithWarning.html ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -62,7 +62,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_ModuleWithWarning.html >Documentation</h1 ><div class="top" ><p class="src" - ><a name="v:foo" class="def" + ><a href="" id="v:foo" class="def" >foo</a > :: <a href="" >Int</a @@ -74,7 +74,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_ModuleWithWarning.html ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/NamedDoc.html b/html-test/ref/NamedDoc.html index f28f5982..64e18711 100644 --- a/html-test/ref/NamedDoc.html +++ b/html-test/ref/NamedDoc.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_NamedDoc.html");}; ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -60,7 +60,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_NamedDoc.html");}; ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/Nesting.html b/html-test/ref/Nesting.html index 2b0befba..7bba5148 100644 --- a/html-test/ref/Nesting.html +++ b/html-test/ref/Nesting.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Nesting.html");}; ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -73,6 +73,10 @@ window.onload = function () {pageLoad();setSynopsis("mini_Nesting.html");}; ><a href="" >j</a > :: t</li + ><li class="src short" + ><a href="" + >k</a + > :: t</li ></ul ></div ><div id="interface" @@ -80,7 +84,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Nesting.html");}; >Documentation</h1 ><div class="top" ><p class="src" - ><a name="v:d" class="def" + ><a href="" id="v:d" class="def" >d</a > :: t</p ><div class="doc" @@ -112,7 +116,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Nesting.html");}; ></div ><div class="top" ><p class="src" - ><a name="v:e" class="def" + ><a href="" id="v:e" class="def" >e</a > :: t</p ><div class="doc" @@ -133,7 +137,7 @@ the presence of this text pushes it out of nesting back to the top.</li ></div ><div class="top" ><p class="src" - ><a name="v:f" class="def" + ><a href="" id="v:f" class="def" >f</a > :: t</p ><div class="doc" @@ -151,7 +155,7 @@ the presence of this text pushes it out of nesting back to the top.</li ></div ><div class="top" ><p class="src" - ><a name="v:g" class="def" + ><a href="" id="v:g" class="def" >g</a > :: t</p ><div class="doc" @@ -169,7 +173,7 @@ the presence of this text pushes it out of nesting back to the top.</li ></div ><div class="top" ><p class="src" - ><a name="v:h" class="def" + ><a href="" id="v:h" class="def" >h</a > :: t</p ><div class="doc" @@ -187,7 +191,7 @@ tracks</pre ></div ><div class="top" ><p class="src" - ><a name="v:i" class="def" + ><a href="" id="v:i" class="def" >i</a > :: t</p ><div class="doc" @@ -237,7 +241,7 @@ More of the indented list.</p ></div ><div class="top" ><p class="src" - ><a name="v:j" class="def" + ><a href="" id="v:j" class="def" >j</a > :: t</p ><div class="doc" @@ -285,16 +289,16 @@ with more of the indented list content.</p ><dd >No newline separation even in indented lists. We can have any paragraph level element that we normally - can, like headers<h3 - >Level 3 header</h3 - ><p - >with some content…</p - ><ul - ><li - >and even more lists inside</li - ></ul - ></dd + can, like headers</dd ></dl + ><h3 + >Level 3 header</h3 + ><p + >with some content…</p + ><ul + ><li + >and even more lists inside</li + ></ul ></li ></ol ></li @@ -303,13 +307,38 @@ with more of the indented list content.</p ></dl ></div ></div + ><div class="top" + ><p class="src" + ><a href="" id="v:k" class="def" + >k</a + > :: t</p + ><div class="doc" + ><ul + ><li + >list may start at arbitrary depth</li + ><li + >and consecutive items at that depth + belong to the same list</li + ><li + ><p + >of course we can still</p + ><ul + ><li + >nest items like we are used to</li + ></ul + ></li + ><li + >and then get back to initial list</li + ></ul + ></div + ></div ></div ></div ><div id="footer" ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/NoLayout.html b/html-test/ref/NoLayout.html index a6bad724..8b47eab8 100644 --- a/html-test/ref/NoLayout.html +++ b/html-test/ref/NoLayout.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_NoLayout.html");}; ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -58,7 +58,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_NoLayout.html");}; >Documentation</h1 ><div class="top" ><p class="src" - ><a name="v:g" class="def" + ><a href="" id="v:g" class="def" >g</a > :: <a href="" >Int</a @@ -78,7 +78,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_NoLayout.html");}; ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/NonGreedy.html b/html-test/ref/NonGreedy.html index 91deb281..c22c8ea9 100644 --- a/html-test/ref/NonGreedy.html +++ b/html-test/ref/NonGreedy.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_NonGreedy.html");}; ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -56,7 +56,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_NonGreedy.html");}; >Documentation</h1 ><div class="top" ><p class="src" - ><a name="v:f" class="def" + ><a href="" id="v:f" class="def" >f</a > :: a</p ><div class="doc" @@ -74,7 +74,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_NonGreedy.html");}; ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/Operators.html b/html-test/ref/Operators.html index e9be655f..6ac8ae38 100644 --- a/html-test/ref/Operators.html +++ b/html-test/ref/Operators.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Operators.html");}; ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -153,11 +153,11 @@ window.onload = function () {pageLoad();setSynopsis("mini_Operators.html");}; ><a href="" >(**>)</a >, <a href="" - >(<**)</a + >(**<)</a >, <a href="" >(>**)</a >, <a href="" - >(**<)</a + >(<**)</a > :: a -> a -> ()</li ></ul ></li @@ -176,7 +176,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Operators.html");}; >Documentation</h1 ><div class="top" ><p class="src" - ><a name="v:-43--45-" class="def" + ><a href="" id="v:-43--45-" class="def" >(+-)</a > :: a -> a -> a</p ><div class="doc" @@ -186,7 +186,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Operators.html");}; ></div ><div class="top" ><p class="src" - ><a name="v:-42--47-" class="def" + ><a href="" id="v:-42--47-" class="def" >(*/)</a > :: a -> a -> a <span class="fixity" >infixr 7</span @@ -200,7 +200,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Operators.html");}; ></div ><div class="top" ><p class="src" - ><a name="v:foo" class="def" + ><a href="" id="v:foo" class="def" >foo</a > :: a -> a -> a <span class="fixity" >infixl 3</span @@ -216,7 +216,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Operators.html");}; ><p class="src" ><span class="keyword" >data</span - > <a name="t:Foo" class="def" + > <a href="" id="t:Foo" class="def" >Foo</a ></p ><div class="doc" @@ -231,7 +231,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Operators.html");}; ><td class="src" ><a href="" >Foo</a - > <a name="v:Bar" class="def" + > <a href="" id="v:Bar" class="def" >`Bar`</a > <a href="" >Foo</a @@ -249,7 +249,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Operators.html");}; ><td class="src" ><a href="" >Foo</a - > <a name="v::-45-" class="def" + > <a href="" id="v::-45-" class="def" >:-</a > <a href="" >Foo</a @@ -270,7 +270,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Operators.html");}; ><p class="src" ><span class="keyword" >pattern</span - > <a name="v::-43-" class="def" + > <a href="" id="v::-43-" class="def" >(:+)</a > :: t -> t -> [t] <span class="fixity" >infixr 3</span @@ -286,7 +286,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Operators.html");}; ><p class="src" ><span class="keyword" >data</span - > a <a name="t:-60--45--62-" class="def" + > a <a href="" id="t:-60--45--62-" class="def" ><-></a > b <span class="keyword" >where</span @@ -305,7 +305,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Operators.html");}; ><table ><tr ><td class="src" - ><a name="v::-60--45--62-" class="def" + ><a href="" id="v::-60--45--62-" class="def" >(:<->)</a > :: a -> b -> a <a href="" ><-></a @@ -324,7 +324,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Operators.html");}; ><p class="src" ><span class="keyword" >type family</span - > a <a name="t:-43--43-" class="def" + > a <a href="" id="t:-43--43-" class="def" >++</a > b <span class="fixity" >infix 3</span @@ -340,7 +340,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Operators.html");}; ><p class="src" ><span class="keyword" >data family</span - > a <a name="t:-42--42-" class="def" + > a <a href="" id="t:-42--42-" class="def" >**</a > b <span class="fixity" >infix 9</span @@ -356,7 +356,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Operators.html");}; ><p class="src" ><span class="keyword" >class</span - > a <a name="t:-62--60--62-" class="def" + > a <a href="" id="t:-62--60--62-" class="def" >><></a > b <span class="keyword" >where</span @@ -375,7 +375,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Operators.html");}; ><p class="src" ><span class="keyword" >type</span - > a <a name="t:-60--62--60-" class="def" + > a <a href="" id="t:-60--62--60-" class="def" ><><</a > b :: * <span class="fixity" >infixl 2</span @@ -385,7 +385,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Operators.html");}; ><p class="src" ><span class="keyword" >data</span - > a <a name="t:-62--60--60-" class="def" + > a <a href="" id="t:-62--60--60-" class="def" >><<</a > b <span class="fixity" >infixl 3</span @@ -397,9 +397,9 @@ window.onload = function () {pageLoad();setSynopsis("mini_Operators.html");}; ><p class="caption" >Methods</p ><p class="src" - ><a name="v:-62--62--60-" class="def" + ><a href="" id="v:-62--62--60-" class="def" >(>><)</a - >, <a name="v:-60--60--62-" class="def" + >, <a href="" id="v:-60--60--62-" class="def" >(<<>)</a > :: a -> b -> () <span class="fixity" >infixl 5 <<></span @@ -409,18 +409,18 @@ window.onload = function () {pageLoad();setSynopsis("mini_Operators.html");}; ></span ></p ><p class="src" - ><a name="v:-42--42--62-" class="def" + ><a href="" id="v:-42--42--62-" class="def" >(**>)</a - >, <a name="v:-60--42--42-" class="def" - >(<**)</a - >, <a name="v:-62--42--42-" class="def" - >(>**)</a - >, <a name="v:-42--42--60-" class="def" + >, <a href="" id="v:-42--42--60-" class="def" >(**<)</a + >, <a href="" id="v:-62--42--42-" class="def" + >(>**)</a + >, <a href="" id="v:-60--42--42-" class="def" + >(<**)</a > :: a -> a -> () <span class="fixity" >infixr 8 **>, >**</span ><span class="fixity" - >infixl 8 <**, **<</span + >infixl 8 **<, <**</span ><span class="rightedge" ></span ></p @@ -434,7 +434,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Operators.html");}; ><p class="src" ><span class="keyword" >type</span - > <a name="t:-62--45--60-" class="def" + > <a href="" id="t:-62--45--60-" class="def" >(>-<)</a > a b = a <a href="" ><-></a @@ -454,7 +454,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Operators.html");}; ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/PatternSyns.html b/html-test/ref/PatternSyns.html index 00861b39..6fe8fff0 100644 --- a/html-test/ref/PatternSyns.html +++ b/html-test/ref/PatternSyns.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_PatternSyns.html");}; ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -116,7 +116,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_PatternSyns.html");}; ><p class="src" ><span class="keyword" >data</span - > <a name="t:FooType" class="def" + > <a href="" id="t:FooType" class="def" >FooType</a > x</p ><div class="doc" @@ -129,7 +129,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_PatternSyns.html");}; ><table ><tr ><td class="src" - ><a name="v:FooCtor" class="def" + ><a href="" id="v:FooCtor" class="def" >FooCtor</a > x</td ><td class="doc empty" @@ -142,7 +142,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_PatternSyns.html");}; ><p class="src" ><span class="keyword" >pattern</span - > <a name="v:Foo" class="def" + > <a href="" id="v:Foo" class="def" >Foo</a > :: t -> <a href="" >FooType</a @@ -160,7 +160,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_PatternSyns.html");}; ><p class="src" ><span class="keyword" >pattern</span - > <a name="v:Bar" class="def" + > <a href="" id="v:Bar" class="def" >Bar</a > :: t -> <a href="" >FooType</a @@ -180,7 +180,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_PatternSyns.html");}; ><p class="src" ><span class="keyword" >pattern</span - > <a name="v::-60--45--62-" class="def" + > <a href="" id="v::-60--45--62-" class="def" >(:<->)</a > :: t -> t -> (<a href="" >FooType</a @@ -202,13 +202,15 @@ window.onload = function () {pageLoad();setSynopsis("mini_PatternSyns.html");}; ><p class="src" ><span class="keyword" >data</span - > a <a name="t:-62--60-" class="def" + > a <a href="" id="t:-62--60-" class="def" >><</a > b</p ><div class="doc" ><p >Doc for (<code - >><</code + ><a href="" + >><</a + ></code >)</p ></div ><div class="subs constructors" @@ -217,7 +219,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_PatternSyns.html");}; ><table ><tr ><td class="src" - ><a name="v:Empty" class="def" + ><a href="" id="v:Empty" class="def" >Empty</a ></td ><td class="doc empty" @@ -230,7 +232,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_PatternSyns.html");}; ><p class="src" ><span class="keyword" >pattern</span - > <a name="v:E" class="def" + > <a href="" id="v:E" class="def" >E</a > :: <a href="" >(><)</a @@ -250,7 +252,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_PatternSyns.html");}; ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/PromotedTypes.html b/html-test/ref/PromotedTypes.html new file mode 100644 index 00000000..db42f637 --- /dev/null +++ b/html-test/ref/PromotedTypes.html @@ -0,0 +1,201 @@ +<!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 + >PromotedTypes</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_PromotedTypes.html");}; +//]]> +</script + ></head + ><body + ><div id="package-header" + ><ul class="links" id="page-menu" + ><li + ><a href="" + >Contents</a + ></li + ><li + ><a href="" + >Index</a + ></li + ></ul + ><p class="caption empty" + > </p + ></div + ><div id="content" + ><div id="module-header" + ><table class="info" + ><tr + ><th + >Safe Haskell</th + ><td + >Safe</td + ></tr + ></table + ><p class="caption" + >PromotedTypes</p + ></div + ><div id="interface" + ><h1 + >Documentation</h1 + ><div class="top" + ><p class="src" + ><span class="keyword" + >data</span + > <a href="" id="t:RevList" class="def" + >RevList</a + > a</p + ><div class="subs constructors" + ><p class="caption" + >Constructors</p + ><table + ><tr + ><td class="src" + ><a href="" id="v:RNil" class="def" + >RNil</a + ></td + ><td class="doc empty" + > </td + ></tr + ><tr + ><td class="src" + >(<a href="" + >RevList</a + > a) <a href="" id="v::-62-" class="def" + >:></a + > a</td + ><td class="doc empty" + > </td + ></tr + ></table + ></div + ></div + ><div class="top" + ><p class="src" + ><span class="keyword" + >data</span + > <a href="" id="t:Pattern" class="def" + >Pattern</a + > :: [*] -> * <span class="keyword" + >where</span + ></p + ><div class="subs constructors" + ><p class="caption" + >Constructors</p + ><table + ><tr + ><td class="src" + ><a href="" id="v:Nil" class="def" + >Nil</a + > :: <a href="" + >Pattern</a + > '[]</td + ><td class="doc empty" + > </td + ></tr + ><tr + ><td class="src" + ><a href="" id="v:Cons" class="def" + >Cons</a + > :: <a href="" + >Maybe</a + > h -> <a href="" + >Pattern</a + > t -> <a href="" + >Pattern</a + > (h ': t)</td + ><td class="doc empty" + > </td + ></tr + ></table + ></div + ></div + ><div class="top" + ><p class="src" + ><span class="keyword" + >data</span + > <a href="" id="t:RevPattern" class="def" + >RevPattern</a + > :: <a href="" + >RevList</a + > * -> * <span class="keyword" + >where</span + ></p + ><div class="subs constructors" + ><p class="caption" + >Constructors</p + ><table + ><tr + ><td class="src" + ><a href="" id="v:RevNil" class="def" + >RevNil</a + > :: <a href="" + >RevPattern</a + > <a href="" + >RNil</a + ></td + ><td class="doc empty" + > </td + ></tr + ><tr + ><td class="src" + ><a href="" id="v:RevCons" class="def" + >RevCons</a + > :: <a href="" + >Maybe</a + > h -> <a href="" + >RevPattern</a + > t -> <a href="" + >RevPattern</a + > (t <a href="" + >:></a + > h)</td + ><td class="doc empty" + > </td + ></tr + ></table + ></div + ></div + ><div class="top" + ><p class="src" + ><span class="keyword" + >data</span + > <a href="" id="t:Tuple" class="def" + >Tuple</a + > :: (*, *) -> * <span class="keyword" + >where</span + ></p + ><div class="subs constructors" + ><p class="caption" + >Constructors</p + ><table + ><tr + ><td class="src" + ><a href="" id="v:Tuple" class="def" + >Tuple</a + > :: a -> b -> <a href="" + >Tuple</a + > '(a, b)</td + ><td class="doc empty" + > </td + ></tr + ></table + ></div + ></div + ></div + ></div + ><div id="footer" + ><p + >Produced by <a href="" + >Haddock</a + > version 2.16.2</p + ></div + ></body + ></html +> diff --git a/html-test/ref/Properties.html b/html-test/ref/Properties.html index d491b98e..5d2e58c0 100644 --- a/html-test/ref/Properties.html +++ b/html-test/ref/Properties.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Properties.html");}; ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -60,7 +60,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Properties.html");}; >Documentation</h1 ><div class="top" ><p class="src" - ><a name="v:fib" class="def" + ><a href="" id="v:fib" class="def" >fib</a > :: <a href="" >Integer</a @@ -84,7 +84,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Properties.html");}; ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/PruneWithWarning.html b/html-test/ref/PruneWithWarning.html index aa055203..bbf21f42 100644 --- a/html-test/ref/PruneWithWarning.html +++ b/html-test/ref/PruneWithWarning.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_PruneWithWarning.html" ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -63,7 +63,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_PruneWithWarning.html" ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/QuasiExpr.html b/html-test/ref/QuasiExpr.html index 7c249819..41129d59 100644 --- a/html-test/ref/QuasiExpr.html +++ b/html-test/ref/QuasiExpr.html @@ -48,7 +48,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_QuasiExpr.html");}; ><p class="src" ><span class="keyword" >data</span - > <a name="t:Expr" class="def" + > <a href="" id="t:Expr" class="def" >Expr</a ></p ><div class="subs constructors" @@ -57,7 +57,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_QuasiExpr.html");}; ><table ><tr ><td class="src" - ><a name="v:IntExpr" class="def" + ><a href="" id="v:IntExpr" class="def" >IntExpr</a > <a href="" >Integer</a @@ -67,7 +67,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_QuasiExpr.html");}; ></tr ><tr ><td class="src" - ><a name="v:AntiIntExpr" class="def" + ><a href="" id="v:AntiIntExpr" class="def" >AntiIntExpr</a > <a href="" >String</a @@ -77,7 +77,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_QuasiExpr.html");}; ></tr ><tr ><td class="src" - ><a name="v:BinopExpr" class="def" + ><a href="" id="v:BinopExpr" class="def" >BinopExpr</a > <a href="" >BinOp</a @@ -91,7 +91,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_QuasiExpr.html");}; ></tr ><tr ><td class="src" - ><a name="v:AntiExpr" class="def" + ><a href="" id="v:AntiExpr" class="def" >AntiExpr</a > <a href="" >String</a @@ -107,15 +107,55 @@ window.onload = function () {pageLoad();setSynopsis("mini_QuasiExpr.html");}; ><div id="section.i:Expr" class="show" ><table ><tr - ><td class="src" - ><a href="" - >Show</a - > <a href="" - >Expr</a + ><td class="src clearfix" + ><span class="inst-left" + ><span id="control.i:id:Expr:Show:1" class="instance expander" onclick="toggleSection('i:id:Expr:Show:1')" + ></span + > <a href="" + >Show</a + > <a href="" + >Expr</a + ></span ></td ><td class="doc empty" > </td ></tr + ><tr + ><td colspan="2" + ><div id="section.i:id:Expr:Show:1" class="inst-details hide" + ><div class="subs methods" + ><p class="caption" + >Methods</p + ><p class="src" + ><a href="" + >showsPrec</a + > :: <a href="" + >Int</a + > -> <a href="" + >Expr</a + > -> <a href="" + >ShowS</a + ></p + ><p class="src" + ><a href="" + >show</a + > :: <a href="" + >Expr</a + > -> <a href="" + >String</a + ></p + ><p class="src" + ><a href="" + >showList</a + > :: [<a href="" + >Expr</a + >] -> <a href="" + >ShowS</a + ></p + ></div + ></div + ></td + ></tr ></table ></div ></div @@ -124,7 +164,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_QuasiExpr.html");}; ><p class="src" ><span class="keyword" >data</span - > <a name="t:BinOp" class="def" + > <a href="" id="t:BinOp" class="def" >BinOp</a ></p ><div class="subs constructors" @@ -133,7 +173,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_QuasiExpr.html");}; ><table ><tr ><td class="src" - ><a name="v:AddOp" class="def" + ><a href="" id="v:AddOp" class="def" >AddOp</a ></td ><td class="doc empty" @@ -141,7 +181,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_QuasiExpr.html");}; ></tr ><tr ><td class="src" - ><a name="v:SubOp" class="def" + ><a href="" id="v:SubOp" class="def" >SubOp</a ></td ><td class="doc empty" @@ -149,7 +189,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_QuasiExpr.html");}; ></tr ><tr ><td class="src" - ><a name="v:MulOp" class="def" + ><a href="" id="v:MulOp" class="def" >MulOp</a ></td ><td class="doc empty" @@ -157,7 +197,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_QuasiExpr.html");}; ></tr ><tr ><td class="src" - ><a name="v:DivOp" class="def" + ><a href="" id="v:DivOp" class="def" >DivOp</a ></td ><td class="doc empty" @@ -171,22 +211,62 @@ window.onload = function () {pageLoad();setSynopsis("mini_QuasiExpr.html");}; ><div id="section.i:BinOp" class="show" ><table ><tr - ><td class="src" - ><a href="" - >Show</a - > <a href="" - >BinOp</a + ><td class="src clearfix" + ><span class="inst-left" + ><span id="control.i:id:BinOp:Show:1" class="instance expander" onclick="toggleSection('i:id:BinOp:Show:1')" + ></span + > <a href="" + >Show</a + > <a href="" + >BinOp</a + ></span ></td ><td class="doc empty" > </td ></tr + ><tr + ><td colspan="2" + ><div id="section.i:id:BinOp:Show:1" class="inst-details hide" + ><div class="subs methods" + ><p class="caption" + >Methods</p + ><p class="src" + ><a href="" + >showsPrec</a + > :: <a href="" + >Int</a + > -> <a href="" + >BinOp</a + > -> <a href="" + >ShowS</a + ></p + ><p class="src" + ><a href="" + >show</a + > :: <a href="" + >BinOp</a + > -> <a href="" + >String</a + ></p + ><p class="src" + ><a href="" + >showList</a + > :: [<a href="" + >BinOp</a + >] -> <a href="" + >ShowS</a + ></p + ></div + ></div + ></td + ></tr ></table ></div ></div ></div ><div class="top" ><p class="src" - ><a name="v:eval" class="def" + ><a href="" id="v:eval" class="def" >eval</a > :: <a href="" >Expr</a @@ -196,13 +276,13 @@ window.onload = function () {pageLoad();setSynopsis("mini_QuasiExpr.html");}; ></div ><div class="top" ><p class="src" - ><a name="v:expr" class="def" + ><a href="" id="v:expr" class="def" >expr</a > :: QuasiQuoter</p ></div ><div class="top" ><p class="src" - ><a name="v:parseExprExp" class="def" + ><a href="" id="v:parseExprExp" class="def" >parseExprExp</a > :: <a href="" >String</a @@ -214,7 +294,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_QuasiExpr.html");}; ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/QuasiQuote.html b/html-test/ref/QuasiQuote.html index f96a7e67..610f5edf 100644 --- a/html-test/ref/QuasiQuote.html +++ b/html-test/ref/QuasiQuote.html @@ -46,7 +46,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_QuasiQuote.html");}; >Documentation</h1 ><div class="top" ><p class="src" - ><a name="v:val" class="def" + ><a href="" id="v:val" class="def" >val</a > :: <a href="" >Integer</a @@ -58,7 +58,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_QuasiQuote.html");}; ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/SpuriousSuperclassConstraints.html b/html-test/ref/SpuriousSuperclassConstraints.html index 2394de94..1cae5ba1 100644 --- a/html-test/ref/SpuriousSuperclassConstraints.html +++ b/html-test/ref/SpuriousSuperclassConstraints.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_SpuriousSuperclassCons ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -74,7 +74,7 @@ Fix spurious superclass constraints bug.</pre ><p class="src" ><span class="keyword" >data</span - > <a name="t:SomeType" class="def" + > <a href="" id="t:SomeType" class="def" >SomeType</a > f a</p ><div class="subs instances" @@ -83,27 +83,107 @@ Fix spurious superclass constraints bug.</pre ><div id="section.i:SomeType" class="show" ><table ><tr - ><td class="src" - ><a href="" - >Functor</a - > (<a href="" - >SomeType</a - > f)</td + ><td class="src clearfix" + ><span class="inst-left" + ><span id="control.i:id:SomeType:Functor:1" class="instance expander" onclick="toggleSection('i:id:SomeType:Functor:1')" + ></span + > <a href="" + >Functor</a + > (<a href="" + >SomeType</a + > f)</span + ></td ><td class="doc empty" > </td ></tr ><tr - ><td class="src" - ><a href="" - >Applicative</a - > f => <a href="" - >Applicative</a - > (<a href="" - >SomeType</a - > f)</td + ><td colspan="2" + ><div id="section.i:id:SomeType:Functor:1" class="inst-details hide" + ><div class="subs methods" + ><p class="caption" + >Methods</p + ><p class="src" + ><a href="" + >fmap</a + > :: (a -> b) -> <a href="" + >SomeType</a + > f a -> <a href="" + >SomeType</a + > f b</p + ><p class="src" + ><a href="" + >(<$)</a + > :: a -> <a href="" + >SomeType</a + > f b -> <a href="" + >SomeType</a + > f a</p + ></div + ></div + ></td + ></tr + ><tr + ><td class="src clearfix" + ><span class="inst-left" + ><span id="control.i:id:SomeType:Applicative:2" class="instance expander" onclick="toggleSection('i:id:SomeType:Applicative:2')" + ></span + > <a href="" + >Applicative</a + > f => <a href="" + >Applicative</a + > (<a href="" + >SomeType</a + > f)</span + ></td ><td class="doc empty" > </td ></tr + ><tr + ><td colspan="2" + ><div id="section.i:id:SomeType:Applicative:2" class="inst-details hide" + ><div class="subs methods" + ><p class="caption" + >Methods</p + ><p class="src" + ><a href="" + >pure</a + > :: a -> <a href="" + >SomeType</a + > f a</p + ><p class="src" + ><a href="" + >(<*>)</a + > :: <a href="" + >SomeType</a + > f (a -> b) -> <a href="" + >SomeType</a + > f a -> <a href="" + >SomeType</a + > f b</p + ><p class="src" + ><a href="" + >(*>)</a + > :: <a href="" + >SomeType</a + > f a -> <a href="" + >SomeType</a + > f b -> <a href="" + >SomeType</a + > f b</p + ><p class="src" + ><a href="" + >(<*)</a + > :: <a href="" + >SomeType</a + > f a -> <a href="" + >SomeType</a + > f b -> <a href="" + >SomeType</a + > f a</p + ></div + ></div + ></td + ></tr ></table ></div ></div @@ -114,7 +194,7 @@ Fix spurious superclass constraints bug.</pre ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/TH.html b/html-test/ref/TH.html index 119d379c..e72c2189 100644 --- a/html-test/ref/TH.html +++ b/html-test/ref/TH.html @@ -46,7 +46,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_TH.html");}; >Documentation</h1 ><div class="top" ><p class="src" - ><a name="v:decl" class="def" + ><a href="" id="v:decl" class="def" >decl</a > :: Q [Dec]</p ></div @@ -56,7 +56,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_TH.html");}; ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/TH2.html b/html-test/ref/TH2.html index 61145958..cf896bac 100644 --- a/html-test/ref/TH2.html +++ b/html-test/ref/TH2.html @@ -46,7 +46,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_TH2.html");}; >Documentation</h1 ><div class="top" ><p class="src" - ><a name="v:f" class="def" + ><a href="" id="v:f" class="def" >f</a > :: t -> t</p ></div @@ -56,7 +56,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_TH2.html");}; ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/Test.html b/html-test/ref/Test.html index 89491f01..8b82fe0b 100644 --- a/html-test/ref/Test.html +++ b/html-test/ref/Test.html @@ -65,7 +65,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -371,11 +371,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; ><li ><a href="" >r</a - > :: <a href="" - >Int</a - ></li - ><li - ><a href="" + >, <a href="" >s</a > :: <a href="" >Int</a @@ -413,11 +409,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; ><li ><a href="" >u</a - > :: <a href="" - >Int</a - ></li - ><li - ><a href="" + >, <a href="" >v</a > :: <a href="" >Int</a @@ -669,7 +661,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; ><p class="src" ><span class="keyword" >data</span - > <a name="t:T" class="def" + > <a href="" id="t:T" class="def" >T</a > a b</p ><div class="doc" @@ -685,7 +677,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; ><table ><tr ><td class="src" - ><a name="v:A" class="def" + ><a href="" id="v:A" class="def" >A</a > <a href="" >Int</a @@ -705,7 +697,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; ></tr ><tr ><td class="src" - ><a name="v:B" class="def" + ><a href="" id="v:B" class="def" >B</a > (<a href="" >T</a @@ -732,7 +724,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; ><p class="src" ><span class="keyword" >data</span - > <a name="t:T2" class="def" + > <a href="" id="t:T2" class="def" >T2</a > a b</p ><div class="doc" @@ -744,7 +736,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; ><p class="src" ><span class="keyword" >data</span - > <a name="t:T3" class="def" + > <a href="" id="t:T3" class="def" >T3</a > a b</p ><div class="doc" @@ -757,7 +749,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; ><table ><tr ><td class="src" - ><a name="v:A1" class="def" + ><a href="" id="v:A1" class="def" >A1</a > a</td ><td class="doc empty" @@ -765,7 +757,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; ></tr ><tr ><td class="src" - ><a name="v:B1" class="def" + ><a href="" id="v:B1" class="def" >B1</a > b</td ><td class="doc empty" @@ -778,7 +770,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; ><p class="src" ><span class="keyword" >data</span - > <a name="t:T4" class="def" + > <a href="" id="t:T4" class="def" >T4</a > a b</p ><div class="subs constructors" @@ -787,7 +779,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; ><table ><tr ><td class="src" - ><a name="v:A2" class="def" + ><a href="" id="v:A2" class="def" >A2</a > a</td ><td class="doc empty" @@ -795,7 +787,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; ></tr ><tr ><td class="src" - ><a name="v:B2" class="def" + ><a href="" id="v:B2" class="def" >B2</a > b</td ><td class="doc empty" @@ -808,7 +800,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; ><p class="src" ><span class="keyword" >data</span - > <a name="t:T5" class="def" + > <a href="" id="t:T5" class="def" >T5</a > a b</p ><div class="subs constructors" @@ -817,7 +809,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; ><table ><tr ><td class="src" - ><a name="v:A3" class="def" + ><a href="" id="v:A3" class="def" >A3</a > a</td ><td class="doc" @@ -831,7 +823,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; ></tr ><tr ><td class="src" - ><a name="v:B3" class="def" + ><a href="" id="v:B3" class="def" >B3</a > b</td ><td class="doc" @@ -850,7 +842,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; ><p class="src" ><span class="keyword" >data</span - > <a name="t:T6" class="def" + > <a href="" id="t:T6" class="def" >T6</a ></p ><div class="doc" @@ -863,7 +855,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; ><table ><tr ><td class="src" - ><a name="v:A4" class="def" + ><a href="" id="v:A4" class="def" >A4</a ></td ><td class="doc" @@ -877,7 +869,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; ></tr ><tr ><td class="src" - ><a name="v:B4" class="def" + ><a href="" id="v:B4" class="def" >B4</a ></td ><td class="doc" @@ -891,7 +883,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; ></tr ><tr ><td class="src" - ><a name="v:C4" class="def" + ><a href="" id="v:C4" class="def" >C4</a ></td ><td class="doc" @@ -910,7 +902,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; ><p class="src" ><span class="keyword" >newtype</span - > <a name="t:N1" class="def" + > <a href="" id="t:N1" class="def" >N1</a > a</p ><div class="doc" @@ -923,7 +915,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; ><table ><tr ><td class="src" - ><a name="v:N1" class="def" + ><a href="" id="v:N1" class="def" >N1</a > a</td ><td class="doc empty" @@ -936,7 +928,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; ><p class="src" ><span class="keyword" >newtype</span - > <a name="t:N2" class="def" + > <a href="" id="t:N2" class="def" >N2</a > a b</p ><div class="doc" @@ -949,7 +941,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; ><table ><tr ><td class="src" - ><a name="v:N2" class="def" + ><a href="" id="v:N2" class="def" >N2</a ></td ><td class="doc empty" @@ -960,16 +952,16 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; ><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 + ><ul + ><li + ><dfn class="src" + ><a href="" id="v:n" class="def" + >n</a + > :: a b</dfn + ><div class="doc empty" + > </div + ></li + ></ul ></div ></td ></tr @@ -980,7 +972,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; ><p class="src" ><span class="keyword" >newtype</span - > <a name="t:N3" class="def" + > <a href="" id="t:N3" class="def" >N3</a > a b</p ><div class="doc" @@ -993,7 +985,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; ><table ><tr ><td class="src" - ><a name="v:N3" class="def" + ><a href="" id="v:N3" class="def" >N3</a ></td ><td class="doc empty" @@ -1004,22 +996,22 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; ><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 + ><ul + ><li + ><dfn class="src" + ><a href="" id="v:n3" class="def" + >n3</a + > :: a b</dfn + ><div class="doc" + ><p + >this is the <code + ><a href="" + >n3</a + ></code + > field</p + ></div + ></li + ></ul ></div ></td ></tr @@ -1030,7 +1022,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; ><p class="src" ><span class="keyword" >data</span - > <a name="t:N4" class="def" + > <a href="" id="t:N4" class="def" >N4</a > a b</p ><div class="doc" @@ -1043,7 +1035,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; ><p class="src" ><span class="keyword" >newtype</span - > <a name="t:N5" class="def" + > <a href="" id="t:N5" class="def" >N5</a > a b</p ><div class="subs constructors" @@ -1052,7 +1044,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; ><table ><tr ><td class="src" - ><a name="v:N5" class="def" + ><a href="" id="v:N5" class="def" >N5</a ></td ><td class="doc empty" @@ -1063,18 +1055,18 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; ><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 + ><ul + ><li + ><dfn class="src" + ><a href="" id="v:n5" class="def" + >n5</a + > :: a b</dfn + ><div class="doc" + ><p + >no docs on the datatype or the constructor</p + ></div + ></li + ></ul ></div ></td ></tr @@ -1085,7 +1077,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; ><p class="src" ><span class="keyword" >newtype</span - > <a name="t:N6" class="def" + > <a href="" id="t:N6" class="def" >N6</a > a b</p ><div class="subs constructors" @@ -1094,7 +1086,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; ><table ><tr ><td class="src" - ><a name="v:N6" class="def" + ><a href="" id="v:N6" class="def" >N6</a ></td ><td class="doc" @@ -1107,16 +1099,16 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; ><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 + ><ul + ><li + ><dfn class="src" + ><a href="" id="v:n6" class="def" + >n6</a + > :: a b</dfn + ><div class="doc empty" + > </div + ></li + ></ul ></div ></td ></tr @@ -1127,7 +1119,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; ><p class="src" ><span class="keyword" >newtype</span - > <a name="t:N7" class="def" + > <a href="" id="t:N7" class="def" >N7</a > a b</p ><div class="doc" @@ -1140,7 +1132,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; ><table ><tr ><td class="src" - ><a name="v:N7" class="def" + ><a href="" id="v:N7" class="def" >N7</a ></td ><td class="doc" @@ -1157,16 +1149,16 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; ><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 + ><ul + ><li + ><dfn class="src" + ><a href="" id="v:n7" class="def" + >n7</a + > :: a b</dfn + ><div class="doc empty" + > </div + ></li + ></ul ></div ></td ></tr @@ -1179,7 +1171,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; ><p class="src" ><span class="keyword" >data</span - > <a name="t:R" class="def" + > <a href="" id="t:R" class="def" >R</a ></p ><div class="doc" @@ -1213,7 +1205,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; ><table ><tr ><td class="src" - ><a name="v:C1" class="def" + ><a href="" id="v:C1" class="def" >C1</a ></td ><td class="doc" @@ -1230,80 +1222,68 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; ><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 + ><ul + ><li + ><dfn class="src" + ><a href="" id="v:p" class="def" + >p</a + > :: <a href="" + >Int</a + ></dfn + ><div class="doc" + ><p + >This comment applies to the <code + ><a href="" + >p</a + ></code + > field</p + ></div + ></li + ><li + ><dfn class="src" + ><a href="" id="v:q" class="def" + >q</a + > :: <span class="keyword" + >forall</span + > a. a -> a</dfn + ><div class="doc" + ><p + >This comment applies to the <code + ><a href="" + >q</a + ></code + > field</p + ></div + ></li + ><li + ><dfn class="src" + ><a href="" id="v:r" class="def" + >r</a + >, <a href="" id="v:s" class="def" + >s</a + > :: <a href="" + >Int</a + ></dfn + ><div class="doc" + ><p + >This comment applies to both <code + ><a href="" + >r</a + ></code + > and <code + ><a href="" + >s</a + ></code + ></p + ></div + ></li + ></ul ></div ></td ></tr ><tr ><td class="src" - ><a name="v:C2" class="def" + ><a href="" id="v:C2" class="def" >C2</a ></td ><td class="doc" @@ -1320,52 +1300,48 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; ><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 - > () ()</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 + ><ul + ><li + ><dfn class="src" + ><a href="" id="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 + > () ()</dfn + ><div class="doc empty" + > </div + ></li + ><li + ><dfn class="src" + ><a href="" id="v:u" class="def" + >u</a + >, <a href="" id="v:v" class="def" + >v</a + > :: <a href="" + >Int</a + ></dfn + ><div class="doc empty" + > </div + ></li + ></ul ></div ></td ></tr @@ -1376,7 +1352,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; ><p class="src" ><span class="keyword" >data</span - > <a name="t:R1" class="def" + > <a href="" id="t:R1" class="def" >R1</a ></p ><div class="doc" @@ -1389,7 +1365,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; ><table ><tr ><td class="src" - ><a name="v:C3" class="def" + ><a href="" id="v:C3" class="def" >C3</a ></td ><td class="doc" @@ -1406,52 +1382,56 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; ><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 + ><ul + ><li + ><dfn class="src" + ><a href="" id="v:s1" class="def" + >s1</a + > :: <a href="" + >Int</a + ></dfn + ><div class="doc" + ><p + >The <code + ><a href="" + >s1</a + ></code + > record selector</p + ></div + ></li + ><li + ><dfn class="src" + ><a href="" id="v:s2" class="def" + >s2</a + > :: <a href="" + >Int</a + ></dfn + ><div class="doc" + ><p + >The <code + ><a href="" + >s2</a + ></code + > record selector</p + ></div + ></li + ><li + ><dfn class="src" + ><a href="" id="v:s3" class="def" + >s3</a + > :: <a href="" + >Int</a + ></dfn + ><div class="doc" + ><p + >The <code + ><a href="" + >s3</a + ></code + > record selector</p + ></div + ></li + ></ul ></div ></td ></tr @@ -1470,7 +1450,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; >class</span > <a href="" >D</a - > a => <a name="t:C" class="def" + > a => <a href="" id="t:C" class="def" >C</a > a <span class="keyword" >where</span @@ -1489,7 +1469,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; ><p class="caption" >Methods</p ><p class="src" - ><a name="v:a" class="def" + ><a href="" id="v:a" class="def" >a</a > :: <a href="" >IO</a @@ -1503,7 +1483,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; > method</p ></div ><p class="src" - ><a name="v:b" class="def" + ><a href="" id="v:b" class="def" >b</a > :: [a]</p ><div class="doc" @@ -1520,7 +1500,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; ><p class="src" ><span class="keyword" >class</span - > <a name="t:D" class="def" + > <a href="" id="t:D" class="def" >D</a > a <span class="keyword" >where</span @@ -1533,13 +1513,13 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; ><p class="caption" >Methods</p ><p class="src" - ><a name="v:d" class="def" + ><a href="" id="v:d" class="def" >d</a > :: <a href="" >T</a > a b</p ><p class="src" - ><a name="v:e" class="def" + ><a href="" id="v:e" class="def" >e</a > :: (a, a)</p ></div @@ -1549,25 +1529,85 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; ><div id="section.i:D" class="show" ><table ><tr - ><td class="src" - ><a href="" - >D</a - > <a href="" - >Float</a + ><td class="src clearfix" + ><span class="inst-left" + ><span id="control.i:ic:D:D:1" class="instance expander" onclick="toggleSection('i:ic:D:D:1')" + ></span + > <a href="" + >D</a + > <a href="" + >Float</a + ></span ></td ><td class="doc empty" > </td ></tr ><tr - ><td class="src" - ><a href="" - >D</a - > <a href="" - >Int</a + ><td colspan="2" + ><div id="section.i:ic:D:D:1" class="inst-details hide" + ><div class="subs methods" + ><p class="caption" + >Methods</p + ><p class="src" + ><a href="" + >d</a + > :: <a href="" + >T</a + > <a href="" + >Float</a + > b</p + ><p class="src" + ><a href="" + >e</a + > :: (<a href="" + >Float</a + >, <a href="" + >Float</a + >)</p + ></div + ></div + ></td + ></tr + ><tr + ><td class="src clearfix" + ><span class="inst-left" + ><span id="control.i:ic:D:D:2" class="instance expander" onclick="toggleSection('i:ic:D:D:2')" + ></span + > <a href="" + >D</a + > <a href="" + >Int</a + ></span ></td ><td class="doc empty" > </td ></tr + ><tr + ><td colspan="2" + ><div id="section.i:ic:D:D:2" class="inst-details hide" + ><div class="subs methods" + ><p class="caption" + >Methods</p + ><p class="src" + ><a href="" + >d</a + > :: <a href="" + >T</a + > <a href="" + >Int</a + > b</p + ><p class="src" + ><a href="" + >e</a + > :: (<a href="" + >Int</a + >, <a href="" + >Int</a + >)</p + ></div + ></div + ></td + ></tr ></table ></div ></div @@ -1576,7 +1616,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; ><p class="src" ><span class="keyword" >class</span - > <a name="t:E" class="def" + > <a href="" id="t:E" class="def" >E</a > a</p ><div class="doc" @@ -1594,7 +1634,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; ><p class="src" ><span class="keyword" >class</span - > <a name="t:F" class="def" + > <a href="" id="t:F" class="def" >F</a > a <span class="keyword" >where</span @@ -1603,7 +1643,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; ><p class="caption" >Methods</p ><p class="src" - ><a name="v:ff" class="def" + ><a href="" id="v:ff" class="def" >ff</a > :: a</p ></div @@ -1616,7 +1656,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; >Function types</h1 ><div class="top" ><p class="src" - ><a name="v:f" class="def" + ><a href="" id="v:f" class="def" >f</a > :: <a href="" >C</a @@ -1678,7 +1718,7 @@ using double quotes: <a href="" ></div ><div class="top" ><p class="src" - ><a name="v:g" class="def" + ><a href="" id="v:g" class="def" >g</a > :: <a href="" >Int</a @@ -1787,7 +1827,7 @@ is at the beginning of the line).</pre >A hidden module</h1 ><div class="top" ><p class="src" - ><a name="v:hidden" class="def" + ><a href="" id="v:hidden" class="def" >hidden</a > :: <a href="" >Int</a @@ -1813,7 +1853,7 @@ is at the beginning of the line).</pre ><p class="src" ><span class="keyword" >data</span - > <a name="t:Ex" class="def" + > <a href="" id="t:Ex" class="def" >Ex</a > a</p ><div class="doc" @@ -1830,7 +1870,7 @@ is at the beginning of the line).</pre >forall</span > b . <a href="" >C</a - > b => <a name="v:Ex1" class="def" + > b => <a href="" id="v:Ex1" class="def" >Ex1</a > b</td ><td class="doc empty" @@ -1840,7 +1880,7 @@ is at the beginning of the line).</pre ><td class="src" ><span class="keyword" >forall</span - > b . <a name="v:Ex2" class="def" + > b . <a href="" id="v:Ex2" class="def" >Ex2</a > b</td ><td class="doc empty" @@ -1852,7 +1892,7 @@ is at the beginning of the line).</pre >forall</span > b . <a href="" >C</a - > a => <a name="v:Ex3" class="def" + > a => <a href="" id="v:Ex3" class="def" >Ex3</a > b</td ><td class="doc empty" @@ -1860,7 +1900,7 @@ is at the beginning of the line).</pre ></tr ><tr ><td class="src" - ><a name="v:Ex4" class="def" + ><a href="" id="v:Ex4" class="def" >Ex4</a > (<span class="keyword" >forall</span @@ -1875,7 +1915,7 @@ is at the beginning of the line).</pre >Type signatures with argument docs</h1 ><div class="top" ><p class="src" - ><a name="v:k" class="def" + ><a href="" id="v:k" class="def" >k</a ></p ><div class="subs arguments" @@ -1963,7 +2003,7 @@ is at the beginning of the line).</pre ></div ><div class="top" ><p class="src" - ><a name="v:l" class="def" + ><a href="" id="v:l" class="def" >l</a ></p ><div class="subs arguments" @@ -2003,7 +2043,7 @@ is at the beginning of the line).</pre ></div ><div class="top" ><p class="src" - ><a name="v:m" class="def" + ><a href="" id="v:m" class="def" >m</a ></p ><div class="subs arguments" @@ -2049,7 +2089,7 @@ is at the beginning of the line).</pre ></div ><div class="top" ><p class="src" - ><a name="v:o" class="def" + ><a href="" id="v:o" class="def" >o</a ></p ><div class="subs arguments" @@ -2099,7 +2139,7 @@ is at the beginning of the line).</pre ></div ><div class="top" ><p class="src" - ><a name="v:f-39-" class="def" + ><a href="" id="v:f-39-" class="def" >f'</a > :: <a href="" >Int</a @@ -2116,7 +2156,7 @@ is at the beginning of the line).</pre ></div ><div class="top" ><p class="src" - ><a name="v:withType" class="def" + ><a href="" id="v:withType" class="def" >withType</a > :: <a href="" >Int</a @@ -2128,7 +2168,7 @@ is at the beginning of the line).</pre ></div ><div class="top" ><p class="src" - ><a name="v:withoutType" class="def" + ><a href="" id="v:withoutType" class="def" >withoutType</a > :: t</p ><div class="doc" @@ -2142,7 +2182,7 @@ is at the beginning of the line).</pre ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/Ticket253_1.html b/html-test/ref/Threaded.html index 2853001c..1f54b9ea 100644 --- a/html-test/ref/Ticket253_1.html +++ b/html-test/ref/Threaded.html @@ -3,13 +3,13 @@ ><head ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title - >Ticket253_1</title + >Threaded</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_Ticket253_1.html");}; +window.onload = function () {pageLoad();setSynopsis("mini_Threaded.html");}; //]]> </script ></head @@ -35,11 +35,21 @@ window.onload = function () {pageLoad();setSynopsis("mini_Ticket253_1.html");}; ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >None</td ></tr ></table ><p class="caption" - >Ticket253_1</p + >Threaded</p + ></div + ><div id="description" + ><p class="caption" + >Description</p + ><div class="doc" + ><p + >Ensures haddock built with <code + >-threaded</code + >.</p + ></div ></div ><div id="synopsis" ><p id="control.syn" class="caption expander" onclick="toggleSection('syn')" @@ -47,9 +57,9 @@ window.onload = function () {pageLoad();setSynopsis("mini_Ticket253_1.html");}; ><ul id="section.syn" class="hide" onclick="toggleSection('syn')" ><li class="src short" ><a href="" - >foo</a + >f</a > :: <a href="" - >Int</a + >Integer</a ></li ></ul ></div @@ -58,24 +68,17 @@ window.onload = function () {pageLoad();setSynopsis("mini_Ticket253_1.html");}; >Documentation</h1 ><div class="top" ><p class="src" - ><a name="v:foo" class="def" - >foo</a + ><a href="" id="v:f" class="def" + >f</a > :: <a href="" - >Int</a + >Integer</a ></p ><div class="doc" ><p - >See <code - ><a href="" - >bar</a - ></code - >.</p - ><p - >Also see <code - ><a href="" - >Baz</a - ></code - ></p + ><code + >$(forkTH)</code + > fails at compile time if haddock isn't using the + threaded RTS.</p ></div ></div ></div @@ -84,7 +87,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Ticket253_1.html");}; ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/Ticket112.html b/html-test/ref/Ticket112.html index 528787c7..4aefb488 100644 --- a/html-test/ref/Ticket112.html +++ b/html-test/ref/Ticket112.html @@ -56,7 +56,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Ticket112.html");}; >Documentation</h1 ><div class="top" ><p class="src" - ><a name="v:f" class="def" + ><a href="" id="v:f" class="def" >f</a > :: a</p ><div class="doc" @@ -74,7 +74,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Ticket112.html");}; ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/Ticket61.html b/html-test/ref/Ticket61.html index 5a181e0c..aeb3c022 100644 --- a/html-test/ref/Ticket61.html +++ b/html-test/ref/Ticket61.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Ticket61.html");}; ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -48,7 +48,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Ticket61.html");}; ><p class="src" ><span class="keyword" >class</span - > <a name="t:C" class="def" + > <a href="" id="t:C" class="def" >C</a > a <span class="keyword" >where</span @@ -57,7 +57,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Ticket61.html");}; ><p class="caption" >Methods</p ><p class="src" - ><a name="v:f" class="def" + ><a href="" id="v:f" class="def" >f</a > :: a</p ><div class="doc" @@ -72,7 +72,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Ticket61.html");}; ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/Ticket75.html b/html-test/ref/Ticket75.html index 26686701..169b0522 100644 --- a/html-test/ref/Ticket75.html +++ b/html-test/ref/Ticket75.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Ticket75.html");}; ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -68,7 +68,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Ticket75.html");}; ><p class="src" ><span class="keyword" >data</span - > a <a name="t::-45-" class="def" + > a <a href="" id="t::-45-" class="def" >:-</a > b</p ><div class="subs constructors" @@ -77,7 +77,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Ticket75.html");}; ><table ><tr ><td class="src" - ><a name="v:Q" class="def" + ><a href="" id="v:Q" class="def" >Q</a ></td ><td class="doc empty" @@ -88,7 +88,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Ticket75.html");}; ></div ><div class="top" ><p class="src" - ><a name="v:f" class="def" + ><a href="" id="v:f" class="def" >f</a > :: <a href="" >Int</a @@ -108,7 +108,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Ticket75.html");}; ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/TitledPicture.html b/html-test/ref/TitledPicture.html index f1353dfa..3aac9689 100644 --- a/html-test/ref/TitledPicture.html +++ b/html-test/ref/TitledPicture.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_TitledPicture.html");} ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -64,7 +64,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_TitledPicture.html");} >Documentation</h1 ><div class="top" ><p class="src" - ><a name="v:foo" class="def" + ><a href="" id="v:foo" class="def" >foo</a > :: <a href="" >Integer</a @@ -81,7 +81,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_TitledPicture.html");} ></div ><div class="top" ><p class="src" - ><a name="v:bar" class="def" + ><a href="" id="v:bar" class="def" >bar</a > :: <a href="" >Integer</a @@ -102,7 +102,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_TitledPicture.html");} ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/TypeFamilies.html b/html-test/ref/TypeFamilies.html index 355d9248..3295318f 100644 --- a/html-test/ref/TypeFamilies.html +++ b/html-test/ref/TypeFamilies.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies.html");}; ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -162,7 +162,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies.html");}; ><p class="src" ><span class="keyword" >data</span - > <a name="t:X" class="def" + > <a href="" id="t:X" class="def" >X</a ></p ><div class="doc" @@ -175,7 +175,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies.html");}; ><table ><tr ><td class="src" - ><a name="v:X" class="def" + ><a href="" id="v:X" class="def" >X</a ></td ><td class="doc" @@ -185,7 +185,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies.html");}; ></tr ><tr ><td class="src" - ><a name="v:XX" class="def" + ><a href="" id="v:XX" class="def" >XX</a ></td ><td class="doc" @@ -195,7 +195,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies.html");}; ></tr ><tr ><td class="src" - ><a name="v:XXX" class="def" + ><a href="" id="v:XXX" class="def" >XXX</a ></td ><td class="doc" @@ -211,11 +211,15 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies.html");}; ><div id="section.i:X" class="show" ><table ><tr - ><td class="src" - ><a href="" - >Assoc</a - > * <a href="" - >X</a + ><td class="src clearfix" + ><span class="inst-left" + ><span id="control.i:id:X:Assoc:1" class="instance expander" onclick="toggleSection('i:id:X:Assoc:1')" + ></span + > <a href="" + >Assoc</a + > * <a href="" + >X</a + ></span ></td ><td class="doc" ><p @@ -223,11 +227,41 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies.html");}; ></td ></tr ><tr - ><td class="src" - ><a href="" - >Test</a - > * <a href="" - >X</a + ><td colspan="2" + ><div id="section.i:id:X:Assoc:1" class="inst-details hide" + ><div class="subs associated-types" + ><p class="caption" + >Associated Types</p + ><p class="src" + ><span class="keyword" + >data</span + > <a href="" + >AssocD</a + > (<a href="" + >X</a + > :: k)</p + ><p class="src" + ><span class="keyword" + >type</span + > <a href="" + >AssocT</a + > (<a href="" + >X</a + > :: k) :: *</p + ></div + ></div + ></td + ></tr + ><tr + ><td class="src clearfix" + ><span class="inst-left" + ><span id="control.i:id:X:Test:2" class="instance expander" onclick="toggleSection('i:id:X:Test:2')" + ></span + > <a href="" + >Test</a + > * <a href="" + >X</a + ></span ></td ><td class="doc" ><p @@ -235,29 +269,47 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies.html");}; ></td ></tr ><tr - ><td class="src" - ><a href="" - >(><)</a - > <a href="" - >X</a - > <a href="" - >XX</a - > <a href="" - >XXX</a + ><td colspan="2" + ><div id="section.i:id:X:Test:2" class="inst-details hide" + ></div + ></td + ></tr + ><tr + ><td class="src clearfix" + ><span class="inst-left" + ><span id="control.i:id:X:-62--60-:3" class="instance expander" onclick="toggleSection('i:id:X:-62--60-:3')" + ></span + > <a href="" + >(><)</a + > <a href="" + >X</a + > <a href="" + >XX</a + > <a href="" + >XXX</a + ></span ></td ><td class="doc empty" > </td ></tr ><tr - ><td class="src" - ><span class="keyword" - >type</span - > <a href="" - >Foo</a - > <a href="" - >X</a - > = <a href="" - >Y</a + ><td colspan="2" + ><div id="section.i:id:X:-62--60-:3" class="inst-details hide" + ></div + ></td + ></tr + ><tr + ><td class="src clearfix" + ><span class="inst-left" + ><span class="keyword" + >type</span + > <a href="" + >Foo</a + > <a href="" + >X</a + > = <a href="" + >Y</a + ></span ></td ><td class="doc" ><p @@ -265,69 +317,75 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies.html");}; ></td ></tr ><tr - ><td class="src" - ><span class="keyword" - >data</span - > <a href="" - >AssocD</a - > * <a href="" - >X</a - > = <a name="v:AssocX" class="def" - >AssocX</a + ><td class="src clearfix" + ><span class="inst-left" + ><span class="keyword" + >data</span + > <a href="" + >AssocD</a + > * <a href="" + >X</a + > = <a href="" id="v:AssocX" class="def" + >AssocX</a + ></span ></td ><td class="doc empty" > </td ></tr ><tr - ><td class="src" - ><span class="keyword" - >type</span - > <a href="" - >AssocT</a - > * <a href="" - >X</a - > = <a href="" - >Foo</a - > * <a href="" - >X</a + ><td class="src clearfix" + ><span class="inst-left" + ><span class="keyword" + >type</span + > <a href="" + >AssocT</a + > * <a href="" + >X</a + > = <a href="" + >Foo</a + > * <a href="" + >X</a + ></span ></td ><td class="doc empty" > </td ></tr ><tr - ><td class="src" - ><span class="keyword" - >data</span - > <a href="" - >Bat</a - > * <a href="" - >X</a - > <ul class="inst" - ><li class="inst" - >= <a name="v:BatX" class="def" - >BatX</a - > <a href="" - >X</a - ></li + ><td class="src clearfix" + ><span class="inst-left" + ><span class="keyword" + >data</span + > <a href="" + >Bat</a + > * <a href="" + >X</a + > <ul class="inst" ><li class="inst" - >| <a name="v:BatXX" class="def" - >BatXX</a - > { <ul class="subs" - ><li - ><a name="v:aaa" class="def" - >aaa</a - > :: <a href="" - >X</a - ></li + >= <a href="" id="v:BatX" class="def" + >BatX</a + > <a href="" + >X</a + ></li + ><li class="inst" + >| <a href="" id="v:BatXX" class="def" + >BatXX</a + > { <ul class="subs" ><li - ><a name="v:bbb" class="def" - >bbb</a - > :: <a href="" - >Y</a - ></li - ></ul - > }</li - ></ul + ><a href="" id="v:aaa" class="def" + >aaa</a + > :: <a href="" + >X</a + ></li + ><li + ><a href="" id="v:bbb" class="def" + >bbb</a + > :: <a href="" + >Y</a + ></li + ></ul + > }</li + ></ul + ></span ></td ><td class="doc" ><p @@ -335,15 +393,17 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies.html");}; ></td ></tr ><tr - ><td class="src" - ><span class="keyword" - >type</span - > <a href="" - >Foo</a - > * <a href="" - >X</a - > = <a href="" - >Y</a + ><td class="src clearfix" + ><span class="inst-left" + ><span class="keyword" + >type</span + > <a href="" + >Foo</a + > * <a href="" + >X</a + > = <a href="" + >Y</a + ></span ></td ><td class="doc" ><p @@ -351,33 +411,37 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies.html");}; ></td ></tr ><tr - ><td class="src" - ><span class="keyword" - >type</span - > <a href="" - >(<>)</a - > * <a href="" - >X</a - > a = <a href="" - >X</a + ><td class="src clearfix" + ><span class="inst-left" + ><span class="keyword" + >type</span + > <a href="" + >(<>)</a + > * <a href="" + >X</a + > a = <a href="" + >X</a + ></span ></td ><td class="doc empty" > </td ></tr ><tr - ><td class="src" - ><span class="keyword" - >type</span - > <a href="" - >(<>)</a - > <a href="" - >X</a - > <a href="" - >XXX</a - > <a href="" - >XX</a - > = <a href="" - >X</a + ><td class="src clearfix" + ><span class="inst-left" + ><span class="keyword" + >type</span + > <a href="" + >(<>)</a + > <a href="" + >X</a + > <a href="" + >XXX</a + > <a href="" + >XX</a + > = <a href="" + >X</a + ></span ></td ><td class="doc empty" > </td @@ -390,7 +454,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies.html");}; ><p class="src" ><span class="keyword" >data</span - > <a name="t:Y" class="def" + > <a href="" id="t:Y" class="def" >Y</a ></p ><div class="doc" @@ -403,11 +467,15 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies.html");}; ><div id="section.i:Y" class="show" ><table ><tr - ><td class="src" - ><a href="" - >Assoc</a - > * <a href="" - >Y</a + ><td class="src clearfix" + ><span class="inst-left" + ><span id="control.i:id:Y:Assoc:1" class="instance expander" onclick="toggleSection('i:id:Y:Assoc:1')" + ></span + > <a href="" + >Assoc</a + > * <a href="" + >Y</a + ></span ></td ><td class="doc" ><p @@ -415,11 +483,41 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies.html");}; ></td ></tr ><tr - ><td class="src" - ><a href="" - >Test</a - > * <a href="" - >Y</a + ><td colspan="2" + ><div id="section.i:id:Y:Assoc:1" class="inst-details hide" + ><div class="subs associated-types" + ><p class="caption" + >Associated Types</p + ><p class="src" + ><span class="keyword" + >data</span + > <a href="" + >AssocD</a + > (<a href="" + >Y</a + > :: k)</p + ><p class="src" + ><span class="keyword" + >type</span + > <a href="" + >AssocT</a + > (<a href="" + >Y</a + > :: k) :: *</p + ></div + ></div + ></td + ></tr + ><tr + ><td class="src clearfix" + ><span class="inst-left" + ><span id="control.i:id:Y:Test:2" class="instance expander" onclick="toggleSection('i:id:Y:Test:2')" + ></span + > <a href="" + >Test</a + > * <a href="" + >Y</a + ></span ></td ><td class="doc" ><p @@ -427,59 +525,73 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies.html");}; ></td ></tr ><tr - ><td class="src" - ><span class="keyword" - >data</span - > <a href="" - >Bar</a - > <a href="" - >Y</a + ><td colspan="2" + ><div id="section.i:id:Y:Test:2" class="inst-details hide" + ></div + ></td + ></tr + ><tr + ><td class="src clearfix" + ><span class="inst-left" + ><span class="keyword" + >data</span + > <a href="" + >Bar</a + > <a href="" + >Y</a + ></span ></td ><td class="doc empty" > </td ></tr ><tr - ><td class="src" - ><span class="keyword" - >data</span - > <a href="" - >AssocD</a - > * <a href="" - >Y</a - > = <a name="v:AssocY" class="def" - >AssocY</a + ><td class="src clearfix" + ><span class="inst-left" + ><span class="keyword" + >data</span + > <a href="" + >AssocD</a + > * <a href="" + >Y</a + > = <a href="" id="v:AssocY" class="def" + >AssocY</a + ></span ></td ><td class="doc empty" > </td ></tr ><tr - ><td class="src" - ><span class="keyword" - >type</span - > <a href="" - >AssocT</a - > * <a href="" - >Y</a - > = <a href="" - >Bat</a - > * <a href="" - >Y</a + ><td class="src clearfix" + ><span class="inst-left" + ><span class="keyword" + >type</span + > <a href="" + >AssocT</a + > * <a href="" + >Y</a + > = <a href="" + >Bat</a + > * <a href="" + >Y</a + ></span ></td ><td class="doc empty" > </td ></tr ><tr - ><td class="src" - ><span class="keyword" - >data</span - > <a href="" - >Bat</a - > * <a href="" - >Y</a - > = <a name="v:BatY" class="def" - >BatY</a - > <a href="" - >Y</a + ><td class="src clearfix" + ><span class="inst-left" + ><span class="keyword" + >data</span + > <a href="" + >Bat</a + > * <a href="" + >Y</a + > = <a href="" id="v:BatY" class="def" + >BatY</a + > <a href="" + >Y</a + ></span ></td ><td class="doc" ><p @@ -487,15 +599,17 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies.html");}; ></td ></tr ><tr - ><td class="src" - ><span class="keyword" - >type</span - > <a href="" - >Foo</a - > * <a href="" - >Y</a - > = <a href="" - >X</a + ><td class="src clearfix" + ><span class="inst-left" + ><span class="keyword" + >type</span + > <a href="" + >Foo</a + > * <a href="" + >Y</a + > = <a href="" + >X</a + ></span ></td ><td class="doc" ><p @@ -503,14 +617,16 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies.html");}; ></td ></tr ><tr - ><td class="src" - ><span class="keyword" - >type</span - > <a href="" - >(<>)</a - > * <a href="" - >Y</a - > a = a</td + ><td class="src clearfix" + ><span class="inst-left" + ><span class="keyword" + >type</span + > <a href="" + >(<>)</a + > * <a href="" + >Y</a + > a = a</span + ></td ><td class="doc empty" > </td ></tr @@ -522,7 +638,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies.html");}; ><p class="src" ><span class="keyword" >data</span - > <a name="t:Z" class="def" + > <a href="" id="t:Z" class="def" >Z</a ></p ><div class="doc" @@ -535,7 +651,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies.html");}; ><table ><tr ><td class="src" - ><a name="v:ZA" class="def" + ><a href="" id="v:ZA" class="def" >ZA</a ></td ><td class="doc empty" @@ -543,7 +659,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies.html");}; ></tr ><tr ><td class="src" - ><a name="v:ZB" class="def" + ><a href="" id="v:ZB" class="def" >ZB</a ></td ><td class="doc empty" @@ -557,53 +673,55 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies.html");}; ><div id="section.i:Z" class="show" ><table ><tr - ><td class="src" - ><span class="keyword" - >data</span - > <a href="" - >Bat</a - > <a href="" - >Z</a - > <span class="keyword" - >where</span - ><ul class="inst" - ><li class="inst" - ><a name="v:BatZ1" class="def" - >BatZ1</a - > :: <a href="" - >Z</a - > -> <a href="" - >Bat</a - > <a href="" - >Z</a - > <a href="" - >ZA</a - ></li + ><td class="src clearfix" + ><span class="inst-left" + ><span class="keyword" + >data</span + > <a href="" + >Bat</a + > <a href="" + >Z</a + > <span class="keyword" + >where</span + ><ul class="inst" ><li class="inst" - ><a name="v:BatZ2" class="def" - >BatZ2</a - > :: { <ul class="subs" - ><li - ><a name="v:batx" class="def" - >batx</a - > :: <a href="" - >X</a - ></li + ><a href="" id="v:BatZ1" class="def" + >BatZ1</a + > :: <a href="" + >Z</a + > -> <a href="" + >Bat</a + > <a href="" + >Z</a + > <a href="" + >ZA</a + ></li + ><li class="inst" + ><a href="" id="v:BatZ2" class="def" + >BatZ2</a + > :: { <ul class="subs" ><li - ><a name="v:baty" class="def" - >baty</a - > :: <a href="" - >Y</a - ></li - ></ul - > } -> <a href="" - >Bat</a - > <a href="" - >Z</a - > <a href="" - >ZB</a - ></li - ></ul + ><a href="" id="v:batx" class="def" + >batx</a + > :: <a href="" + >X</a + ></li + ><li + ><a href="" id="v:baty" class="def" + >baty</a + > :: <a href="" + >Y</a + ></li + ></ul + > } -> <a href="" + >Bat</a + > <a href="" + >Z</a + > <a href="" + >ZB</a + ></li + ></ul + ></span ></td ><td class="doc" ><p @@ -618,7 +736,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies.html");}; ><p class="src" ><span class="keyword" >class</span - > <a name="t:Test" class="def" + > <a href="" id="t:Test" class="def" >Test</a > a</p ><div class="doc" @@ -631,11 +749,15 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies.html");}; ><div id="section.i:Test" class="show" ><table ><tr - ><td class="src" - ><a href="" - >Test</a - > * <a href="" - >Y</a + ><td class="src clearfix" + ><span class="inst-left" + ><span id="control.i:ic:Test:Test:1" class="instance expander" onclick="toggleSection('i:ic:Test:Test:1')" + ></span + > <a href="" + >Test</a + > * <a href="" + >Y</a + ></span ></td ><td class="doc" ><p @@ -643,17 +765,33 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies.html");}; ></td ></tr ><tr - ><td class="src" - ><a href="" - >Test</a - > * <a href="" - >X</a + ><td colspan="2" + ><div id="section.i:ic:Test:Test:1" class="inst-details hide" + ></div + ></td + ></tr + ><tr + ><td class="src clearfix" + ><span class="inst-left" + ><span id="control.i:ic:Test:Test:2" class="instance expander" onclick="toggleSection('i:ic:Test:Test:2')" + ></span + > <a href="" + >Test</a + > * <a href="" + >X</a + ></span ></td ><td class="doc" ><p >Doc for: instance Test X</p ></td ></tr + ><tr + ><td colspan="2" + ><div id="section.i:ic:Test:Test:2" class="inst-details hide" + ></div + ></td + ></tr ></table ></div ></div @@ -662,7 +800,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies.html");}; ><p class="src" ><span class="keyword" >type family</span - > <a name="t:Foo" class="def" + > <a href="" id="t:Foo" class="def" >Foo</a > a :: k</p ><div class="doc" @@ -675,15 +813,17 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies.html");}; ><div id="section.i:Foo" class="show" ><table ><tr - ><td class="src" - ><span class="keyword" - >type</span - > <a href="" - >Foo</a - > * <a href="" - >Y</a - > = <a href="" - >X</a + ><td class="src clearfix" + ><span class="inst-left" + ><span class="keyword" + >type</span + > <a href="" + >Foo</a + > * <a href="" + >Y</a + > = <a href="" + >X</a + ></span ></td ><td class="doc" ><p @@ -691,15 +831,17 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies.html");}; ></td ></tr ><tr - ><td class="src" - ><span class="keyword" - >type</span - > <a href="" - >Foo</a - > * <a href="" - >X</a - > = <a href="" - >Y</a + ><td class="src clearfix" + ><span class="inst-left" + ><span class="keyword" + >type</span + > <a href="" + >Foo</a + > * <a href="" + >X</a + > = <a href="" + >Y</a + ></span ></td ><td class="doc" ><p @@ -714,7 +856,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies.html");}; ><p class="src" ><span class="keyword" >data family</span - > <a name="t:Bat" class="def" + > <a href="" id="t:Bat" class="def" >Bat</a > a :: *</p ><div class="doc" @@ -727,53 +869,55 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies.html");}; ><div id="section.i:Bat" class="show" ><table ><tr - ><td class="src" - ><span class="keyword" - >data</span - > <a href="" - >Bat</a - > <a href="" - >Z</a - > <span class="keyword" - >where</span - ><ul class="inst" - ><li class="inst" - ><a name="v:BatZ1" class="def" - >BatZ1</a - > :: <a href="" - >Z</a - > -> <a href="" - >Bat</a - > <a href="" - >Z</a - > <a href="" - >ZA</a - ></li + ><td class="src clearfix" + ><span class="inst-left" + ><span class="keyword" + >data</span + > <a href="" + >Bat</a + > <a href="" + >Z</a + > <span class="keyword" + >where</span + ><ul class="inst" ><li class="inst" - ><a name="v:BatZ2" class="def" - >BatZ2</a - > :: { <ul class="subs" - ><li - ><a name="v:batx" class="def" - >batx</a - > :: <a href="" - >X</a - ></li + ><a href="" id="v:BatZ1" class="def" + >BatZ1</a + > :: <a href="" + >Z</a + > -> <a href="" + >Bat</a + > <a href="" + >Z</a + > <a href="" + >ZA</a + ></li + ><li class="inst" + ><a href="" id="v:BatZ2" class="def" + >BatZ2</a + > :: { <ul class="subs" ><li - ><a name="v:baty" class="def" - >baty</a - > :: <a href="" - >Y</a - ></li - ></ul - > } -> <a href="" - >Bat</a - > <a href="" - >Z</a - > <a href="" - >ZB</a - ></li - ></ul + ><a href="" id="v:batx" class="def" + >batx</a + > :: <a href="" + >X</a + ></li + ><li + ><a href="" id="v:baty" class="def" + >baty</a + > :: <a href="" + >Y</a + ></li + ></ul + > } -> <a href="" + >Bat</a + > <a href="" + >Z</a + > <a href="" + >ZB</a + ></li + ></ul + ></span ></td ><td class="doc" ><p @@ -781,17 +925,19 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies.html");}; ></td ></tr ><tr - ><td class="src" - ><span class="keyword" - >data</span - > <a href="" - >Bat</a - > * <a href="" - >Y</a - > = <a name="v:BatY" class="def" - >BatY</a - > <a href="" - >Y</a + ><td class="src clearfix" + ><span class="inst-left" + ><span class="keyword" + >data</span + > <a href="" + >Bat</a + > * <a href="" + >Y</a + > = <a href="" id="v:BatY" class="def" + >BatY</a + > <a href="" + >Y</a + ></span ></td ><td class="doc" ><p @@ -799,39 +945,41 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies.html");}; ></td ></tr ><tr - ><td class="src" - ><span class="keyword" - >data</span - > <a href="" - >Bat</a - > * <a href="" - >X</a - > <ul class="inst" - ><li class="inst" - >= <a name="v:BatX" class="def" - >BatX</a - > <a href="" - >X</a - ></li + ><td class="src clearfix" + ><span class="inst-left" + ><span class="keyword" + >data</span + > <a href="" + >Bat</a + > * <a href="" + >X</a + > <ul class="inst" ><li class="inst" - >| <a name="v:BatXX" class="def" - >BatXX</a - > { <ul class="subs" - ><li - ><a name="v:aaa" class="def" - >aaa</a - > :: <a href="" - >X</a - ></li + >= <a href="" id="v:BatX" class="def" + >BatX</a + > <a href="" + >X</a + ></li + ><li class="inst" + >| <a href="" id="v:BatXX" class="def" + >BatXX</a + > { <ul class="subs" ><li - ><a name="v:bbb" class="def" - >bbb</a - > :: <a href="" - >Y</a - ></li - ></ul - > }</li - ></ul + ><a href="" id="v:aaa" class="def" + >aaa</a + > :: <a href="" + >X</a + ></li + ><li + ><a href="" id="v:bbb" class="def" + >bbb</a + > :: <a href="" + >Y</a + ></li + ></ul + > }</li + ></ul + ></span ></td ><td class="doc" ><p @@ -846,7 +994,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies.html");}; ><p class="src" ><span class="keyword" >class</span - > <a name="t:Assoc" class="def" + > <a href="" id="t:Assoc" class="def" >Assoc</a > a</p ><div class="doc" @@ -859,7 +1007,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies.html");}; ><p class="src" ><span class="keyword" >data</span - > <a name="t:AssocD" class="def" + > <a href="" id="t:AssocD" class="def" >AssocD</a > a :: *</p ><div class="doc" @@ -869,7 +1017,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies.html");}; ><p class="src" ><span class="keyword" >type</span - > <a name="t:AssocT" class="def" + > <a href="" id="t:AssocT" class="def" >AssocT</a > a :: *</p ><div class="doc" @@ -883,11 +1031,15 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies.html");}; ><div id="section.i:Assoc" class="show" ><table ><tr - ><td class="src" - ><a href="" - >Assoc</a - > * <a href="" - >Y</a + ><td class="src clearfix" + ><span class="inst-left" + ><span id="control.i:ic:Assoc:Assoc:1" class="instance expander" onclick="toggleSection('i:ic:Assoc:Assoc:1')" + ></span + > <a href="" + >Assoc</a + > * <a href="" + >Y</a + ></span ></td ><td class="doc" ><p @@ -895,17 +1047,73 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies.html");}; ></td ></tr ><tr - ><td class="src" - ><a href="" - >Assoc</a - > * <a href="" - >X</a + ><td colspan="2" + ><div id="section.i:ic:Assoc:Assoc:1" class="inst-details hide" + ><div class="subs associated-types" + ><p class="caption" + >Associated Types</p + ><p class="src" + ><span class="keyword" + >data</span + > <a href="" + >AssocD</a + > (<a href="" + >Y</a + > :: k)</p + ><p class="src" + ><span class="keyword" + >type</span + > <a href="" + >AssocT</a + > (<a href="" + >Y</a + > :: k) :: *</p + ></div + ></div + ></td + ></tr + ><tr + ><td class="src clearfix" + ><span class="inst-left" + ><span id="control.i:ic:Assoc:Assoc:2" class="instance expander" onclick="toggleSection('i:ic:Assoc:Assoc:2')" + ></span + > <a href="" + >Assoc</a + > * <a href="" + >X</a + ></span ></td ><td class="doc" ><p >Doc for: instance Assoc X</p ></td ></tr + ><tr + ><td colspan="2" + ><div id="section.i:ic:Assoc:Assoc:2" class="inst-details hide" + ><div class="subs associated-types" + ><p class="caption" + >Associated Types</p + ><p class="src" + ><span class="keyword" + >data</span + > <a href="" + >AssocD</a + > (<a href="" + >X</a + > :: k)</p + ><p class="src" + ><span class="keyword" + >type</span + > <a href="" + >AssocT</a + > (<a href="" + >X</a + > :: k) :: *</p + ></div + ></div + ></td + ></tr ></table ></div ></div @@ -914,7 +1122,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies.html");}; ><p class="src" ><span class="keyword" >type family</span - > <a name="t:Bar" class="def" + > <a href="" id="t:Bar" class="def" >Bar</a > b</p ><div class="doc" @@ -954,7 +1162,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies.html");}; ><p class="src" ><span class="keyword" >type family</span - > a <a name="t:-60--62-" class="def" + > a <a href="" id="t:-60--62-" class="def" ><></a > b :: k</p ><div class="subs instances" @@ -963,45 +1171,51 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies.html");}; ><div id="section.i:-60--62-" class="show" ><table ><tr - ><td class="src" - ><span class="keyword" - >type</span - > <a href="" - >(<>)</a - > * <a href="" - >Y</a - > a = a</td + ><td class="src clearfix" + ><span class="inst-left" + ><span class="keyword" + >type</span + > <a href="" + >(<>)</a + > * <a href="" + >Y</a + > a = a</span + ></td ><td class="doc empty" > </td ></tr ><tr - ><td class="src" - ><span class="keyword" - >type</span - > <a href="" - >(<>)</a - > * <a href="" - >X</a - > a = <a href="" - >X</a + ><td class="src clearfix" + ><span class="inst-left" + ><span class="keyword" + >type</span + > <a href="" + >(<>)</a + > * <a href="" + >X</a + > a = <a href="" + >X</a + ></span ></td ><td class="doc empty" > </td ></tr ><tr - ><td class="src" - ><span class="keyword" - >type</span - > <a href="" - >(<>)</a - > <a href="" - >X</a - > <a href="" - >XXX</a - > <a href="" - >XX</a - > = <a href="" - >X</a + ><td class="src clearfix" + ><span class="inst-left" + ><span class="keyword" + >type</span + > <a href="" + >(<>)</a + > <a href="" + >X</a + > <a href="" + >XXX</a + > <a href="" + >XX</a + > = <a href="" + >X</a + ></span ></td ><td class="doc empty" > </td @@ -1014,7 +1228,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies.html");}; ><p class="src" ><span class="keyword" >class</span - > a <a name="t:-62--60-" class="def" + > a <a href="" id="t:-62--60-" class="def" >><</a > b</p ><div class="subs instances" @@ -1023,19 +1237,29 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies.html");}; ><div id="section.i:-62--60-" class="show" ><table ><tr - ><td class="src" - ><a href="" - >(><)</a - > <a href="" - >X</a - > <a href="" - >XX</a - > <a href="" - >XXX</a + ><td class="src clearfix" + ><span class="inst-left" + ><span id="control.i:ic:-62--60-:-62--60-:1" class="instance expander" onclick="toggleSection('i:ic:-62--60-:-62--60-:1')" + ></span + > <a href="" + >(><)</a + > <a href="" + >X</a + > <a href="" + >XX</a + > <a href="" + >XXX</a + ></span ></td ><td class="doc empty" > </td ></tr + ><tr + ><td colspan="2" + ><div id="section.i:ic:-62--60-:-62--60-:1" class="inst-details hide" + ></div + ></td + ></tr ></table ></div ></div @@ -1046,7 +1270,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies.html");}; ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/TypeFamilies2.html b/html-test/ref/TypeFamilies2.html index 38c45a95..0c7e4ec6 100644 --- a/html-test/ref/TypeFamilies2.html +++ b/html-test/ref/TypeFamilies2.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies2.html");} ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -72,7 +72,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies2.html");} ><p class="src" ><span class="keyword" >data</span - > <a name="t:W" class="def" + > <a href="" id="t:W" class="def" >W</a ></p ><div class="doc" @@ -85,29 +85,33 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies2.html");} ><div id="section.i:W" class="show" ><table ><tr - ><td class="src" - ><span class="keyword" - >data</span - > <a href="" - >Bar</a - > <a href="" - >W</a - > = <a name="v:BarX" class="def" - >BarX</a - > Z</td + ><td class="src clearfix" + ><span class="inst-left" + ><span class="keyword" + >data</span + > <a href="" + >Bar</a + > <a href="" + >W</a + > = <a href="" id="v:BarX" class="def" + >BarX</a + > Z</span + ></td ><td class="doc" ><p >Shown because BarX is still exported despite Z being hidden</p ></td ></tr ><tr - ><td class="src" - ><span class="keyword" - >type</span - > <a href="" - >Foo</a - > <a href="" - >W</a + ><td class="src clearfix" + ><span class="inst-left" + ><span class="keyword" + >type</span + > <a href="" + >Foo</a + > <a href="" + >W</a + ></span ></td ><td class="doc" ><p @@ -122,7 +126,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies2.html");} ><p class="src" ><span class="keyword" >type family</span - > <a name="t:Foo" class="def" + > <a href="" id="t:Foo" class="def" >Foo</a > a</p ><div class="doc" @@ -135,13 +139,15 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies2.html");} ><div id="section.i:Foo" class="show" ><table ><tr - ><td class="src" - ><span class="keyword" - >type</span - > <a href="" - >Foo</a - > <a href="" - >W</a + ><td class="src clearfix" + ><span class="inst-left" + ><span class="keyword" + >type</span + > <a href="" + >Foo</a + > <a href="" + >W</a + ></span ></td ><td class="doc" ><p @@ -149,15 +155,17 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies2.html");} ></td ></tr ><tr - ><td class="src" - ><span class="keyword" - >type</span - > <a href="" - >Foo</a - > <a href="" - >X</a - > = <a href="" - >Y</a + ><td class="src clearfix" + ><span class="inst-left" + ><span class="keyword" + >type</span + > <a href="" + >Foo</a + > <a href="" + >X</a + > = <a href="" + >Y</a + ></span ></td ><td class="doc" ><p @@ -172,7 +180,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies2.html");} ><p class="src" ><span class="keyword" >data family</span - > <a name="t:Bar" class="def" + > <a href="" id="t:Bar" class="def" >Bar</a > a</p ><div class="doc" @@ -185,29 +193,33 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies2.html");} ><div id="section.i:Bar" class="show" ><table ><tr - ><td class="src" - ><span class="keyword" - >data</span - > <a href="" - >Bar</a - > <a href="" - >W</a - > = <a name="v:BarX" class="def" - >BarX</a - > Z</td + ><td class="src clearfix" + ><span class="inst-left" + ><span class="keyword" + >data</span + > <a href="" + >Bar</a + > <a href="" + >W</a + > = <a href="" id="v:BarX" class="def" + >BarX</a + > Z</span + ></td ><td class="doc" ><p >Shown because BarX is still exported despite Z being hidden</p ></td ></tr ><tr - ><td class="src" - ><span class="keyword" - >data</span - > <a href="" - >Bar</a - > <a href="" - >Y</a + ><td class="src clearfix" + ><span class="inst-left" + ><span class="keyword" + >data</span + > <a href="" + >Bar</a + > <a href="" + >Y</a + ></span ></td ><td class="doc empty" > </td @@ -222,7 +234,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies2.html");} ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/TypeOperators.html b/html-test/ref/TypeOperators.html index 2e80bf9f..283083be 100644 --- a/html-test/ref/TypeOperators.html +++ b/html-test/ref/TypeOperators.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeOperators.html");} ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -48,7 +48,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeOperators.html");} ><p class="src" ><span class="keyword" >data</span - > a <a name="t::-45-:" class="def" + > a <a href="" id="t::-45-:" class="def" >:-:</a > b</p ></div @@ -56,7 +56,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeOperators.html");} ><p class="src" ><span class="keyword" >data</span - > (a <a name="t::-43-:" class="def" + > (a <a href="" id="t::-43-:" class="def" >:+:</a > b) c</p ></div @@ -64,7 +64,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeOperators.html");} ><p class="src" ><span class="keyword" >data</span - > <a name="t:Op" class="def" + > <a href="" id="t:Op" class="def" >Op</a > a b</p ></div @@ -72,7 +72,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeOperators.html");} ><p class="src" ><span class="keyword" >newtype</span - > <a name="t:O" class="def" + > <a href="" id="t:O" class="def" >O</a > g f a</p ><div class="subs constructors" @@ -81,7 +81,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeOperators.html");} ><table ><tr ><td class="src" - ><a name="v:O" class="def" + ><a href="" id="v:O" class="def" >O</a ></td ><td class="doc empty" @@ -92,16 +92,16 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeOperators.html");} ><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 + ><ul + ><li + ><dfn class="src" + ><a href="" id="v:unO" class="def" + >unO</a + > :: g (f a)</dfn + ><div class="doc empty" + > </div + ></li + ></ul ></div ></td ></tr @@ -112,13 +112,13 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeOperators.html");} ><p class="src" ><span class="keyword" >class</span - > a <a name="t:-60--61--62-" class="def" + > a <a href="" id="t:-60--61--62-" class="def" ><=></a > b</p ></div ><div class="top" ><p class="src" - ><a name="v:biO" class="def" + ><a href="" id="v:biO" class="def" >biO</a > :: (g <a href="" >`O`</a @@ -126,19 +126,19 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeOperators.html");} ></div ><div class="top" ><p class="src" - ><a name="v:f" class="def" + ><a href="" id="v:f" class="def" >f</a > :: (a ~ b) => a -> b</p ></div ><div class="top" ><p class="src" - ><a name="v:g" class="def" + ><a href="" id="v:g" class="def" >g</a > :: (a ~ b, b ~ c) => a -> c</p ></div ><div class="top" ><p class="src" - ><a name="v:x" class="def" + ><a href="" id="v:x" class="def" >x</a > :: (a <a href="" >:-:</a @@ -150,7 +150,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeOperators.html");} ></div ><div class="top" ><p class="src" - ><a name="v:y" class="def" + ><a href="" id="v:y" class="def" >y</a > :: (a <a href="" ><=></a @@ -166,7 +166,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeOperators.html");} ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/Unicode.html b/html-test/ref/Unicode.html index 56f98571..d724ecd7 100644 --- a/html-test/ref/Unicode.html +++ b/html-test/ref/Unicode.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Unicode.html");}; ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -58,7 +58,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Unicode.html");}; >Documentation</h1 ><div class="top" ><p class="src" - ><a name="v:x" class="def" + ><a href="" id="v:x" class="def" >x</a > :: <a href="" >Int</a @@ -74,7 +74,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Unicode.html");}; ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/Visible.html b/html-test/ref/Visible.html index 5abeda94..54a04e86 100644 --- a/html-test/ref/Visible.html +++ b/html-test/ref/Visible.html @@ -35,7 +35,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Visible.html");}; ><th >Safe Haskell</th ><td - >Safe-Inferred</td + >Safe</td ></tr ></table ><p class="caption" @@ -46,7 +46,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Visible.html");}; >Documentation</h1 ><div class="top" ><p class="src" - ><a name="v:visible" class="def" + ><a href="" id="v:visible" class="def" >visible</a > :: <a href="" >Int</a @@ -60,7 +60,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Visible.html");}; ><p >Produced by <a href="" >Haddock</a - > version 2.15.0</p + > version 2.16.2</p ></div ></body ></html diff --git a/html-test/ref/frames.html b/html-test/ref/frames.html index 1b4e38d4..e86edb66 100644 --- a/html-test/ref/frames.html +++ b/html-test/ref/frames.html @@ -1,4 +1,4 @@ -<!DOCTYPE html +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> diff --git a/html-test/ref/haddock-util.js b/html-test/ref/haddock-util.js index 9a6fccf7..fc7743fe 100644 --- a/html-test/ref/haddock-util.js +++ b/html-test/ref/haddock-util.js @@ -131,11 +131,11 @@ function perform_search(full) var text = document.getElementById("searchbox").value.toLowerCase(); if (text == last_search && !full) return; last_search = text; - + var table = document.getElementById("indexlist"); var status = document.getElementById("searchmsg"); var children = table.firstChild.childNodes; - + // first figure out the first node with the prefix var first = bisect(-1); var last = (first == -1 ? -1 : bisect(1)); @@ -166,7 +166,7 @@ function perform_search(full) status.innerHTML = ""; } - + function setclass(first, last, status) { for (var i = first; i <= last; i++) @@ -174,8 +174,8 @@ function perform_search(full) children[i].className = status; } } - - + + // do a binary search, treating 0 as ... // return either -1 (no 0's found) or location of most far match function bisect(dir) @@ -201,9 +201,9 @@ function perform_search(full) if (checkitem(i) == 0) return i; } return -1; - } - - + } + + // from an index, decide what the result is // 0 = match, -1 is lower, 1 is higher function checkitem(i) @@ -212,8 +212,8 @@ function perform_search(full) if (s == text) return 0; else return (s > text ? -1 : 1); } - - + + // from an index, get its string // this abstracts over alternates function getitem(i) @@ -229,7 +229,7 @@ function perform_search(full) } function setSynopsis(filename) { - if (parent.window.synopsis) { + if (parent.window.synopsis && parent.window.synopsis.location) { if (parent.window.synopsis.location.replace) { // In Firefox this avoids adding the change to the history. parent.window.synopsis.location.replace(filename); @@ -250,7 +250,7 @@ function addMenuItem(html) { function adjustForFrames() { var bodyCls; - + if (parent.location.href == window.location.href) { // not in frames, so add Frames button addMenuItem("<a href='#' onclick='reframe();return true;'>Frames</a>"); diff --git a/html-test/ref/mini_FunArgs.html b/html-test/ref/mini_FunArgs.html index 89729720..eac6c8fe 100644 --- a/html-test/ref/mini_FunArgs.html +++ b/html-test/ref/mini_FunArgs.html @@ -31,6 +31,24 @@ window.onload = function () {pageLoad();}; >g</a ></p ></div + ><div class="top" + ><p class="src" + ><a href="" target="main" + >h</a + ></p + ></div + ><div class="top" + ><p class="src" + ><a href="" target="main" + >i</a + ></p + ></div + ><div class="top" + ><p class="src" + ><a href="" target="main" + >j</a + ></p + ></div ></div ></body ></html diff --git a/html-test/ref/ocean.css b/html-test/ref/ocean.css index de436324..428040bc 100644 --- a/html-test/ref/ocean.css +++ b/html-test/ref/ocean.css @@ -41,6 +41,9 @@ a[href]:link { color: rgb(196,69,29); } a[href]:visited { color: rgb(171,105,84); } a[href]:hover { text-decoration:underline; } +a[href].def:link, a[href].def:visited { color: black; } +a[href].def:hover { color: rgb(78, 98, 114); } + /* @end */ /* @group Fonts & Sizes */ @@ -143,15 +146,21 @@ ul.links li a { background-image: url(plus.gif); background-repeat: no-repeat; } -p.caption.collapser, -p.caption.expander { - background-position: 0 0.4em; -} .collapser, .expander { padding-left: 14px; margin-left: -14px; cursor: pointer; } +p.caption.collapser, +p.caption.expander { + background-position: 0 0.4em; +} + +.instance.collapser, .instance.expander { + margin-left: 0px; + background-position: left center; +} + pre { padding: 0.25em; @@ -318,6 +327,7 @@ div#style-menu-holder { height: 80%; top: 10%; padding: 0; + max-width: 75%; } #synopsis .caption { @@ -378,6 +388,15 @@ div#style-menu-holder { margin: 0 -0.5em 0 0.5em; } +#interface td.src .link { + float: right; + color: #919191; + border-left: 1px solid #919191; + background: #f0f0f0; + padding: 0 0.5em 0.2em; + margin: 0 -0.5em 0 0.5em; +} + #interface span.fixity { color: #919191; border-left: 1px solid #919191; @@ -406,30 +425,39 @@ div#style-menu-holder { margin-top: 0.8em; } -.subs dl { +.clearfix:after { + clear: both; + content: " "; + display: block; + height: 0; + visibility: hidden; +} + +.subs ul { + list-style: none; + display: table; margin: 0; } -.subs dt { - float: left; - clear: left; - display: block; +.subs ul li { + display: table-row; +} + +.subs ul li dfn { + display: table-cell; + font-style: normal; + font-weight: bold; margin: 1px 0; + white-space: nowrap; } -.subs dd { - float: right; - width: 90%; - display: block; +.subs ul li > .doc { + display: table-cell; padding-left: 0.5em; margin-bottom: 0.5em; } -.subs dd.empty { - display: none; -} - -.subs dd p { +.subs ul li > .doc p { margin: 0; } @@ -445,6 +473,11 @@ div#style-menu-holder { margin-left: 1em; } +/* Workaround for bug in Firefox (issue #384) */ +.inst-left { + float: left; +} + .top p.src { border-top: 1px solid #ccc; } diff --git a/html-test/run.lhs b/html-test/run.lhs index a80b265e..1f19b723 100755 --- a/html-test/run.lhs +++ b/html-test/run.lhs @@ -21,7 +21,6 @@ import System.Exit import System.FilePath import System.Process (ProcessHandle, runProcess, waitForProcess, system) - packageRoot, dataDir, haddockPath, baseDir, testDir, outDir :: FilePath baseDir = takeDirectory __FILE__ testDir = baseDir </> "src" @@ -112,11 +111,11 @@ check modules strict = do then do out <- readFile outfile ref <- readFile reffile - if not $ haddockEq out ref + if not $ haddockEq (outfile, out) (reffile, ref) then do putStrLn $ "Output for " ++ mod ++ " has changed! Exiting with diff:" - let ref' = stripLinks ref - out' = stripLinks out + let ref' = maybeStripLinks outfile ref + out' = maybeStripLinks reffile out let reffile' = outDir </> takeFileName reffile ++ ".nolinks" outfile' = outDir </> takeFileName outfile ++ ".ref.nolinks" writeFile reffile' ref' @@ -134,6 +133,10 @@ check modules strict = do else do putStrLn $ "Pass: " ++ mod ++ " (no .ref file)" +-- | List of modules in which we don't 'stripLinks' +preserveLinksModules :: [String] +preserveLinksModules = map (++ ".html") ["Bug253"] + -- | A rather nasty way to drop the Haddock version string from the -- end of the generated HTML files so that we don't have to change -- every single test every time we change versions. We rely on the the @@ -146,9 +149,16 @@ dropVersion = reverse . dropTillP . reverse dropTillP ('p':'<':xs) = xs dropTillP (_:xs) = dropTillP xs -haddockEq :: String -> String -> Bool -haddockEq file1 file2 = - stripLinks (dropVersion file1) == stripLinks (dropVersion file2) +haddockEq :: (FilePath, String) -> (FilePath, String) -> Bool +haddockEq (fn1, file1) (fn2, file2) = + maybeStripLinks fn1 (dropVersion file1) + == maybeStripLinks fn2 (dropVersion file2) + +maybeStripLinks :: String -- ^ Module we're considering for stripping + -> String -> String +maybeStripLinks m = if any (`isSuffixOf` m) preserveLinksModules + then id + else stripLinks stripLinks :: String -> String stripLinks str = diff --git a/html-test/src/AdvanceTypes.hs b/html-test/src/AdvanceTypes.hs deleted file mode 100644 index 939fdf07..00000000 --- a/html-test/src/AdvanceTypes.hs +++ /dev/null @@ -1,9 +0,0 @@ -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE GADTs #-} -{-# LANGUAGE KindSignatures #-} -{-# LANGUAGE TypeOperators #-} -module AdvanceTypes where - -data Pattern :: [*] -> * where - Nil :: Pattern '[] - Cons :: Maybe h -> Pattern t -> Pattern (h ': t) diff --git a/html-test/src/Bug253.hs b/html-test/src/Bug253.hs new file mode 100644 index 00000000..499f6cd4 --- /dev/null +++ b/html-test/src/Bug253.hs @@ -0,0 +1,10 @@ +-- | This module tests that if we're trying to link to a /qualified/ +-- identifier that's not in scope, we get an anchor as if it was a +-- variable. Previous behaviour was to treat it as a type constructor +-- so issue like #253 arose. Also see @rename@ function comments in +-- source. +module Bug253 where + +-- | This link should generate @#v@ anchor: 'DoesNotExist.fakeFakeFake' +foo :: () +foo = () diff --git a/html-test/src/Bug387.hs b/html-test/src/Bug387.hs new file mode 100644 index 00000000..d9fed34e --- /dev/null +++ b/html-test/src/Bug387.hs @@ -0,0 +1,12 @@ +module Bug387 + ( -- * Section1#a:section1# + test1 + -- * Section2#a:section2# + , test2 + ) where + +test1 :: Int +test1 = 223 + +test2 :: Int +test2 = 42 diff --git a/html-test/src/Bug8.hs b/html-test/src/Bug8.hs index e569b01d..30afae1f 100644 --- a/html-test/src/Bug8.hs +++ b/html-test/src/Bug8.hs @@ -7,6 +7,7 @@ data Typ = Type (Typ,[Typ]) | TFree (Typ, [Typ]) x --> y = Type(s,[s,t]) +(--->) :: (Foldable t0) => t0 t -> Typ -> Typ (--->) = flip $ foldr (-->) s = undefined diff --git a/html-test/src/Bugs.hs b/html-test/src/Bugs.hs index 8e1f0079..e60bbe8f 100644 --- a/html-test/src/Bugs.hs +++ b/html-test/src/Bugs.hs @@ -1,3 +1,3 @@ module Bugs where -data A a = A a (a -> Int) +data A a = A a (a -> Int) diff --git a/html-test/src/Instances.hs b/html-test/src/Instances.hs new file mode 100644 index 00000000..545c8534 --- /dev/null +++ b/html-test/src/Instances.hs @@ -0,0 +1,99 @@ +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE ImpredicativeTypes #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE TypeOperators #-} + + +module Instances where + + +newtype (<~~) a b = Xyzzy (b -> (a, a)) + + +class Foo f where + + foo :: f Int -> a -> f a + foo' :: f (f a) -> Int -> f (f Int) + + foo = undefined + foo' = undefined + +instance Foo Maybe +instance Foo [] +instance (Eq a, Foo f) => Foo ((,) (f a)) +instance Foo (Either a) +instance Foo ((,,) a a) +instance Foo ((->) a) +instance Foo ((<~~) a) + + +class Foo f => Bar f a where + + bar :: f a -> f Bool -> a + bar' :: f (f a) -> f (f (f b)) + bar0, bar1 :: (f a, f a) -> (f b, f c) + + bar = undefined + bar' = undefined + bar0 = undefined + bar1 = undefined + + +instance Bar Maybe Bool +instance Bar Maybe [a] +instance Bar [] (a, a) +instance Foo f => Bar (Either a) (f a) +instance Foo ((,,) a b) => Bar ((,,) a b) (a, b, a) + + +class Baz a where + + baz :: a -> (forall a. a -> a) -> (b, forall c. c -> a) -> (b, c) + baz' :: b -> (forall b. b -> a) -> (forall b. b -> a) -> [(b, a)] + baz'' :: b -> (forall b. (forall b. b -> a) -> c) -> (forall c. c -> b) + + baz = undefined + baz' = undefined + baz'' = undefined + + +instance Baz (a -> b) +instance Baz [c] +instance Baz (a, b, c) +instance Baz (a, [b], b, a) + + +data Quux a b c = Qx a | Qux a b | Quux a b c + +instance Foo (Quux a b) +instance Bar (Quux a c) (Quux a b c) +instance Baz (Quux a b c) + + +class Norf a b where + + type Plugh a c b + data Thud a c + + norf :: Plugh a c b -> a -> (a -> c) -> b + + norf = undefined + + +instance Norf Int Bool where + + type Plugh Int [a] Bool = a + type Plugh Int (a, b) Bool = (a, [b]) + + data Thud Int (Quux a [a] c) = Thuud a | Thuuud Int Int + data Thud Int [a] = Thuuuud Bool + + +instance Norf [a] [b] where + + type Plugh [a] (Maybe a) [b] = a + type Plugh [a] [b] [b] = Quux a b (a, b) + + data Thud [a] (a, a, a) = Thd a diff --git a/html-test/src/Nesting.hs b/html-test/src/Nesting.hs index 34177442..f88be87d 100644 --- a/html-test/src/Nesting.hs +++ b/html-test/src/Nesting.hs @@ -119,3 +119,18 @@ definition lists too. -} j :: t j = undefined + +{-| + - list may start at arbitrary depth + + - and consecutive items at that depth + belong to the same list + + - of course we can still + + * nest items like we are used to + + - and then get back to initial list +-} +k :: t +k = undefined diff --git a/html-test/src/PromotedTypes.hs b/html-test/src/PromotedTypes.hs new file mode 100644 index 00000000..ae3ad375 --- /dev/null +++ b/html-test/src/PromotedTypes.hs @@ -0,0 +1,25 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE GADTs #-} +{-# LANGUAGE KindSignatures #-} +{-# LANGUAGE TypeOperators #-} + + +module PromotedTypes where + + +data RevList a = RNil | RevList a :> a + + +data Pattern :: [*] -> * where + Nil :: Pattern '[] + Cons :: Maybe h -> Pattern t -> Pattern (h ': t) + + +-- Unlike (:), (:>) does not have to be quoted on type level. +data RevPattern :: RevList * -> * where + RevNil :: RevPattern RNil + RevCons :: Maybe h -> RevPattern t -> RevPattern (t :> h) + + +data Tuple :: (*, *) -> * where + Tuple :: a -> b -> Tuple '(a, b) diff --git a/html-test/src/Threaded.hs b/html-test/src/Threaded.hs new file mode 100644 index 00000000..7f3073ad --- /dev/null +++ b/html-test/src/Threaded.hs @@ -0,0 +1,10 @@ +{-# LANGUAGE TemplateHaskell #-} + +-- | Ensures haddock built with @-threaded@. +module Threaded where + +import Threaded_TH + +-- | @$(forkTH)@ fails at compile time if haddock isn't using the +-- threaded RTS. +f = $(forkTH) diff --git a/html-test/src/Threaded_TH.hs b/html-test/src/Threaded_TH.hs new file mode 100644 index 00000000..53e5a399 --- /dev/null +++ b/html-test/src/Threaded_TH.hs @@ -0,0 +1,13 @@ +-- | Imported by 'Threaded', since a TH splice can't be used in the +-- module where it is defined. +module Threaded_TH where + +import Control.Concurrent (forkOS) +import Language.Haskell.TH.Syntax (Exp (LitE), Lit (IntegerL), Q, runIO) + +-- | forkOS requires the threaded RTS, so this TH fails if haddock was +-- built without @-threaded@. +forkTH :: Q Exp +forkTH = do + _ <- runIO (forkOS (return ())) + return (LitE (IntegerL 0)) diff --git a/html-test/src/Ticket253_1.hs b/html-test/src/Ticket253_1.hs deleted file mode 100644 index 62ab4b17..00000000 --- a/html-test/src/Ticket253_1.hs +++ /dev/null @@ -1,6 +0,0 @@ -module Ticket253_1 where --- | See 'Ticket253_2.bar'. --- --- Also see 'Ticket253_2.Baz' -foo :: Int -foo = 0 diff --git a/html-test/src/Ticket253_2.hs b/html-test/src/Ticket253_2.hs deleted file mode 100644 index a19d4cee..00000000 --- a/html-test/src/Ticket253_2.hs +++ /dev/null @@ -1,6 +0,0 @@ -module Ticket253_2 where --- | Comment -bar :: Int -bar = 0 - -data Baz = Baz diff --git a/hypsrc-test/Utils.hs b/hypsrc-test/Utils.hs new file mode 100644 index 00000000..e15fabee --- /dev/null +++ b/hypsrc-test/Utils.hs @@ -0,0 +1,47 @@ +{-# LANGUAGE CPP #-} + + +module Utils + ( baseDir, rootDir + , srcDir, refDir, outDir, refDir', outDir' + , haddockPath + , stripLocalAnchors, stripLocalLinks, stripLocalReferences + ) where + + +import Data.List + +import System.FilePath + + +baseDir, rootDir :: FilePath +baseDir = takeDirectory __FILE__ +rootDir = baseDir </> ".." + +srcDir, refDir, outDir, refDir', outDir' :: FilePath +srcDir = baseDir </> "src" +refDir = baseDir </> "ref" +outDir = baseDir </> "out" +refDir' = refDir </> "src" +outDir' = outDir </> "src" + +haddockPath :: FilePath +haddockPath = rootDir </> "dist" </> "build" </> "haddock" </> "haddock" + + +replaceBetween :: Eq a => [a] -> a -> [a] -> [a] -> [a] +replaceBetween _ _ _ [] = [] +replaceBetween pref end val html@(x:xs') = case stripPrefix pref html of + Just strip -> pref ++ val ++ (replaceBetween' . dropWhile (/= end)) strip + Nothing -> x:(replaceBetween' xs') + where + replaceBetween' = replaceBetween pref end val + +stripLocalAnchors :: String -> String +stripLocalAnchors = replaceBetween "<a name=\"local-" '\"' "0" + +stripLocalLinks :: String -> String +stripLocalLinks = replaceBetween "<a href=\"#local-" '\"' "0" + +stripLocalReferences :: String -> String +stripLocalReferences = stripLocalLinks . stripLocalAnchors diff --git a/hypsrc-test/accept.hs b/hypsrc-test/accept.hs new file mode 100755 index 00000000..4606b2df --- /dev/null +++ b/hypsrc-test/accept.hs @@ -0,0 +1,27 @@ +#!/usr/bin/env runhaskell +{-# LANGUAGE CPP #-} + + +import System.Directory +import System.FilePath +import System.Environment + +import Utils + + +main :: IO () +main = do + args <- getArgs + files <- filter isHtmlFile <$> getDirectoryContents outDir' + let files' = if args == ["--all"] || args == ["-a"] + then files + else filter ((`elem` args) . takeBaseName) files + mapM_ copy files' + where + isHtmlFile = (== ".html") . takeExtension + + +copy :: FilePath -> IO () +copy file = do + content <- stripLocalReferences <$> readFile (outDir' </> file) + writeFile (refDir' </> file) content diff --git a/hypsrc-test/ref/src/Classes.html b/hypsrc-test/ref/src/Classes.html new file mode 100644 index 00000000..74a7a427 --- /dev/null +++ b/hypsrc-test/ref/src/Classes.html @@ -0,0 +1,1065 @@ +<!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 + ><link rel="stylesheet" type="text/css" href="style.css" + /><script type="text/javascript" src="highlight.js" + ></script + ></head + ><body + ><pre + ><span class="hs-keyword" + >module</span + ><span + > </span + ><span class="hs-identifier" + >Classes</span + ><span + > </span + ><span class="hs-keyword" + >where</span + ><span + > +</span + ><a name="line-2" + ></a + ><span + > +</span + ><a name="line-3" + ></a + ><span + > +</span + ><a name="line-4" + ></a + ><span class="hs-keyword" + >class</span + ><span + > </span + ><a name="Foo" + ><a href="Classes.html#Foo" + ><span class="hs-identifier" + >Foo</span + ></a + ></a + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >a</span + ></a + ></a + ><span + > </span + ><span class="hs-keyword" + >where</span + ><span + > +</span + ><a name="line-5" + ></a + ><span + > </span + ><a name="bar" + ><a href="Classes.html#bar" + ><span class="hs-identifier" + >bar</span + ></a + ></a + ><span + > </span + ><span class="hs-glyph" + >::</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-type" + >a</span + ></a + ><span + > </span + ><span class="hs-glyph" + >-></span + ><span + > </span + ><span class="hs-identifier hs-type" + >Int</span + ><span + > +</span + ><a name="line-6" + ></a + ><span + > </span + ><a name="baz" + ><a href="Classes.html#baz" + ><span class="hs-identifier" + >baz</span + ></a + ></a + ><span + > </span + ><span class="hs-glyph" + >::</span + ><span + > </span + ><span class="hs-identifier hs-type" + >Int</span + ><span + > </span + ><span class="hs-glyph" + >-></span + ><span + > </span + ><span class="hs-special" + >(</span + ><a href="#local-0" + ><span class="hs-identifier hs-type" + >a</span + ></a + ><span class="hs-special" + >,</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-type" + >a</span + ></a + ><span class="hs-special" + >)</span + ><span + > +</span + ><a name="line-7" + ></a + ><span + > +</span + ><a name="line-8" + ></a + ><span class="hs-keyword" + >instance</span + ><span + > </span + ><a href="Classes.html#Foo" + ><span class="hs-identifier hs-type" + >Foo</span + ></a + ><span + > </span + ><span class="hs-identifier hs-type" + >Int</span + ><span + > </span + ><span class="hs-keyword" + >where</span + ><span + > +</span + ><a name="line-9" + ></a + ><span + > </span + ><a name="local-0" + ><a href="Classes.html#bar" + ><span class="hs-identifier" + >bar</span + ></a + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><span class="hs-identifier hs-var" + >id</span + ><span + > +</span + ><a name="line-10" + ></a + ><span + > </span + ><a name="local-0" + ><a href="Classes.html#baz" + ><span class="hs-identifier" + >baz</span + ></a + ></a + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >x</span + ></a + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><span class="hs-special" + >(</span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >x</span + ></a + ><span class="hs-special" + >,</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >x</span + ></a + ><span class="hs-special" + >)</span + ><span + > +</span + ><a name="line-11" + ></a + ><span + > +</span + ><a name="line-12" + ></a + ><span class="hs-keyword" + >instance</span + ><span + > </span + ><a href="Classes.html#Foo" + ><span class="hs-identifier hs-type" + >Foo</span + ></a + ><span + > </span + ><span class="hs-special" + >[</span + ><a href="#local-0" + ><span class="hs-identifier hs-type" + >a</span + ></a + ><span class="hs-special" + >]</span + ><span + > </span + ><span class="hs-keyword" + >where</span + ><span + > +</span + ><a name="line-13" + ></a + ><span + > </span + ><a name="local-0" + ><a href="Classes.html#bar" + ><span class="hs-identifier" + >bar</span + ></a + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><span class="hs-identifier hs-var" + >length</span + ><span + > +</span + ><a name="line-14" + ></a + ><span + > </span + ><a name="local-0" + ><a href="Classes.html#baz" + ><span class="hs-identifier" + >baz</span + ></a + ></a + ><span + > </span + ><span class="hs-identifier" + >_</span + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><span class="hs-special" + >(</span + ><span class="hs-special" + >[</span + ><span class="hs-special" + >]</span + ><span class="hs-special" + >,</span + ><span + > </span + ><span class="hs-special" + >[</span + ><span class="hs-special" + >]</span + ><span class="hs-special" + >)</span + ><span + > +</span + ><a name="line-15" + ></a + ><span + > +</span + ><a name="line-16" + ></a + ><span + > +</span + ><a name="line-17" + ></a + ><span class="hs-keyword" + >class</span + ><span + > </span + ><a href="Classes.html#Foo" + ><span class="hs-identifier hs-type" + >Foo</span + ></a + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-type" + >a</span + ></a + ><span + > </span + ><span class="hs-glyph" + >=></span + ><span + > </span + ><a name="Foo%27" + ><a href="Classes.html#Foo%27" + ><span class="hs-identifier" + >Foo'</span + ></a + ></a + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >a</span + ></a + ></a + ><span + > </span + ><span class="hs-keyword" + >where</span + ><span + > +</span + ><a name="line-18" + ></a + ><span + > </span + ><a name="quux" + ><a href="Classes.html#quux" + ><span class="hs-identifier" + >quux</span + ></a + ></a + ><span + > </span + ><span class="hs-glyph" + >::</span + ><span + > </span + ><span class="hs-special" + >(</span + ><a href="#local-0" + ><span class="hs-identifier hs-type" + >a</span + ></a + ><span class="hs-special" + >,</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-type" + >a</span + ></a + ><span class="hs-special" + >)</span + ><span + > </span + ><span class="hs-glyph" + >-></span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-type" + >a</span + ></a + ><span + > +</span + ><a name="line-19" + ></a + ><span + > </span + ><a name="local-0" + ><a href="Classes.html#quux" + ><span class="hs-identifier" + >quux</span + ></a + ></a + ><span + > </span + ><span class="hs-special" + >(</span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >x</span + ></a + ></a + ><span class="hs-special" + >,</span + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >y</span + ></a + ></a + ><span class="hs-special" + >)</span + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><a href="Classes.html#norf" + ><span class="hs-identifier hs-var" + >norf</span + ></a + ><span + > </span + ><span class="hs-special" + >[</span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >x</span + ></a + ><span class="hs-special" + >,</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >y</span + ></a + ><span class="hs-special" + >]</span + ><span + > +</span + ><a name="line-20" + ></a + ><span + > +</span + ><a name="line-21" + ></a + ><span + > </span + ><a name="norf" + ><a href="Classes.html#norf" + ><span class="hs-identifier" + >norf</span + ></a + ></a + ><span + > </span + ><span class="hs-glyph" + >::</span + ><span + > </span + ><span class="hs-special" + >[</span + ><a href="#local-0" + ><span class="hs-identifier hs-type" + >a</span + ></a + ><span class="hs-special" + >]</span + ><span + > </span + ><span class="hs-glyph" + >-></span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-type" + >a</span + ></a + ><span + > +</span + ><a name="line-22" + ></a + ><span + > </span + ><a name="local-0" + ><a href="Classes.html#norf" + ><span class="hs-identifier" + >norf</span + ></a + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><a href="Classes.html#quux" + ><span class="hs-identifier hs-var" + >quux</span + ></a + ><span + > </span + ><span class="hs-operator hs-var" + >.</span + ><span + > </span + ><a href="Classes.html#baz" + ><span class="hs-identifier hs-var" + >baz</span + ></a + ><span + > </span + ><span class="hs-operator hs-var" + >.</span + ><span + > </span + ><span class="hs-identifier hs-var" + >sum</span + ><span + > </span + ><span class="hs-operator hs-var" + >.</span + ><span + > </span + ><span class="hs-identifier hs-var" + >map</span + ><span + > </span + ><a href="Classes.html#bar" + ><span class="hs-identifier hs-var" + >bar</span + ></a + ><span + > +</span + ><a name="line-23" + ></a + ><span + > +</span + ><a name="line-24" + ></a + ><span class="hs-keyword" + >instance</span + ><span + > </span + ><a href="Classes.html#Foo%27" + ><span class="hs-identifier hs-type" + >Foo'</span + ></a + ><span + > </span + ><span class="hs-identifier hs-type" + >Int</span + ><span + > </span + ><span class="hs-keyword" + >where</span + ><span + > +</span + ><a name="line-25" + ></a + ><span + > </span + ><a name="local-0" + ><a href="Classes.html#norf" + ><span class="hs-identifier" + >norf</span + ></a + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><span class="hs-identifier hs-var" + >sum</span + ><span + > +</span + ><a name="line-26" + ></a + ><span + > +</span + ><a name="line-27" + ></a + ><span class="hs-keyword" + >instance</span + ><span + > </span + ><a href="Classes.html#Foo%27" + ><span class="hs-identifier hs-type" + >Foo'</span + ></a + ><span + > </span + ><span class="hs-special" + >[</span + ><a href="#local-0" + ><span class="hs-identifier hs-type" + >a</span + ></a + ><span class="hs-special" + >]</span + ><span + > </span + ><span class="hs-keyword" + >where</span + ><span + > +</span + ><a name="line-28" + ></a + ><span + > </span + ><a name="local-0" + ><a href="Classes.html#quux" + ><span class="hs-identifier" + >quux</span + ></a + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><span class="hs-identifier hs-var" + >uncurry</span + ><span + > </span + ><span class="hs-special" + >(</span + ><span class="hs-operator hs-var" + >++</span + ><span class="hs-special" + >)</span + ><span + > +</span + ><a name="line-29" + ></a + ><span + > +</span + ><a name="line-30" + ></a + ><span + > +</span + ><a name="line-31" + ></a + ><span class="hs-keyword" + >class</span + ><span + > </span + ><a name="Plugh" + ><a href="Classes.html#Plugh" + ><span class="hs-identifier" + >Plugh</span + ></a + ></a + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >p</span + ></a + ></a + ><span + > </span + ><span class="hs-keyword" + >where</span + ><span + > +</span + ><a name="line-32" + ></a + ><span + > </span + ><a name="plugh" + ><a href="Classes.html#plugh" + ><span class="hs-identifier" + >plugh</span + ></a + ></a + ><span + > </span + ><span class="hs-glyph" + >::</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-type" + >p</span + ></a + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-type" + >a</span + ></a + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-type" + >a</span + ></a + ><span + > </span + ><span class="hs-glyph" + >-></span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-type" + >p</span + ></a + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-type" + >b</span + ></a + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-type" + >b</span + ></a + ><span + > </span + ><span class="hs-glyph" + >-></span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-type" + >p</span + ></a + ><span + > </span + ><span class="hs-special" + >(</span + ><a href="#local-0" + ><span class="hs-identifier hs-type" + >a</span + ></a + ><span + > </span + ><span class="hs-glyph" + >-></span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-type" + >b</span + ></a + ><span class="hs-special" + >)</span + ><span + > </span + ><span class="hs-special" + >(</span + ><a href="#local-0" + ><span class="hs-identifier hs-type" + >b</span + ></a + ><span + > </span + ><span class="hs-glyph" + >-></span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-type" + >a</span + ></a + ><span class="hs-special" + >)</span + ><span + > +</span + ><a name="line-33" + ></a + ><span + > +</span + ><a name="line-34" + ></a + ><span class="hs-keyword" + >instance</span + ><span + > </span + ><a href="Classes.html#Plugh" + ><span class="hs-identifier hs-type" + >Plugh</span + ></a + ><span + > </span + ><span class="hs-identifier hs-type" + >Either</span + ><span + > </span + ><span class="hs-keyword" + >where</span + ><span + > +</span + ><a name="line-35" + ></a + ><span + > </span + ><a name="local-0" + ><a href="Classes.html#plugh" + ><span class="hs-identifier" + >plugh</span + ></a + ></a + ><span + > </span + ><span class="hs-special" + >(</span + ><span class="hs-identifier hs-var" + >Left</span + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >a</span + ></a + ></a + ><span class="hs-special" + >)</span + ><span + > </span + ><span class="hs-identifier" + >_</span + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><span class="hs-identifier hs-var" + >Right</span + ><span + > </span + ><span class="hs-operator hs-var" + >$</span + ><span + > </span + ><span class="hs-identifier hs-var" + >const</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >a</span + ></a + ><span + > +</span + ><a name="line-36" + ></a + ><span + > </span + ><span class="hs-identifier" + >plugh</span + ><span + > </span + ><span class="hs-special" + >(</span + ><span class="hs-identifier hs-var" + >Right</span + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >a</span + ></a + ></a + ><span class="hs-special" + >)</span + ><span + > </span + ><span class="hs-identifier" + >_</span + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><span class="hs-identifier hs-var" + >Right</span + ><span + > </span + ><span class="hs-operator hs-var" + >$</span + ><span + > </span + ><span class="hs-identifier hs-var" + >const</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >a</span + ></a + ><span + > +</span + ><a name="line-37" + ></a + ><span + > </span + ><span class="hs-identifier" + >plugh</span + ><span + > </span + ><span class="hs-identifier" + >_</span + ><span + > </span + ><span class="hs-special" + >(</span + ><span class="hs-identifier hs-var" + >Left</span + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >b</span + ></a + ></a + ><span class="hs-special" + >)</span + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><span class="hs-identifier hs-var" + >Left</span + ><span + > </span + ><span class="hs-operator hs-var" + >$</span + ><span + > </span + ><span class="hs-identifier hs-var" + >const</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >b</span + ></a + ><span + > +</span + ><a name="line-38" + ></a + ><span + > </span + ><span class="hs-identifier" + >plugh</span + ><span + > </span + ><span class="hs-identifier" + >_</span + ><span + > </span + ><span class="hs-special" + >(</span + ><span class="hs-identifier hs-var" + >Right</span + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >b</span + ></a + ></a + ><span class="hs-special" + >)</span + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><span class="hs-identifier hs-var" + >Left</span + ><span + > </span + ><span class="hs-operator hs-var" + >$</span + ><span + > </span + ><span class="hs-identifier hs-var" + >const</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >b</span + ></a + ><span + > +</span + ><a name="line-39" + ></a + ></pre + ></body + ></html +> diff --git a/hypsrc-test/ref/src/Constructors.html b/hypsrc-test/ref/src/Constructors.html new file mode 100644 index 00000000..86a482f6 --- /dev/null +++ b/hypsrc-test/ref/src/Constructors.html @@ -0,0 +1,940 @@ +<!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 + ><link rel="stylesheet" type="text/css" href="style.css" + /><script type="text/javascript" src="highlight.js" + ></script + ></head + ><body + ><pre + ><span class="hs-keyword" + >module</span + ><span + > </span + ><span class="hs-identifier" + >Constructors</span + ><span + > </span + ><span class="hs-keyword" + >where</span + ><span + > +</span + ><a name="line-2" + ></a + ><span + > +</span + ><a name="line-3" + ></a + ><span + > +</span + ><a name="line-4" + ></a + ><span class="hs-keyword" + >data</span + ><span + > </span + ><a name="Foo" + ><a href="Constructors.html#Foo" + ><span class="hs-identifier" + >Foo</span + ></a + ></a + ><span + > +</span + ><a name="line-5" + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><a name="Bar" + ><a href="Constructors.html#Bar" + ><span class="hs-identifier" + >Bar</span + ></a + ></a + ><span + > +</span + ><a name="line-6" + ></a + ><span + > </span + ><span class="hs-glyph" + >|</span + ><span + > </span + ><a name="Baz" + ><a href="Constructors.html#Baz" + ><span class="hs-identifier" + >Baz</span + ></a + ></a + ><span + > +</span + ><a name="line-7" + ></a + ><span + > </span + ><span class="hs-glyph" + >|</span + ><span + > </span + ><a name="Quux" + ><a href="Constructors.html#Quux" + ><span class="hs-identifier" + >Quux</span + ></a + ></a + ><span + > </span + ><a href="Constructors.html#Foo" + ><span class="hs-identifier hs-type" + >Foo</span + ></a + ><span + > </span + ><span class="hs-identifier hs-type" + >Int</span + ><span + > +</span + ><a name="line-8" + ></a + ><span + > +</span + ><a name="line-9" + ></a + ><span class="hs-keyword" + >newtype</span + ><span + > </span + ><a name="Norf" + ><a href="Constructors.html#Norf" + ><span class="hs-identifier" + >Norf</span + ></a + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><a name="Norf" + ><a href="Constructors.html#Norf" + ><span class="hs-identifier" + >Norf</span + ></a + ></a + ><span + > </span + ><span class="hs-special" + >(</span + ><a href="Constructors.html#Foo" + ><span class="hs-identifier hs-type" + >Foo</span + ></a + ><span class="hs-special" + >,</span + ><span + > </span + ><span class="hs-special" + >[</span + ><a href="Constructors.html#Foo" + ><span class="hs-identifier hs-type" + >Foo</span + ></a + ><span class="hs-special" + >]</span + ><span class="hs-special" + >,</span + ><span + > </span + ><a href="Constructors.html#Foo" + ><span class="hs-identifier hs-type" + >Foo</span + ></a + ><span class="hs-special" + >)</span + ><span + > +</span + ><a name="line-10" + ></a + ><span + > +</span + ><a name="line-11" + ></a + ><span + > +</span + ><a name="line-12" + ></a + ><span class="hs-identifier" + >bar</span + ><span class="hs-special" + >,</span + ><span + > </span + ><span class="hs-identifier" + >baz</span + ><span class="hs-special" + >,</span + ><span + > </span + ><span class="hs-identifier" + >quux</span + ><span + > </span + ><span class="hs-glyph" + >::</span + ><span + > </span + ><a href="Constructors.html#Foo" + ><span class="hs-identifier hs-type" + >Foo</span + ></a + ><span + > +</span + ><a name="line-13" + ></a + ><a name="bar" + ><a href="Constructors.html#bar" + ><span class="hs-identifier" + >bar</span + ></a + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><a href="Constructors.html#Bar" + ><span class="hs-identifier hs-var" + >Bar</span + ></a + ><span + > +</span + ><a name="line-14" + ></a + ><a name="baz" + ><a href="Constructors.html#baz" + ><span class="hs-identifier" + >baz</span + ></a + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><a href="Constructors.html#Baz" + ><span class="hs-identifier hs-var" + >Baz</span + ></a + ><span + > +</span + ><a name="line-15" + ></a + ><a name="quux" + ><a href="Constructors.html#quux" + ><span class="hs-identifier" + >quux</span + ></a + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><a href="Constructors.html#Quux" + ><span class="hs-identifier hs-var" + >Quux</span + ></a + ><span + > </span + ><a href="Constructors.html#quux" + ><span class="hs-identifier hs-var" + >quux</span + ></a + ><span + > </span + ><span class="hs-number" + >0</span + ><span + > +</span + ><a name="line-16" + ></a + ><span + > +</span + ><a name="line-17" + ></a + ><span + > +</span + ><a name="line-18" + ></a + ><span class="hs-identifier" + >unfoo</span + ><span + > </span + ><span class="hs-glyph" + >::</span + ><span + > </span + ><a href="Constructors.html#Foo" + ><span class="hs-identifier hs-type" + >Foo</span + ></a + ><span + > </span + ><span class="hs-glyph" + >-></span + ><span + > </span + ><span class="hs-identifier hs-type" + >Int</span + ><span + > +</span + ><a name="line-19" + ></a + ><a name="unfoo" + ><a href="Constructors.html#unfoo" + ><span class="hs-identifier" + >unfoo</span + ></a + ></a + ><span + > </span + ><a href="Constructors.html#Bar" + ><span class="hs-identifier hs-var" + >Bar</span + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><span class="hs-number" + >0</span + ><span + > +</span + ><a name="line-20" + ></a + ><span class="hs-identifier" + >unfoo</span + ><span + > </span + ><a href="Constructors.html#Baz" + ><span class="hs-identifier hs-var" + >Baz</span + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><span class="hs-number" + >0</span + ><span + > +</span + ><a name="line-21" + ></a + ><span class="hs-identifier" + >unfoo</span + ><span + > </span + ><span class="hs-special" + >(</span + ><a href="Constructors.html#Quux" + ><span class="hs-identifier hs-var" + >Quux</span + ></a + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >foo</span + ></a + ></a + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >n</span + ></a + ></a + ><span class="hs-special" + >)</span + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><span class="hs-number" + >42</span + ><span + > </span + ><span class="hs-operator hs-var" + >*</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >n</span + ></a + ><span + > </span + ><span class="hs-operator hs-var" + >+</span + ><span + > </span + ><a href="Constructors.html#unfoo" + ><span class="hs-identifier hs-var" + >unfoo</span + ></a + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >foo</span + ></a + ><span + > +</span + ><a name="line-22" + ></a + ><span + > +</span + ><a name="line-23" + ></a + ><span + > +</span + ><a name="line-24" + ></a + ><span class="hs-identifier" + >unnorf</span + ><span + > </span + ><span class="hs-glyph" + >::</span + ><span + > </span + ><a href="Constructors.html#Norf" + ><span class="hs-identifier hs-type" + >Norf</span + ></a + ><span + > </span + ><span class="hs-glyph" + >-></span + ><span + > </span + ><span class="hs-special" + >[</span + ><a href="Constructors.html#Foo" + ><span class="hs-identifier hs-type" + >Foo</span + ></a + ><span class="hs-special" + >]</span + ><span + > +</span + ><a name="line-25" + ></a + ><a name="unnorf" + ><a href="Constructors.html#unnorf" + ><span class="hs-identifier" + >unnorf</span + ></a + ></a + ><span + > </span + ><span class="hs-special" + >(</span + ><a href="Constructors.html#Norf" + ><span class="hs-identifier hs-var" + >Norf</span + ></a + ><span + > </span + ><span class="hs-special" + >(</span + ><a href="Constructors.html#Bar" + ><span class="hs-identifier hs-var" + >Bar</span + ></a + ><span class="hs-special" + >,</span + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >xs</span + ></a + ></a + ><span class="hs-special" + >,</span + ><span + > </span + ><a href="Constructors.html#Bar" + ><span class="hs-identifier hs-var" + >Bar</span + ></a + ><span class="hs-special" + >)</span + ><span class="hs-special" + >)</span + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >xs</span + ></a + ><span + > +</span + ><a name="line-26" + ></a + ><span class="hs-identifier" + >unnorf</span + ><span + > </span + ><span class="hs-special" + >(</span + ><a href="Constructors.html#Norf" + ><span class="hs-identifier hs-var" + >Norf</span + ></a + ><span + > </span + ><span class="hs-special" + >(</span + ><a href="Constructors.html#Baz" + ><span class="hs-identifier hs-var" + >Baz</span + ></a + ><span class="hs-special" + >,</span + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >xs</span + ></a + ></a + ><span class="hs-special" + >,</span + ><span + > </span + ><a href="Constructors.html#Baz" + ><span class="hs-identifier hs-var" + >Baz</span + ></a + ><span class="hs-special" + >)</span + ><span class="hs-special" + >)</span + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><span class="hs-identifier hs-var" + >reverse</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >xs</span + ></a + ><span + > +</span + ><a name="line-27" + ></a + ><span class="hs-identifier" + >unnorf</span + ><span + > </span + ><span class="hs-identifier" + >_</span + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><span class="hs-identifier hs-var" + >undefined</span + ><span + > +</span + ><a name="line-28" + ></a + ><span + > +</span + ><a name="line-29" + ></a + ><span + > +</span + ><a name="line-30" + ></a + ><span class="hs-identifier" + >unnorf'</span + ><span + > </span + ><span class="hs-glyph" + >::</span + ><span + > </span + ><a href="Constructors.html#Norf" + ><span class="hs-identifier hs-type" + >Norf</span + ></a + ><span + > </span + ><span class="hs-glyph" + >-></span + ><span + > </span + ><span class="hs-identifier hs-type" + >Int</span + ><span + > +</span + ><a name="line-31" + ></a + ><a name="unnorf%27" + ><a href="Constructors.html#unnorf%27" + ><span class="hs-identifier" + >unnorf'</span + ></a + ></a + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >x</span + ></a + ></a + ><span class="hs-glyph" + >@</span + ><span class="hs-special" + >(</span + ><a href="Constructors.html#Norf" + ><span class="hs-identifier hs-var" + >Norf</span + ></a + ><span + > </span + ><span class="hs-special" + >(</span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >f1</span + ></a + ></a + ><span class="hs-glyph" + >@</span + ><span class="hs-special" + >(</span + ><a href="Constructors.html#Quux" + ><span class="hs-identifier hs-var" + >Quux</span + ></a + ><span + > </span + ><span class="hs-identifier" + >_</span + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >n</span + ></a + ></a + ><span class="hs-special" + >)</span + ><span class="hs-special" + >,</span + ><span + > </span + ><span class="hs-identifier" + >_</span + ><span class="hs-special" + >,</span + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >f2</span + ></a + ></a + ><span class="hs-glyph" + >@</span + ><span class="hs-special" + >(</span + ><a href="Constructors.html#Quux" + ><span class="hs-identifier hs-var" + >Quux</span + ></a + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >f3</span + ></a + ></a + ><span + > </span + ><span class="hs-identifier" + >_</span + ><span class="hs-special" + >)</span + ><span class="hs-special" + >)</span + ><span class="hs-special" + >)</span + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > +</span + ><a name="line-32" + ></a + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >x'</span + ></a + ><span + > </span + ><span class="hs-operator hs-var" + >+</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >n</span + ></a + ><span + > </span + ><span class="hs-operator hs-var" + >*</span + ><span + > </span + ><a href="Constructors.html#unfoo" + ><span class="hs-identifier hs-var" + >unfoo</span + ></a + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >f1</span + ></a + ><span + > </span + ><span class="hs-operator hs-var" + >+</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >aux</span + ></a + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >f3</span + ></a + ><span + > +</span + ><a name="line-33" + ></a + ><span + > </span + ><span class="hs-keyword" + >where</span + ><span + > +</span + ><a name="line-34" + ></a + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >aux</span + ></a + ></a + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >fx</span + ></a + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><a href="Constructors.html#unfoo" + ><span class="hs-identifier hs-var" + >unfoo</span + ></a + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >f2</span + ></a + ><span + > </span + ><span class="hs-operator hs-var" + >*</span + ><span + > </span + ><a href="Constructors.html#unfoo" + ><span class="hs-identifier hs-var" + >unfoo</span + ></a + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >fx</span + ></a + ><span + > </span + ><span class="hs-operator hs-var" + >*</span + ><span + > </span + ><a href="Constructors.html#unfoo" + ><span class="hs-identifier hs-var" + >unfoo</span + ></a + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >f3</span + ></a + ><span + > +</span + ><a name="line-35" + ></a + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >x'</span + ></a + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><span class="hs-identifier hs-var" + >sum</span + ><span + > </span + ><span class="hs-operator hs-var" + >.</span + ><span + > </span + ><span class="hs-identifier hs-var" + >map</span + ><span + > </span + ><a href="Constructors.html#unfoo" + ><span class="hs-identifier hs-var" + >unfoo</span + ></a + ><span + > </span + ><span class="hs-operator hs-var" + >.</span + ><span + > </span + ><a href="Constructors.html#unnorf" + ><span class="hs-identifier hs-var" + >unnorf</span + ></a + ><span + > </span + ><span class="hs-operator hs-var" + >$</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >x</span + ></a + ><span + > +</span + ><a name="line-36" + ></a + ></pre + ></body + ></html +> diff --git a/hypsrc-test/ref/src/Identifiers.html b/hypsrc-test/ref/src/Identifiers.html new file mode 100644 index 00000000..7680b3ef --- /dev/null +++ b/hypsrc-test/ref/src/Identifiers.html @@ -0,0 +1,935 @@ +<!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 + ><link rel="stylesheet" type="text/css" href="style.css" + /><script type="text/javascript" src="highlight.js" + ></script + ></head + ><body + ><pre + ><span class="hs-keyword" + >module</span + ><span + > </span + ><span class="hs-identifier" + >Identifiers</span + ><span + > </span + ><span class="hs-keyword" + >where</span + ><span + > +</span + ><a name="line-2" + ></a + ><span + > +</span + ><a name="line-3" + ></a + ><span + > +</span + ><a name="line-4" + ></a + ><span class="hs-identifier" + >foo</span + ><span class="hs-special" + >,</span + ><span + > </span + ><span class="hs-identifier" + >bar</span + ><span class="hs-special" + >,</span + ><span + > </span + ><span class="hs-identifier" + >baz</span + ><span + > </span + ><span class="hs-glyph" + >::</span + ><span + > </span + ><span class="hs-identifier hs-type" + >Int</span + ><span + > </span + ><span class="hs-glyph" + >-></span + ><span + > </span + ><span class="hs-identifier hs-type" + >Int</span + ><span + > </span + ><span class="hs-glyph" + >-></span + ><span + > </span + ><span class="hs-identifier hs-type" + >Int</span + ><span + > +</span + ><a name="line-5" + ></a + ><a name="foo" + ><a href="Identifiers.html#foo" + ><span class="hs-identifier" + >foo</span + ></a + ></a + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >x</span + ></a + ></a + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >y</span + ></a + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >x</span + ></a + ><span + > </span + ><span class="hs-operator hs-var" + >+</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >x</span + ></a + ><span + > </span + ><span class="hs-operator hs-var" + >*</span + ><span + > </span + ><a href="Identifiers.html#bar" + ><span class="hs-identifier hs-var" + >bar</span + ></a + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >y</span + ></a + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >x</span + ></a + ><span + > </span + ><span class="hs-operator hs-var" + >*</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >y</span + ></a + ><span + > </span + ><span class="hs-operator hs-var" + >+</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >y</span + ></a + ><span + > +</span + ><a name="line-6" + ></a + ><a name="bar" + ><a href="Identifiers.html#bar" + ><span class="hs-identifier" + >bar</span + ></a + ></a + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >x</span + ></a + ></a + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >y</span + ></a + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >y</span + ></a + ><span + > </span + ><span class="hs-operator hs-var" + >+</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >x</span + ></a + ><span + > </span + ><span class="hs-glyph" + >-</span + ><span + > </span + ><a href="Identifiers.html#baz" + ><span class="hs-identifier hs-var" + >baz</span + ></a + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >x</span + ></a + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >y</span + ></a + ><span + > </span + ><span class="hs-glyph" + >-</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >x</span + ></a + ><span + > </span + ><span class="hs-operator hs-var" + >+</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >y</span + ></a + ><span + > +</span + ><a name="line-7" + ></a + ><a name="baz" + ><a href="Identifiers.html#baz" + ><span class="hs-identifier" + >baz</span + ></a + ></a + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >x</span + ></a + ></a + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >y</span + ></a + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >x</span + ></a + ><span + > </span + ><span class="hs-operator hs-var" + >*</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >y</span + ></a + ><span + > </span + ><span class="hs-operator hs-var" + >*</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >y</span + ></a + ><span + > </span + ><span class="hs-operator hs-var" + >*</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >y</span + ></a + ><span + > </span + ><span class="hs-operator hs-var" + >*</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >x</span + ></a + ><span + > +</span + ><a name="line-8" + ></a + ><span + > +</span + ><a name="line-9" + ></a + ><span class="hs-identifier" + >quux</span + ><span + > </span + ><span class="hs-glyph" + >::</span + ><span + > </span + ><span class="hs-identifier hs-type" + >Int</span + ><span + > </span + ><span class="hs-glyph" + >-></span + ><span + > </span + ><span class="hs-identifier hs-type" + >Int</span + ><span + > +</span + ><a name="line-10" + ></a + ><a name="quux" + ><a href="Identifiers.html#quux" + ><span class="hs-identifier" + >quux</span + ></a + ></a + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >x</span + ></a + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><a href="Identifiers.html#foo" + ><span class="hs-identifier hs-var" + >foo</span + ></a + ><span + > </span + ><span class="hs-special" + >(</span + ><a href="Identifiers.html#bar" + ><span class="hs-identifier hs-var" + >bar</span + ></a + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >x</span + ></a + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >x</span + ></a + ><span class="hs-special" + >)</span + ><span + > </span + ><span class="hs-special" + >(</span + ><a href="Identifiers.html#bar" + ><span class="hs-identifier hs-var" + >bar</span + ></a + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >x</span + ></a + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >x</span + ></a + ><span class="hs-special" + >)</span + ><span + > +</span + ><a name="line-11" + ></a + ><span + > +</span + ><a name="line-12" + ></a + ><span class="hs-identifier" + >norf</span + ><span + > </span + ><span class="hs-glyph" + >::</span + ><span + > </span + ><span class="hs-identifier hs-type" + >Int</span + ><span + > </span + ><span class="hs-glyph" + >-></span + ><span + > </span + ><span class="hs-identifier hs-type" + >Int</span + ><span + > </span + ><span class="hs-glyph" + >-></span + ><span + > </span + ><span class="hs-identifier hs-type" + >Int</span + ><span + > </span + ><span class="hs-glyph" + >-></span + ><span + > </span + ><span class="hs-identifier hs-type" + >Int</span + ><span + > +</span + ><a name="line-13" + ></a + ><a name="norf" + ><a href="Identifiers.html#norf" + ><span class="hs-identifier" + >norf</span + ></a + ></a + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >x</span + ></a + ></a + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >y</span + ></a + ></a + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >z</span + ></a + ></a + ><span + > +</span + ><a name="line-14" + ></a + ><span + > </span + ><span class="hs-glyph" + >|</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >x</span + ></a + ><span + > </span + ><span class="hs-operator hs-var" + ><</span + ><span + > </span + ><span class="hs-number" + >0</span + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><a href="Identifiers.html#quux" + ><span class="hs-identifier hs-var" + >quux</span + ></a + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >x</span + ></a + ><span + > +</span + ><a name="line-15" + ></a + ><span + > </span + ><span class="hs-glyph" + >|</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >y</span + ></a + ><span + > </span + ><span class="hs-operator hs-var" + ><</span + ><span + > </span + ><span class="hs-number" + >0</span + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><a href="Identifiers.html#quux" + ><span class="hs-identifier hs-var" + >quux</span + ></a + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >y</span + ></a + ><span + > +</span + ><a name="line-16" + ></a + ><span + > </span + ><span class="hs-glyph" + >|</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >z</span + ></a + ><span + > </span + ><span class="hs-operator hs-var" + ><</span + ><span + > </span + ><span class="hs-number" + >0</span + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><a href="Identifiers.html#quux" + ><span class="hs-identifier hs-var" + >quux</span + ></a + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >z</span + ></a + ><span + > +</span + ><a name="line-17" + ></a + ><span + > </span + ><span class="hs-glyph" + >|</span + ><span + > </span + ><span class="hs-identifier hs-var" + >otherwise</span + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><a href="Identifiers.html#norf" + ><span class="hs-identifier hs-var" + >norf</span + ></a + ><span + > </span + ><span class="hs-special" + >(</span + ><span class="hs-glyph" + >-</span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >x</span + ></a + ><span class="hs-special" + >)</span + ><span + > </span + ><span class="hs-special" + >(</span + ><span class="hs-glyph" + >-</span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >y</span + ></a + ><span class="hs-special" + >)</span + ><span + > </span + ><span class="hs-special" + >(</span + ><span class="hs-glyph" + >-</span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >z</span + ></a + ><span class="hs-special" + >)</span + ><span + > +</span + ><a name="line-18" + ></a + ><span + > +</span + ><a name="line-19" + ></a + ><span + > +</span + ><a name="line-20" + ></a + ><span class="hs-identifier" + >main</span + ><span + > </span + ><span class="hs-glyph" + >::</span + ><span + > </span + ><span class="hs-identifier hs-type" + >IO</span + ><span + > </span + ><span class="hs-special" + >(</span + ><span class="hs-special" + >)</span + ><span + > +</span + ><a name="line-21" + ></a + ><a name="main" + ><a href="Identifiers.html#main" + ><span class="hs-identifier" + >main</span + ></a + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><span class="hs-keyword" + >do</span + ><span + > +</span + ><a name="line-22" + ></a + ><span + > </span + ><span class="hs-identifier hs-var" + >putStrLn</span + ><span + > </span + ><span class="hs-operator hs-var" + >.</span + ><span + > </span + ><span class="hs-identifier hs-var" + >show</span + ><span + > </span + ><span class="hs-operator hs-var" + >$</span + ><span + > </span + ><a href="Identifiers.html#foo" + ><span class="hs-identifier hs-var" + >foo</span + ></a + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >x</span + ></a + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >y</span + ></a + ><span + > +</span + ><a name="line-23" + ></a + ><span + > </span + ><span class="hs-identifier hs-var" + >putStrLn</span + ><span + > </span + ><span class="hs-operator hs-var" + >.</span + ><span + > </span + ><span class="hs-identifier hs-var" + >show</span + ><span + > </span + ><span class="hs-operator hs-var" + >$</span + ><span + > </span + ><a href="Identifiers.html#quux" + ><span class="hs-identifier hs-var" + >quux</span + ></a + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >z</span + ></a + ><span + > +</span + ><a name="line-24" + ></a + ><span + > </span + ><span class="hs-identifier hs-var" + >putStrLn</span + ><span + > </span + ><span class="hs-operator hs-var" + >.</span + ><span + > </span + ><span class="hs-identifier hs-var" + >show</span + ><span + > </span + ><span class="hs-operator hs-var" + >$</span + ><span + > </span + ><a href="Identifiers.html#norf" + ><span class="hs-identifier hs-var" + >Identifiers</span + ><span class="hs-operator hs-var" + >.</span + ><span class="hs-identifier hs-var" + >norf</span + ></a + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >x</span + ></a + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >y</span + ></a + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >z</span + ></a + ><span + > +</span + ><a name="line-25" + ></a + ><span + > </span + ><span class="hs-keyword" + >where</span + ><span + > +</span + ><a name="line-26" + ></a + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >x</span + ></a + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><span class="hs-number" + >10</span + ><span + > +</span + ><a name="line-27" + ></a + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >y</span + ></a + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><span class="hs-number" + >20</span + ><span + > +</span + ><a name="line-28" + ></a + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >z</span + ></a + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><span class="hs-number" + >30</span + ><span + > +</span + ><a name="line-29" + ></a + ></pre + ></body + ></html +> diff --git a/hypsrc-test/ref/src/Literals.html b/hypsrc-test/ref/src/Literals.html new file mode 100644 index 00000000..a009a502 --- /dev/null +++ b/hypsrc-test/ref/src/Literals.html @@ -0,0 +1,428 @@ +<!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 + ><link rel="stylesheet" type="text/css" href="style.css" + /><script type="text/javascript" src="highlight.js" + ></script + ></head + ><body + ><pre + ><span class="hs-keyword" + >module</span + ><span + > </span + ><span class="hs-identifier" + >Literals</span + ><span + > </span + ><span class="hs-keyword" + >where</span + ><span + > +</span + ><a name="line-2" + ></a + ><span + > +</span + ><a name="line-3" + ></a + ><span + > +</span + ><a name="line-4" + ></a + ><span class="hs-identifier" + >str</span + ><span + > </span + ><span class="hs-glyph" + >::</span + ><span + > </span + ><span class="hs-identifier hs-type" + >String</span + ><span + > +</span + ><a name="line-5" + ></a + ><a name="str" + ><a href="Literals.html#str" + ><span class="hs-identifier" + >str</span + ></a + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><span class="hs-string" + >"str literal"</span + ><span + > +</span + ><a name="line-6" + ></a + ><span + > +</span + ><a name="line-7" + ></a + ><span class="hs-identifier" + >num</span + ><span + > </span + ><span class="hs-glyph" + >::</span + ><span + > </span + ><span class="hs-identifier hs-type" + >Num</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-type" + >a</span + ></a + ><span + > </span + ><span class="hs-glyph" + >=></span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-type" + >a</span + ></a + ><span + > +</span + ><a name="line-8" + ></a + ><a name="num" + ><a href="Literals.html#num" + ><span class="hs-identifier" + >num</span + ></a + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><span class="hs-number" + >0</span + ><span + > </span + ><span class="hs-operator hs-var" + >+</span + ><span + > </span + ><span class="hs-number" + >1</span + ><span + > </span + ><span class="hs-operator hs-var" + >+</span + ><span + > </span + ><span class="hs-number" + >1010011</span + ><span + > </span + ><span class="hs-operator hs-var" + >*</span + ><span + > </span + ><span class="hs-number" + >41231</span + ><span + > </span + ><span class="hs-operator hs-var" + >+</span + ><span + > </span + ><span class="hs-number" + >12131</span + ><span + > +</span + ><a name="line-9" + ></a + ><span + > +</span + ><a name="line-10" + ></a + ><span class="hs-identifier" + >frac</span + ><span + > </span + ><span class="hs-glyph" + >::</span + ><span + > </span + ><span class="hs-identifier hs-type" + >Fractional</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-type" + >a</span + ></a + ><span + > </span + ><span class="hs-glyph" + >=></span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-type" + >a</span + ></a + ><span + > +</span + ><a name="line-11" + ></a + ><a name="frac" + ><a href="Literals.html#frac" + ><span class="hs-identifier" + >frac</span + ></a + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><span class="hs-number" + >42.0000001</span + ><span + > +</span + ><a name="line-12" + ></a + ><span + > +</span + ><a name="line-13" + ></a + ><span class="hs-identifier" + >list</span + ><span + > </span + ><span class="hs-glyph" + >::</span + ><span + > </span + ><span class="hs-special" + >[</span + ><span class="hs-special" + >[</span + ><span class="hs-special" + >[</span + ><span class="hs-special" + >[</span + ><a href="#local-0" + ><span class="hs-identifier hs-type" + >a</span + ></a + ><span class="hs-special" + >]</span + ><span class="hs-special" + >]</span + ><span class="hs-special" + >]</span + ><span class="hs-special" + >]</span + ><span + > +</span + ><a name="line-14" + ></a + ><a name="list" + ><a href="Literals.html#list" + ><span class="hs-identifier" + >list</span + ></a + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><span class="hs-special" + >[</span + ><span class="hs-special" + >[</span + ><span class="hs-special" + >]</span + ><span class="hs-special" + >,</span + ><span + > </span + ><span class="hs-special" + >[</span + ><span class="hs-special" + >[</span + ><span class="hs-special" + >]</span + ><span class="hs-special" + >]</span + ><span class="hs-special" + >,</span + ><span + > </span + ><span class="hs-special" + >[</span + ><span class="hs-special" + >[</span + ><span class="hs-special" + >[</span + ><span class="hs-special" + >]</span + ><span class="hs-special" + >]</span + ><span class="hs-special" + >]</span + ><span class="hs-special" + >]</span + ><span + > +</span + ><a name="line-15" + ></a + ><span + > +</span + ><a name="line-16" + ></a + ><span class="hs-identifier" + >pair</span + ><span + > </span + ><span class="hs-glyph" + >::</span + ><span + > </span + ><span class="hs-special" + >(</span + ><span class="hs-special" + >(</span + ><span class="hs-special" + >)</span + ><span class="hs-special" + >,</span + ><span + > </span + ><span class="hs-special" + >(</span + ><span class="hs-special" + >(</span + ><span class="hs-special" + >)</span + ><span class="hs-special" + >,</span + ><span + > </span + ><span class="hs-special" + >(</span + ><span class="hs-special" + >)</span + ><span class="hs-special" + >,</span + ><span + > </span + ><span class="hs-special" + >(</span + ><span class="hs-special" + >)</span + ><span class="hs-special" + >)</span + ><span class="hs-special" + >,</span + ><span + > </span + ><span class="hs-special" + >(</span + ><span class="hs-special" + >)</span + ><span class="hs-special" + >)</span + ><span + > +</span + ><a name="line-17" + ></a + ><a name="pair" + ><a href="Literals.html#pair" + ><span class="hs-identifier" + >pair</span + ></a + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><span class="hs-special" + >(</span + ><span class="hs-special" + >(</span + ><span class="hs-special" + >)</span + ><span class="hs-special" + >,</span + ><span + > </span + ><span class="hs-special" + >(</span + ><span class="hs-special" + >(</span + ><span class="hs-special" + >)</span + ><span class="hs-special" + >,</span + ><span + > </span + ><span class="hs-special" + >(</span + ><span class="hs-special" + >)</span + ><span class="hs-special" + >,</span + ><span + > </span + ><span class="hs-special" + >(</span + ><span class="hs-special" + >)</span + ><span class="hs-special" + >)</span + ><span class="hs-special" + >,</span + ><span + > </span + ><span class="hs-special" + >(</span + ><span class="hs-special" + >)</span + ><span class="hs-special" + >)</span + ><span + > +</span + ><a name="line-18" + ></a + ></pre + ></body + ></html +> diff --git a/hypsrc-test/ref/src/Operators.html b/hypsrc-test/ref/src/Operators.html new file mode 100644 index 00000000..fe690db2 --- /dev/null +++ b/hypsrc-test/ref/src/Operators.html @@ -0,0 +1,837 @@ +<!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 + ><link rel="stylesheet" type="text/css" href="style.css" + /><script type="text/javascript" src="highlight.js" + ></script + ></head + ><body + ><pre + ><span class="hs-keyword" + >module</span + ><span + > </span + ><span class="hs-identifier" + >Operators</span + ><span + > </span + ><span class="hs-keyword" + >where</span + ><span + > +</span + ><a name="line-2" + ></a + ><span + > +</span + ><a name="line-3" + ></a + ><span + > +</span + ><a name="line-4" + ></a + ><span class="hs-special" + >(</span + ><span class="hs-operator" + >+++</span + ><span class="hs-special" + >)</span + ><span + > </span + ><span class="hs-glyph" + >::</span + ><span + > </span + ><span class="hs-special" + >[</span + ><a href="#local-0" + ><span class="hs-identifier hs-type" + >a</span + ></a + ><span class="hs-special" + >]</span + ><span + > </span + ><span class="hs-glyph" + >-></span + ><span + > </span + ><span class="hs-special" + >[</span + ><a href="#local-0" + ><span class="hs-identifier hs-type" + >a</span + ></a + ><span class="hs-special" + >]</span + ><span + > </span + ><span class="hs-glyph" + >-></span + ><span + > </span + ><span class="hs-special" + >[</span + ><a href="#local-0" + ><span class="hs-identifier hs-type" + >a</span + ></a + ><span class="hs-special" + >]</span + ><span + > +</span + ><a name="line-5" + ></a + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >a</span + ></a + ></a + ><span + > </span + ><a name="%2B%2B%2B" + ><a href="Operators.html#%2B%2B%2B" + ><span class="hs-operator" + >+++</span + ></a + ></a + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >b</span + ></a + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >a</span + ></a + ><span + > </span + ><span class="hs-operator hs-var" + >++</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >b</span + ></a + ><span + > </span + ><span class="hs-operator hs-var" + >++</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >a</span + ></a + ><span + > +</span + ><a name="line-6" + ></a + ><span + > +</span + ><a name="line-7" + ></a + ><span class="hs-special" + >(</span + ><span class="hs-operator" + >$$$</span + ><span class="hs-special" + >)</span + ><span + > </span + ><span class="hs-glyph" + >::</span + ><span + > </span + ><span class="hs-special" + >[</span + ><a href="#local-0" + ><span class="hs-identifier hs-type" + >a</span + ></a + ><span class="hs-special" + >]</span + ><span + > </span + ><span class="hs-glyph" + >-></span + ><span + > </span + ><span class="hs-special" + >[</span + ><a href="#local-0" + ><span class="hs-identifier hs-type" + >a</span + ></a + ><span class="hs-special" + >]</span + ><span + > </span + ><span class="hs-glyph" + >-></span + ><span + > </span + ><span class="hs-special" + >[</span + ><a href="#local-0" + ><span class="hs-identifier hs-type" + >a</span + ></a + ><span class="hs-special" + >]</span + ><span + > +</span + ><a name="line-8" + ></a + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >a</span + ></a + ></a + ><span + > </span + ><a name="%24%24%24" + ><a href="Operators.html#%24%24%24" + ><span class="hs-operator" + >$$$</span + ></a + ></a + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >b</span + ></a + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >b</span + ></a + ><span + > </span + ><a href="Operators.html#%2B%2B%2B" + ><span class="hs-operator hs-var" + >+++</span + ></a + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >a</span + ></a + ><span + > +</span + ><a name="line-9" + ></a + ><span + > +</span + ><a name="line-10" + ></a + ><span class="hs-special" + >(</span + ><span class="hs-operator" + >***</span + ><span class="hs-special" + >)</span + ><span + > </span + ><span class="hs-glyph" + >::</span + ><span + > </span + ><span class="hs-special" + >[</span + ><a href="#local-0" + ><span class="hs-identifier hs-type" + >a</span + ></a + ><span class="hs-special" + >]</span + ><span + > </span + ><span class="hs-glyph" + >-></span + ><span + > </span + ><span class="hs-special" + >[</span + ><a href="#local-0" + ><span class="hs-identifier hs-type" + >a</span + ></a + ><span class="hs-special" + >]</span + ><span + > </span + ><span class="hs-glyph" + >-></span + ><span + > </span + ><span class="hs-special" + >[</span + ><a href="#local-0" + ><span class="hs-identifier hs-type" + >a</span + ></a + ><span class="hs-special" + >]</span + ><span + > +</span + ><a name="line-11" + ></a + ><span class="hs-special" + >(</span + ><a name="%2A%2A%2A" + ><a href="Operators.html#%2A%2A%2A" + ><span class="hs-operator" + >***</span + ></a + ></a + ><span class="hs-special" + >)</span + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >a</span + ></a + ></a + ><span + > </span + ><span class="hs-special" + >[</span + ><span class="hs-special" + >]</span + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >a</span + ></a + ><span + > +</span + ><a name="line-12" + ></a + ><span class="hs-special" + >(</span + ><span class="hs-operator" + >***</span + ><span class="hs-special" + >)</span + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >a</span + ></a + ></a + ><span + > </span + ><span class="hs-special" + >(</span + ><span class="hs-identifier" + >_</span + ><span class="hs-glyph" + >:</span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >b</span + ></a + ></a + ><span class="hs-special" + >)</span + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >a</span + ></a + ><span + > </span + ><a href="Operators.html#%2B%2B%2B" + ><span class="hs-operator hs-var" + >+++</span + ></a + ><span + > </span + ><span class="hs-special" + >(</span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >a</span + ></a + ><span + > </span + ><a href="Operators.html#%2A%2A%2A" + ><span class="hs-operator hs-var" + >***</span + ></a + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >b</span + ></a + ><span class="hs-special" + >)</span + ><span + > +</span + ><a name="line-13" + ></a + ><span + > +</span + ><a name="line-14" + ></a + ><span class="hs-special" + >(</span + ><span class="hs-operator" + >*/\*</span + ><span class="hs-special" + >)</span + ><span + > </span + ><span class="hs-glyph" + >::</span + ><span + > </span + ><span class="hs-special" + >[</span + ><span class="hs-special" + >[</span + ><a href="#local-0" + ><span class="hs-identifier hs-type" + >a</span + ></a + ><span class="hs-special" + >]</span + ><span class="hs-special" + >]</span + ><span + > </span + ><span class="hs-glyph" + >-></span + ><span + > </span + ><span class="hs-special" + >[</span + ><a href="#local-0" + ><span class="hs-identifier hs-type" + >a</span + ></a + ><span class="hs-special" + >]</span + ><span + > </span + ><span class="hs-glyph" + >-></span + ><span + > </span + ><span class="hs-special" + >[</span + ><a href="#local-0" + ><span class="hs-identifier hs-type" + >a</span + ></a + ><span class="hs-special" + >]</span + ><span + > +</span + ><a name="line-15" + ></a + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >a</span + ></a + ></a + ><span + > </span + ><a name="%2A%2F%5C%2A" + ><a href="Operators.html#%2A%2F%5C%2A" + ><span class="hs-operator" + >*/\*</span + ></a + ></a + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >b</span + ></a + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><span class="hs-identifier hs-var" + >concatMap</span + ><span + > </span + ><span class="hs-special" + >(</span + ><a href="Operators.html#%2A%2A%2A" + ><span class="hs-operator hs-var" + >***</span + ></a + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >b</span + ></a + ><span class="hs-special" + >)</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >a</span + ></a + ><span + > +</span + ><a name="line-16" + ></a + ><span + > +</span + ><a name="line-17" + ></a + ><span class="hs-special" + >(</span + ><span class="hs-operator" + >**/\**</span + ><span class="hs-special" + >)</span + ><span + > </span + ><span class="hs-glyph" + >::</span + ><span + > </span + ><span class="hs-special" + >[</span + ><span class="hs-special" + >[</span + ><a href="#local-0" + ><span class="hs-identifier hs-type" + >a</span + ></a + ><span class="hs-special" + >]</span + ><span class="hs-special" + >]</span + ><span + > </span + ><span class="hs-glyph" + >-></span + ><span + > </span + ><span class="hs-special" + >[</span + ><span class="hs-special" + >[</span + ><a href="#local-0" + ><span class="hs-identifier hs-type" + >a</span + ></a + ><span class="hs-special" + >]</span + ><span class="hs-special" + >]</span + ><span + > </span + ><span class="hs-glyph" + >-></span + ><span + > </span + ><span class="hs-special" + >[</span + ><span class="hs-special" + >[</span + ><a href="#local-0" + ><span class="hs-identifier hs-type" + >a</span + ></a + ><span class="hs-special" + >]</span + ><span class="hs-special" + >]</span + ><span + > +</span + ><a name="line-18" + ></a + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >a</span + ></a + ></a + ><span + > </span + ><a name="%2A%2A%2F%5C%2A%2A" + ><a href="Operators.html#%2A%2A%2F%5C%2A%2A" + ><span class="hs-operator" + >**/\**</span + ></a + ></a + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >b</span + ></a + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><span class="hs-identifier hs-var" + >zipWith</span + ><span + > </span + ><span class="hs-special" + >(</span + ><a href="Operators.html#%2A%2F%5C%2A" + ><span class="hs-operator hs-var" + >*/\*</span + ></a + ><span class="hs-special" + >)</span + ><span + > </span + ><span class="hs-special" + >[</span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >a</span + ></a + ><span + > </span + ><a href="Operators.html#%2B%2B%2B" + ><span class="hs-operator hs-var" + >+++</span + ></a + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >b</span + ></a + ><span class="hs-special" + >]</span + ><span + > </span + ><span class="hs-special" + >(</span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >a</span + ></a + ><span + > </span + ><a href="Operators.html#%24%24%24" + ><span class="hs-operator hs-var" + >$$$</span + ></a + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >b</span + ></a + ><span class="hs-special" + >)</span + ><span + > +</span + ><a name="line-19" + ></a + ><span + > +</span + ><a name="line-20" + ></a + ><span + > +</span + ><a name="line-21" + ></a + ><span class="hs-special" + >(</span + ><span class="hs-operator" + >#.#</span + ><span class="hs-special" + >)</span + ><span + > </span + ><span class="hs-glyph" + >::</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-type" + >a</span + ></a + ><span + > </span + ><span class="hs-glyph" + >-></span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-type" + >b</span + ></a + ><span + > </span + ><span class="hs-glyph" + >-></span + ><span + > </span + ><span class="hs-special" + >(</span + ><a href="#local-0" + ><span class="hs-identifier hs-type" + >c</span + ></a + ><span + > </span + ><span class="hs-glyph" + >-></span + ><span + > </span + ><span class="hs-special" + >(</span + ><a href="#local-0" + ><span class="hs-identifier hs-type" + >a</span + ></a + ><span class="hs-special" + >,</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-type" + >b</span + ></a + ><span class="hs-special" + >)</span + ><span class="hs-special" + >)</span + ><span + > +</span + ><a name="line-22" + ></a + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >a</span + ></a + ></a + ><span + > </span + ><a name="%23.%23" + ><a href="Operators.html#%23.%23" + ><span class="hs-operator" + >#.#</span + ></a + ></a + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >b</span + ></a + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><span class="hs-identifier hs-var" + >const</span + ><span + > </span + ><span class="hs-operator hs-var" + >$</span + ><span + > </span + ><span class="hs-special" + >(</span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >a</span + ></a + ><span class="hs-special" + >,</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >b</span + ></a + ><span class="hs-special" + >)</span + ><span + > +</span + ><a name="line-23" + ></a + ></pre + ></body + ></html +> diff --git a/hypsrc-test/ref/src/Records.html b/hypsrc-test/ref/src/Records.html new file mode 100644 index 00000000..eb4e0fbb --- /dev/null +++ b/hypsrc-test/ref/src/Records.html @@ -0,0 +1,993 @@ +<!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 + ><link rel="stylesheet" type="text/css" href="style.css" + /><script type="text/javascript" src="highlight.js" + ></script + ></head + ><body + ><pre + ><span class="hs-pragma" + >{-# LANGUAGE NamedFieldPuns #-}</span + ><span + > +</span + ><a name="line-2" + ></a + ><span class="hs-pragma" + >{-# LANGUAGE RecordWildCards #-}</span + ><span + > +</span + ><a name="line-3" + ></a + ><span + > +</span + ><a name="line-4" + ></a + ><span + > +</span + ><a name="line-5" + ></a + ><span class="hs-keyword" + >module</span + ><span + > </span + ><span class="hs-identifier" + >Records</span + ><span + > </span + ><span class="hs-keyword" + >where</span + ><span + > +</span + ><a name="line-6" + ></a + ><span + > +</span + ><a name="line-7" + ></a + ><span + > +</span + ><a name="line-8" + ></a + ><span class="hs-keyword" + >data</span + ><span + > </span + ><a name="Point" + ><a href="Records.html#Point" + ><span class="hs-identifier" + >Point</span + ></a + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><a name="Point" + ><a href="Records.html#Point" + ><span class="hs-identifier" + >Point</span + ></a + ></a + ><span + > +</span + ><a name="line-9" + ></a + ><span + > </span + ><span class="hs-special" + >{</span + ><span + > </span + ><a name="x" + ><a href="Records.html#x" + ><span class="hs-identifier" + >x</span + ></a + ></a + ><span + > </span + ><span class="hs-glyph" + >::</span + ><span + > </span + ><span class="hs-glyph" + >!</span + ><span class="hs-identifier hs-type" + >Int</span + ><span + > +</span + ><a name="line-10" + ></a + ><span + > </span + ><span class="hs-special" + >,</span + ><span + > </span + ><a name="y" + ><a href="Records.html#y" + ><span class="hs-identifier" + >y</span + ></a + ></a + ><span + > </span + ><span class="hs-glyph" + >::</span + ><span + > </span + ><span class="hs-glyph" + >!</span + ><span class="hs-identifier hs-type" + >Int</span + ><span + > +</span + ><a name="line-11" + ></a + ><span + > </span + ><span class="hs-special" + >}</span + ><span + > +</span + ><a name="line-12" + ></a + ><span + > +</span + ><a name="line-13" + ></a + ><span + > +</span + ><a name="line-14" + ></a + ><span class="hs-identifier" + >point</span + ><span + > </span + ><span class="hs-glyph" + >::</span + ><span + > </span + ><span class="hs-identifier hs-type" + >Int</span + ><span + > </span + ><span class="hs-glyph" + >-></span + ><span + > </span + ><span class="hs-identifier hs-type" + >Int</span + ><span + > </span + ><span class="hs-glyph" + >-></span + ><span + > </span + ><a href="Records.html#Point" + ><span class="hs-identifier hs-type" + >Point</span + ></a + ><span + > +</span + ><a name="line-15" + ></a + ><a name="point" + ><a href="Records.html#point" + ><span class="hs-identifier" + >point</span + ></a + ></a + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >x</span + ></a + ></a + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >y</span + ></a + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><a href="Records.html#Point" + ><span class="hs-identifier hs-var" + >Point</span + ></a + ><span + > </span + ><span class="hs-special" + >{</span + ><span + > </span + ><a href="Records.html#x" + ><span class="hs-identifier hs-var" + >x</span + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >x</span + ></a + ><span class="hs-special" + >,</span + ><span + > </span + ><a href="Records.html#y" + ><span class="hs-identifier hs-var" + >y</span + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >y</span + ></a + ><span + > </span + ><span class="hs-special" + >}</span + ><span + > +</span + ><a name="line-16" + ></a + ><span + > +</span + ><a name="line-17" + ></a + ><span + > +</span + ><a name="line-18" + ></a + ><span class="hs-identifier" + >lengthSqr</span + ><span + > </span + ><span class="hs-glyph" + >::</span + ><span + > </span + ><a href="Records.html#Point" + ><span class="hs-identifier hs-type" + >Point</span + ></a + ><span + > </span + ><span class="hs-glyph" + >-></span + ><span + > </span + ><span class="hs-identifier hs-type" + >Int</span + ><span + > +</span + ><a name="line-19" + ></a + ><a name="lengthSqr" + ><a href="Records.html#lengthSqr" + ><span class="hs-identifier" + >lengthSqr</span + ></a + ></a + ><span + > </span + ><span class="hs-special" + >(</span + ><a href="Records.html#Point" + ><span class="hs-identifier hs-var" + >Point</span + ></a + ><span + > </span + ><span class="hs-special" + >{</span + ><span + > </span + ><a href="Records.html#x" + ><span class="hs-identifier hs-var" + >x</span + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >x</span + ></a + ></a + ><span class="hs-special" + >,</span + ><span + > </span + ><a href="Records.html#y" + ><span class="hs-identifier hs-var" + >y</span + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >y</span + ></a + ></a + ><span + > </span + ><span class="hs-special" + >}</span + ><span class="hs-special" + >)</span + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >x</span + ></a + ><span + > </span + ><span class="hs-operator hs-var" + >*</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >x</span + ></a + ><span + > </span + ><span class="hs-operator hs-var" + >+</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >y</span + ></a + ><span + > </span + ><span class="hs-operator hs-var" + >*</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >y</span + ></a + ><span + > +</span + ><a name="line-20" + ></a + ><span + > +</span + ><a name="line-21" + ></a + ><span class="hs-identifier" + >lengthSqr'</span + ><span + > </span + ><span class="hs-glyph" + >::</span + ><span + > </span + ><a href="Records.html#Point" + ><span class="hs-identifier hs-type" + >Point</span + ></a + ><span + > </span + ><span class="hs-glyph" + >-></span + ><span + > </span + ><span class="hs-identifier hs-type" + >Int</span + ><span + > +</span + ><a name="line-22" + ></a + ><a name="lengthSqr%27" + ><a href="Records.html#lengthSqr%27" + ><span class="hs-identifier" + >lengthSqr'</span + ></a + ></a + ><span + > </span + ><span class="hs-special" + >(</span + ><a href="Records.html#Point" + ><span class="hs-identifier hs-var" + >Point</span + ></a + ><span + > </span + ><span class="hs-special" + >{</span + ><span + > </span + ><a href="Records.html#x" + ><span class="hs-identifier hs-var" + >x</span + ></a + ><span class="hs-special" + >,</span + ><span + > </span + ><a href="Records.html#y" + ><span class="hs-identifier hs-var" + >y</span + ></a + ><span + > </span + ><span class="hs-special" + >}</span + ><span class="hs-special" + >)</span + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >y</span + ></a + ><span + > </span + ><span class="hs-operator hs-var" + >*</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >y</span + ></a + ><span + > </span + ><span class="hs-operator hs-var" + >+</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >x</span + ></a + ><span + > </span + ><span class="hs-operator hs-var" + >*</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >x</span + ></a + ><span + > +</span + ><a name="line-23" + ></a + ><span + > +</span + ><a name="line-24" + ></a + ><span + > +</span + ><a name="line-25" + ></a + ><span class="hs-identifier" + >translateX</span + ><span class="hs-special" + >,</span + ><span + > </span + ><span class="hs-identifier" + >translateY</span + ><span + > </span + ><span class="hs-glyph" + >::</span + ><span + > </span + ><a href="Records.html#Point" + ><span class="hs-identifier hs-type" + >Point</span + ></a + ><span + > </span + ><span class="hs-glyph" + >-></span + ><span + > </span + ><span class="hs-identifier hs-type" + >Int</span + ><span + > </span + ><span class="hs-glyph" + >-></span + ><span + > </span + ><a href="Records.html#Point" + ><span class="hs-identifier hs-type" + >Point</span + ></a + ><span + > +</span + ><a name="line-26" + ></a + ><a name="translateX" + ><a href="Records.html#translateX" + ><span class="hs-identifier" + >translateX</span + ></a + ></a + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >p</span + ></a + ></a + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >d</span + ></a + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >p</span + ></a + ><span + > </span + ><span class="hs-special" + >{</span + ><span + > </span + ><a href="Records.html#x" + ><span class="hs-identifier hs-var" + >x</span + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><a href="Records.html#x" + ><span class="hs-identifier hs-var" + >x</span + ></a + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >p</span + ></a + ><span + > </span + ><span class="hs-operator hs-var" + >+</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >d</span + ></a + ><span + > </span + ><span class="hs-special" + >}</span + ><span + > +</span + ><a name="line-27" + ></a + ><a name="translateY" + ><a href="Records.html#translateY" + ><span class="hs-identifier" + >translateY</span + ></a + ></a + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >p</span + ></a + ></a + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >d</span + ></a + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >p</span + ></a + ><span + > </span + ><span class="hs-special" + >{</span + ><span + > </span + ><a href="Records.html#y" + ><span class="hs-identifier hs-var" + >y</span + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><a href="Records.html#y" + ><span class="hs-identifier hs-var" + >y</span + ></a + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >p</span + ></a + ><span + > </span + ><span class="hs-operator hs-var" + >+</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >d</span + ></a + ><span + > </span + ><span class="hs-special" + >}</span + ><span + > +</span + ><a name="line-28" + ></a + ><span + > +</span + ><a name="line-29" + ></a + ><span class="hs-identifier" + >translate</span + ><span + > </span + ><span class="hs-glyph" + >::</span + ><span + > </span + ><span class="hs-identifier hs-type" + >Int</span + ><span + > </span + ><span class="hs-glyph" + >-></span + ><span + > </span + ><span class="hs-identifier hs-type" + >Int</span + ><span + > </span + ><span class="hs-glyph" + >-></span + ><span + > </span + ><a href="Records.html#Point" + ><span class="hs-identifier hs-type" + >Point</span + ></a + ><span + > </span + ><span class="hs-glyph" + >-></span + ><span + > </span + ><a href="Records.html#Point" + ><span class="hs-identifier hs-type" + >Point</span + ></a + ><span + > +</span + ><a name="line-30" + ></a + ><a name="translate" + ><a href="Records.html#translate" + ><span class="hs-identifier" + >translate</span + ></a + ></a + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >x</span + ></a + ></a + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >y</span + ></a + ></a + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >p</span + ></a + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > +</span + ><a name="line-31" + ></a + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >aux</span + ></a + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >p</span + ></a + ><span + > +</span + ><a name="line-32" + ></a + ><span + > </span + ><span class="hs-keyword" + >where</span + ><span + > +</span + ><a name="line-33" + ></a + ><span + > </span + ><span class="hs-special" + >(</span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >dx</span + ></a + ></a + ><span class="hs-special" + >,</span + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >dy</span + ></a + ></a + ><span class="hs-special" + >)</span + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><span class="hs-special" + >(</span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >x</span + ></a + ><span class="hs-special" + >,</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >y</span + ></a + ><span class="hs-special" + >)</span + ><span + > +</span + ><a name="line-34" + ></a + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >aux</span + ></a + ></a + ><span + > </span + ><a href="Records.html#Point" + ><span class="hs-identifier hs-var" + >Point</span + ></a + ><span class="hs-special" + >{</span + ><span class="hs-glyph" + >..</span + ><span class="hs-special" + >}</span + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >p</span + ></a + ><span + > </span + ><span class="hs-special" + >{</span + ><span + > </span + ><a href="Records.html#x" + ><span class="hs-identifier hs-var" + >x</span + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >x</span + ></a + ><span + > </span + ><span class="hs-operator hs-var" + >+</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >dx</span + ></a + ><span class="hs-special" + >,</span + ><span + > </span + ><a href="Records.html#y" + ><span class="hs-identifier hs-var" + >y</span + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >y</span + ></a + ><span + > </span + ><span class="hs-operator hs-var" + >+</span + ><span + > </span + ><a href="#local-0" + ><span class="hs-identifier hs-var" + >dy</span + ></a + ><span + > </span + ><span class="hs-special" + >}</span + ><span + > +</span + ><a name="line-35" + ></a + ></pre + ></body + ></html +> diff --git a/hypsrc-test/ref/src/Types.html b/hypsrc-test/ref/src/Types.html new file mode 100644 index 00000000..d59f61f8 --- /dev/null +++ b/hypsrc-test/ref/src/Types.html @@ -0,0 +1,1057 @@ +<!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 + ><link rel="stylesheet" type="text/css" href="style.css" + /><script type="text/javascript" src="highlight.js" + ></script + ></head + ><body + ><pre + ><span class="hs-pragma" + >{-# LANGUAGE TypeFamilies #-}</span + ><span + > +</span + ><a name="line-2" + ></a + ><span + > +</span + ><a name="line-3" + ></a + ><span + > +</span + ><a name="line-4" + ></a + ><span class="hs-keyword" + >module</span + ><span + > </span + ><span class="hs-identifier" + >Types</span + ><span + > </span + ><span class="hs-keyword" + >where</span + ><span + > +</span + ><a name="line-5" + ></a + ><span + > +</span + ><a name="line-6" + ></a + ><span + > +</span + ><a name="line-7" + ></a + ><span class="hs-keyword" + >data</span + ><span + > </span + ><a name="Quux" + ><a href="Types.html#Quux" + ><span class="hs-identifier" + >Quux</span + ></a + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><a name="Bar" + ><a href="Types.html#Bar" + ><span class="hs-identifier" + >Bar</span + ></a + ></a + ><span + > </span + ><span class="hs-glyph" + >|</span + ><span + > </span + ><a name="Baz" + ><a href="Types.html#Baz" + ><span class="hs-identifier" + >Baz</span + ></a + ></a + ><span + > +</span + ><a name="line-8" + ></a + ><span + > +</span + ><a name="line-9" + ></a + ><span class="hs-keyword" + >newtype</span + ><span + > </span + ><a name="Foo" + ><a href="Types.html#Foo" + ><span class="hs-identifier" + >Foo</span + ></a + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><a name="Foo" + ><a href="Types.html#Foo" + ><span class="hs-identifier" + >Foo</span + ></a + ></a + ><span + > </span + ><span class="hs-special" + >(</span + ><span class="hs-special" + >)</span + ><span + > +</span + ><a name="line-10" + ></a + ><span + > +</span + ><a name="line-11" + ></a + ><span class="hs-keyword" + >type</span + ><span + > </span + ><a name="FooQuux" + ><a href="Types.html#FooQuux" + ><span class="hs-identifier" + >FooQuux</span + ></a + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><span class="hs-special" + >(</span + ><a href="Types.html#Foo" + ><span class="hs-identifier hs-type" + >Foo</span + ></a + ><span class="hs-special" + >,</span + ><span + > </span + ><a href="Types.html#Quux" + ><span class="hs-identifier hs-type" + >Quux</span + ></a + ><span class="hs-special" + >)</span + ><span + > +</span + ><a name="line-12" + ></a + ><span class="hs-keyword" + >type</span + ><span + > </span + ><a name="QuuxFoo" + ><a href="Types.html#QuuxFoo" + ><span class="hs-identifier" + >QuuxFoo</span + ></a + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><span class="hs-special" + >(</span + ><a href="Types.html#Quux" + ><span class="hs-identifier hs-type" + >Quux</span + ></a + ><span class="hs-special" + >,</span + ><span + > </span + ><a href="Types.html#Foo" + ><span class="hs-identifier hs-type" + >Foo</span + ></a + ><span class="hs-special" + >)</span + ><span + > +</span + ><a name="line-13" + ></a + ><span + > +</span + ><a name="line-14" + ></a + ><span + > +</span + ><a name="line-15" + ></a + ><span class="hs-keyword" + >data</span + ><span + > </span + ><span class="hs-keyword" + >family</span + ><span + > </span + ><a name="Norf" + ><a href="Types.html#Norf" + ><span class="hs-identifier" + >Norf</span + ></a + ></a + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >a</span + ></a + ></a + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >b</span + ></a + ></a + ><span + > +</span + ><a name="line-16" + ></a + ><span + > +</span + ><a name="line-17" + ></a + ><span class="hs-keyword" + >data</span + ><span + > </span + ><span class="hs-keyword" + >instance</span + ><span + > </span + ><a href="Types.html#Norf" + ><span class="hs-identifier hs-type" + >Norf</span + ></a + ><span + > </span + ><a href="Types.html#Foo" + ><span class="hs-identifier hs-type" + >Foo</span + ></a + ><span + > </span + ><a href="Types.html#Quux" + ><span class="hs-identifier hs-type" + >Quux</span + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><a name="NFQ" + ><a href="Types.html#NFQ" + ><span class="hs-identifier" + >NFQ</span + ></a + ></a + ><span + > </span + ><a href="Types.html#Foo" + ><span class="hs-identifier hs-type" + >Foo</span + ></a + ><span + > </span + ><a href="Types.html#Quux" + ><span class="hs-identifier hs-type" + >Quux</span + ></a + ><span + > +</span + ><a name="line-18" + ></a + ><span class="hs-keyword" + >data</span + ><span + > </span + ><span class="hs-keyword" + >instance</span + ><span + > </span + ><a href="Types.html#Norf" + ><span class="hs-identifier hs-type" + >Norf</span + ></a + ><span + > </span + ><a href="Types.html#Quux" + ><span class="hs-identifier hs-type" + >Quux</span + ></a + ><span + > </span + ><a href="Types.html#Foo" + ><span class="hs-identifier hs-type" + >Foo</span + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><a name="NQF" + ><a href="Types.html#NQF" + ><span class="hs-identifier" + >NQF</span + ></a + ></a + ><span + > </span + ><a href="Types.html#Quux" + ><span class="hs-identifier hs-type" + >Quux</span + ></a + ><span + > </span + ><a href="Types.html#Foo" + ><span class="hs-identifier hs-type" + >Foo</span + ></a + ><span + > +</span + ><a name="line-19" + ></a + ><span + > +</span + ><a name="line-20" + ></a + ><span + > +</span + ><a name="line-21" + ></a + ><span class="hs-keyword" + >type</span + ><span + > </span + ><span class="hs-keyword" + >family</span + ><span + > </span + ><a name="Norf%27" + ><a href="Types.html#Norf%27" + ><span class="hs-identifier" + >Norf'</span + ></a + ></a + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >a</span + ></a + ></a + ><span + > </span + ><a name="local-0" + ><a href="#local-0" + ><span class="hs-identifier" + >b</span + ></a + ></a + ><span + > +</span + ><a name="line-22" + ></a + ><span + > +</span + ><a name="line-23" + ></a + ><span class="hs-keyword" + >type</span + ><span + > </span + ><span class="hs-keyword" + >instance</span + ><span + > </span + ><a href="Types.html#Norf%27" + ><span class="hs-identifier hs-type" + >Norf'</span + ></a + ><span + > </span + ><a href="Types.html#Foo" + ><span class="hs-identifier hs-type" + >Foo</span + ></a + ><span + > </span + ><a href="Types.html#Quux" + ><span class="hs-identifier hs-type" + >Quux</span + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><span class="hs-special" + >(</span + ><a href="Types.html#Foo" + ><span class="hs-identifier hs-type" + >Foo</span + ></a + ><span class="hs-special" + >,</span + ><span + > </span + ><a href="Types.html#Quux" + ><span class="hs-identifier hs-type" + >Quux</span + ></a + ><span class="hs-special" + >)</span + ><span + > +</span + ><a name="line-24" + ></a + ><span class="hs-keyword" + >type</span + ><span + > </span + ><span class="hs-keyword" + >instance</span + ><span + > </span + ><a href="Types.html#Norf%27" + ><span class="hs-identifier hs-type" + >Norf'</span + ></a + ><span + > </span + ><a href="Types.html#Quux" + ><span class="hs-identifier hs-type" + >Quux</span + ></a + ><span + > </span + ><a href="Types.html#Foo" + ><span class="hs-identifier hs-type" + >Foo</span + ></a + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><span class="hs-special" + >(</span + ><a href="Types.html#Quux" + ><span class="hs-identifier hs-type" + >Quux</span + ></a + ><span class="hs-special" + >,</span + ><span + > </span + ><a href="Types.html#Foo" + ><span class="hs-identifier hs-type" + >Foo</span + ></a + ><span class="hs-special" + >)</span + ><span + > +</span + ><a name="line-25" + ></a + ><span + > +</span + ><a name="line-26" + ></a + ><span + > +</span + ><a name="line-27" + ></a + ><span class="hs-identifier" + >norf1</span + ><span + > </span + ><span class="hs-glyph" + >::</span + ><span + > </span + ><a href="Types.html#Norf" + ><span class="hs-identifier hs-type" + >Norf</span + ></a + ><span + > </span + ><a href="Types.html#Foo" + ><span class="hs-identifier hs-type" + >Foo</span + ></a + ><span + > </span + ><a href="Types.html#Quux" + ><span class="hs-identifier hs-type" + >Quux</span + ></a + ><span + > </span + ><span class="hs-glyph" + >-></span + ><span + > </span + ><span class="hs-identifier hs-type" + >Int</span + ><span + > +</span + ><a name="line-28" + ></a + ><a name="norf1" + ><a href="Types.html#norf1" + ><span class="hs-identifier" + >norf1</span + ></a + ></a + ><span + > </span + ><span class="hs-special" + >(</span + ><a href="Types.html#NFQ" + ><span class="hs-identifier hs-var" + >NFQ</span + ></a + ><span + > </span + ><span class="hs-special" + >(</span + ><a href="Types.html#Foo" + ><span class="hs-identifier hs-var" + >Foo</span + ></a + ><span + > </span + ><span class="hs-special" + >(</span + ><span class="hs-special" + >)</span + ><span class="hs-special" + >)</span + ><span + > </span + ><a href="Types.html#Bar" + ><span class="hs-identifier hs-var" + >Bar</span + ></a + ><span class="hs-special" + >)</span + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><span class="hs-number" + >0</span + ><span + > +</span + ><a name="line-29" + ></a + ><span class="hs-identifier" + >norf1</span + ><span + > </span + ><span class="hs-special" + >(</span + ><a href="Types.html#NFQ" + ><span class="hs-identifier hs-var" + >NFQ</span + ></a + ><span + > </span + ><span class="hs-special" + >(</span + ><a href="Types.html#Foo" + ><span class="hs-identifier hs-var" + >Foo</span + ></a + ><span + > </span + ><span class="hs-special" + >(</span + ><span class="hs-special" + >)</span + ><span class="hs-special" + >)</span + ><span + > </span + ><a href="Types.html#Baz" + ><span class="hs-identifier hs-var" + >Baz</span + ></a + ><span class="hs-special" + >)</span + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><span class="hs-number" + >1</span + ><span + > +</span + ><a name="line-30" + ></a + ><span + > +</span + ><a name="line-31" + ></a + ><span class="hs-identifier" + >norf2</span + ><span + > </span + ><span class="hs-glyph" + >::</span + ><span + > </span + ><a href="Types.html#Norf" + ><span class="hs-identifier hs-type" + >Norf</span + ></a + ><span + > </span + ><a href="Types.html#Quux" + ><span class="hs-identifier hs-type" + >Quux</span + ></a + ><span + > </span + ><a href="Types.html#Foo" + ><span class="hs-identifier hs-type" + >Foo</span + ></a + ><span + > </span + ><span class="hs-glyph" + >-></span + ><span + > </span + ><span class="hs-identifier hs-type" + >Int</span + ><span + > +</span + ><a name="line-32" + ></a + ><a name="norf2" + ><a href="Types.html#norf2" + ><span class="hs-identifier" + >norf2</span + ></a + ></a + ><span + > </span + ><span class="hs-special" + >(</span + ><a href="Types.html#NQF" + ><span class="hs-identifier hs-var" + >NQF</span + ></a + ><span + > </span + ><a href="Types.html#Bar" + ><span class="hs-identifier hs-var" + >Bar</span + ></a + ><span + > </span + ><span class="hs-special" + >(</span + ><a href="Types.html#Foo" + ><span class="hs-identifier hs-var" + >Foo</span + ></a + ><span + > </span + ><span class="hs-special" + >(</span + ><span class="hs-special" + >)</span + ><span class="hs-special" + >)</span + ><span class="hs-special" + >)</span + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><span class="hs-number" + >0</span + ><span + > +</span + ><a name="line-33" + ></a + ><span class="hs-identifier" + >norf2</span + ><span + > </span + ><span class="hs-special" + >(</span + ><a href="Types.html#NQF" + ><span class="hs-identifier hs-var" + >NQF</span + ></a + ><span + > </span + ><a href="Types.html#Baz" + ><span class="hs-identifier hs-var" + >Baz</span + ></a + ><span + > </span + ><span class="hs-special" + >(</span + ><a href="Types.html#Foo" + ><span class="hs-identifier hs-var" + >Foo</span + ></a + ><span + > </span + ><span class="hs-special" + >(</span + ><span class="hs-special" + >)</span + ><span class="hs-special" + >)</span + ><span class="hs-special" + >)</span + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><span class="hs-number" + >1</span + ><span + > +</span + ><a name="line-34" + ></a + ><span + > +</span + ><a name="line-35" + ></a + ><span + > +</span + ><a name="line-36" + ></a + ><span class="hs-identifier" + >norf1'</span + ><span + > </span + ><span class="hs-glyph" + >::</span + ><span + > </span + ><a href="Types.html#Norf%27" + ><span class="hs-identifier hs-type" + >Norf'</span + ></a + ><span + > </span + ><a href="Types.html#Foo" + ><span class="hs-identifier hs-type" + >Foo</span + ></a + ><span + > </span + ><a href="Types.html#Quux" + ><span class="hs-identifier hs-type" + >Quux</span + ></a + ><span + > </span + ><span class="hs-glyph" + >-></span + ><span + > </span + ><span class="hs-identifier hs-type" + >Int</span + ><span + > +</span + ><a name="line-37" + ></a + ><a name="norf1%27" + ><a href="Types.html#norf1%27" + ><span class="hs-identifier" + >norf1'</span + ></a + ></a + ><span + > </span + ><span class="hs-special" + >(</span + ><a href="Types.html#Foo" + ><span class="hs-identifier hs-var" + >Foo</span + ></a + ><span + > </span + ><span class="hs-special" + >(</span + ><span class="hs-special" + >)</span + ><span class="hs-special" + >,</span + ><span + > </span + ><a href="Types.html#Bar" + ><span class="hs-identifier hs-var" + >Bar</span + ></a + ><span class="hs-special" + >)</span + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><span class="hs-number" + >0</span + ><span + > +</span + ><a name="line-38" + ></a + ><span class="hs-identifier" + >norf1'</span + ><span + > </span + ><span class="hs-special" + >(</span + ><a href="Types.html#Foo" + ><span class="hs-identifier hs-var" + >Foo</span + ></a + ><span + > </span + ><span class="hs-special" + >(</span + ><span class="hs-special" + >)</span + ><span class="hs-special" + >,</span + ><span + > </span + ><a href="Types.html#Baz" + ><span class="hs-identifier hs-var" + >Baz</span + ></a + ><span class="hs-special" + >)</span + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><span class="hs-number" + >1</span + ><span + > +</span + ><a name="line-39" + ></a + ><span + > +</span + ><a name="line-40" + ></a + ><span class="hs-identifier" + >norf2'</span + ><span + > </span + ><span class="hs-glyph" + >::</span + ><span + > </span + ><a href="Types.html#Norf%27" + ><span class="hs-identifier hs-type" + >Norf'</span + ></a + ><span + > </span + ><a href="Types.html#Quux" + ><span class="hs-identifier hs-type" + >Quux</span + ></a + ><span + > </span + ><a href="Types.html#Foo" + ><span class="hs-identifier hs-type" + >Foo</span + ></a + ><span + > </span + ><span class="hs-glyph" + >-></span + ><span + > </span + ><span class="hs-identifier hs-type" + >Int</span + ><span + > +</span + ><a name="line-41" + ></a + ><a name="norf2%27" + ><a href="Types.html#norf2%27" + ><span class="hs-identifier" + >norf2'</span + ></a + ></a + ><span + > </span + ><span class="hs-special" + >(</span + ><a href="Types.html#Bar" + ><span class="hs-identifier hs-var" + >Bar</span + ></a + ><span class="hs-special" + >,</span + ><span + > </span + ><a href="Types.html#Foo" + ><span class="hs-identifier hs-var" + >Foo</span + ></a + ><span + > </span + ><span class="hs-special" + >(</span + ><span class="hs-special" + >)</span + ><span class="hs-special" + >)</span + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><span class="hs-number" + >0</span + ><span + > +</span + ><a name="line-42" + ></a + ><span class="hs-identifier" + >norf2'</span + ><span + > </span + ><span class="hs-special" + >(</span + ><a href="Types.html#Baz" + ><span class="hs-identifier hs-var" + >Baz</span + ></a + ><span class="hs-special" + >,</span + ><span + > </span + ><a href="Types.html#Foo" + ><span class="hs-identifier hs-var" + >Foo</span + ></a + ><span + > </span + ><span class="hs-special" + >(</span + ><span class="hs-special" + >)</span + ><span class="hs-special" + >)</span + ><span + > </span + ><span class="hs-glyph" + >=</span + ><span + > </span + ><span class="hs-number" + >1</span + ><span + > +</span + ><a name="line-43" + ></a + ></pre + ></body + ></html +> diff --git a/hypsrc-test/run.hs b/hypsrc-test/run.hs new file mode 100755 index 00000000..853c4f09 --- /dev/null +++ b/hypsrc-test/run.hs @@ -0,0 +1,122 @@ +#!/usr/bin/env runhaskell +{-# LANGUAGE CPP #-} + + +import Control.Monad + +import Data.List +import Data.Maybe + +import System.Directory +import System.Environment +import System.Exit +import System.FilePath +import System.Process + +import Distribution.Verbosity +import Distribution.Simple.Utils hiding (die) + +import Utils + + +main :: IO () +main = do + haddockAvailable <- doesFileExist haddockPath + unless haddockAvailable $ die "Haddock exectuable not available" + + (args, mods) <- partition ("-" `isPrefixOf`) <$> getArgs + let args' = filter (\arg -> not $ arg == "--all" || arg == "-a") args + mods' <- map (srcDir </>) <$> case args of + [] -> getAllSrcModules + _ -> return $ map (++ ".hs") mods + + putHaddockVersion + putGhcVersion + + putStrLn "Running tests..." + runHaddock $ + [ "--odir=" ++ outDir + , "--no-warnings" + , "--hyperlinked-source" + , "--pretty-html" + ] ++ args' ++ mods' + + forM_ mods' $ check True + + +check :: Bool -> FilePath -> IO () +check strict mdl = do + hasReference <- doesFileExist refFile + if hasReference + then do + ref <- readFile refFile + out <- readFile outFile + compareOutput strict mdl ref out + else do + putStrLn $ "Pass: " ++ mdl ++ " (no reference file)" + where + refFile = refDir' </> takeBaseName mdl ++ ".html" + outFile = outDir' </> takeBaseName mdl ++ ".html" + + +compareOutput :: Bool -> FilePath -> String -> String -> IO () +compareOutput strict mdl ref out = do + if ref' == out' + then putStrLn $ "Pass: " ++ mdl + else do + putStrLn $ "Fail: " ++ mdl + diff mdl ref' out' + when strict $ die "Aborting further tests." + where + ref' = stripLocalReferences ref + out' = stripLocalReferences out + + +diff :: FilePath -> String -> String -> IO () +diff mdl ref out = do + colorDiffPath <- findProgramLocation silent "colordiff" + let cmd = fromMaybe "diff" colorDiffPath + + writeFile refFile ref + writeFile outFile out + + result <- system $ cmd ++ " " ++ refFile ++ " " ++ outFile + unless (result == ExitSuccess) $ die "Failed to run `diff` command." + where + refFile = outDir </> takeBaseName mdl ++ ".ref.nolinks" + outFile = outDir </> takeBaseName mdl ++ ".nolinks" + + + +getAllSrcModules :: IO [FilePath] +getAllSrcModules = + filter isHaskellFile <$> getDirectoryContents srcDir + where + isHaskellFile = (== ".hs") . takeExtension + + +putHaddockVersion :: IO () +putHaddockVersion = do + putStrLn "Haddock version:" + runHaddock ["--version"] + putStrLn "" + + +putGhcVersion :: IO () +putGhcVersion = do + putStrLn "GHC version:" + runHaddock ["--ghc-version"] + putStrLn "" + + +runHaddock :: [String] -> IO () +runHaddock args = do + menv <- Just <$> getEnvironment + handle <- runProcess haddockPath args Nothing menv Nothing Nothing Nothing + waitForSuccess handle $ "Failed to invoke haddock with " ++ show args + + +waitForSuccess :: ProcessHandle -> String -> IO () +waitForSuccess handle msg = do + result <- waitForProcess handle + unless (result == ExitSuccess) $ die msg diff --git a/hypsrc-test/src/Classes.hs b/hypsrc-test/src/Classes.hs new file mode 100644 index 00000000..b3c3f785 --- /dev/null +++ b/hypsrc-test/src/Classes.hs @@ -0,0 +1,38 @@ +module Classes where + + +class Foo a where + bar :: a -> Int + baz :: Int -> (a, a) + +instance Foo Int where + bar = id + baz x = (x, x) + +instance Foo [a] where + bar = length + baz _ = ([], []) + + +class Foo a => Foo' a where + quux :: (a, a) -> a + quux (x, y) = norf [x, y] + + norf :: [a] -> a + norf = quux . baz . sum . map bar + +instance Foo' Int where + norf = sum + +instance Foo' [a] where + quux = uncurry (++) + + +class Plugh p where + plugh :: p a a -> p b b -> p (a -> b) (b -> a) + +instance Plugh Either where + plugh (Left a) _ = Right $ const a + plugh (Right a) _ = Right $ const a + plugh _ (Left b) = Left $ const b + plugh _ (Right b) = Left $ const b diff --git a/hypsrc-test/src/Constructors.hs b/hypsrc-test/src/Constructors.hs new file mode 100644 index 00000000..8cb46535 --- /dev/null +++ b/hypsrc-test/src/Constructors.hs @@ -0,0 +1,35 @@ +module Constructors where + + +data Foo + = Bar + | Baz + | Quux Foo Int + +newtype Norf = Norf (Foo, [Foo], Foo) + + +bar, baz, quux :: Foo +bar = Bar +baz = Baz +quux = Quux quux 0 + + +unfoo :: Foo -> Int +unfoo Bar = 0 +unfoo Baz = 0 +unfoo (Quux foo n) = 42 * n + unfoo foo + + +unnorf :: Norf -> [Foo] +unnorf (Norf (Bar, xs, Bar)) = xs +unnorf (Norf (Baz, xs, Baz)) = reverse xs +unnorf _ = undefined + + +unnorf' :: Norf -> Int +unnorf' x@(Norf (f1@(Quux _ n), _, f2@(Quux f3 _))) = + x' + n * unfoo f1 + aux f3 + where + aux fx = unfoo f2 * unfoo fx * unfoo f3 + x' = sum . map unfoo . unnorf $ x diff --git a/hypsrc-test/src/Identifiers.hs b/hypsrc-test/src/Identifiers.hs new file mode 100644 index 00000000..173c3ba7 --- /dev/null +++ b/hypsrc-test/src/Identifiers.hs @@ -0,0 +1,28 @@ +module Identifiers where + + +foo, bar, baz :: Int -> Int -> Int +foo x y = x + x * bar y x * y + y +bar x y = y + x - baz x y - x + y +baz x y = x * y * y * y * x + +quux :: Int -> Int +quux x = foo (bar x x) (bar x x) + +norf :: Int -> Int -> Int -> Int +norf x y z + | x < 0 = quux x + | y < 0 = quux y + | z < 0 = quux z + | otherwise = norf (-x) (-y) (-z) + + +main :: IO () +main = do + putStrLn . show $ foo x y + putStrLn . show $ quux z + putStrLn . show $ Identifiers.norf x y z + where + x = 10 + y = 20 + z = 30 diff --git a/hypsrc-test/src/Literals.hs b/hypsrc-test/src/Literals.hs new file mode 100644 index 00000000..997b6615 --- /dev/null +++ b/hypsrc-test/src/Literals.hs @@ -0,0 +1,17 @@ +module Literals where + + +str :: String +str = "str literal" + +num :: Num a => a +num = 0 + 1 + 1010011 * 41231 + 12131 + +frac :: Fractional a => a +frac = 42.0000001 + +list :: [[[[a]]]] +list = [[], [[]], [[[]]]] + +pair :: ((), ((), (), ()), ()) +pair = ((), ((), (), ()), ()) diff --git a/hypsrc-test/src/Operators.hs b/hypsrc-test/src/Operators.hs new file mode 100644 index 00000000..8e86ab0b --- /dev/null +++ b/hypsrc-test/src/Operators.hs @@ -0,0 +1,22 @@ +module Operators where + + +(+++) :: [a] -> [a] -> [a] +a +++ b = a ++ b ++ a + +($$$) :: [a] -> [a] -> [a] +a $$$ b = b +++ a + +(***) :: [a] -> [a] -> [a] +(***) a [] = a +(***) a (_:b) = a +++ (a *** b) + +(*/\*) :: [[a]] -> [a] -> [a] +a */\* b = concatMap (*** b) a + +(**/\**) :: [[a]] -> [[a]] -> [[a]] +a **/\** b = zipWith (*/\*) [a +++ b] (a $$$ b) + + +(#.#) :: a -> b -> (c -> (a, b)) +a #.# b = const $ (a, b) diff --git a/hypsrc-test/src/Polymorphism.hs b/hypsrc-test/src/Polymorphism.hs new file mode 100644 index 00000000..a74ac492 --- /dev/null +++ b/hypsrc-test/src/Polymorphism.hs @@ -0,0 +1,66 @@ +{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE ScopedTypeVariables #-} + + +module Polymorphism where + + +foo :: a -> a -> a +foo = undefined + +foo' :: forall a. a -> a -> a +foo' = undefined + +bar :: a -> b -> (a, b) +bar = undefined + +bar' :: forall a b. a -> b -> (a, b) +bar' = undefined + +baz :: a -> (a -> [a -> a] -> b) -> b +baz = undefined + +baz' :: forall a b. a -> (a -> [a -> a] -> b) -> b +baz' = undefined + +quux :: a -> (forall a. a -> a) -> a +quux = undefined + +quux' :: forall a. a -> (forall a. a -> a) -> a +quux' = undefined + + +num :: Num a => a -> a -> a +num = undefined + +num' :: forall a. Num a => a -> a -> a +num' = undefined + +eq :: (Eq a, Eq b) => [a] -> [b] -> (a, b) +eq = undefined + +eq' :: forall a b. (Eq a, Eq b) => [a] -> [b] -> (a, b) +eq' = undefined + +mon :: Monad m => (a -> m a) -> m a +mon = undefined + +mon' :: forall m a. Monad m => (a -> m a) -> m a +mon' = undefined + + +norf :: a -> (forall a. Ord a => a -> a) -> a +norf = undefined + +norf' :: forall a. a -> (forall a. Ord a => a -> a) -> a +norf' = undefined + + +plugh :: forall a. a -> a +plugh x = x :: a + +thud :: forall a b. (a -> b) -> a -> (a, b) +thud f x = + (x :: a, y) :: (a, b) + where + y = (f :: a -> b) x :: b diff --git a/hypsrc-test/src/Records.hs b/hypsrc-test/src/Records.hs new file mode 100644 index 00000000..40a01121 --- /dev/null +++ b/hypsrc-test/src/Records.hs @@ -0,0 +1,34 @@ +{-# LANGUAGE NamedFieldPuns #-} +{-# LANGUAGE RecordWildCards #-} + + +module Records where + + +data Point = Point + { x :: !Int + , y :: !Int + } + + +point :: Int -> Int -> Point +point x y = Point { x = x, y = y } + + +lengthSqr :: Point -> Int +lengthSqr (Point { x = x, y = y }) = x * x + y * y + +lengthSqr' :: Point -> Int +lengthSqr' (Point { x, y }) = y * y + x * x + + +translateX, translateY :: Point -> Int -> Point +translateX p d = p { x = x p + d } +translateY p d = p { y = y p + d } + +translate :: Int -> Int -> Point -> Point +translate x y p = + aux p + where + (dx, dy) = (x, y) + aux Point{..} = p { x = x + dx, y = y + dy } diff --git a/hypsrc-test/src/Types.hs b/hypsrc-test/src/Types.hs new file mode 100644 index 00000000..b63a825b --- /dev/null +++ b/hypsrc-test/src/Types.hs @@ -0,0 +1,42 @@ +{-# LANGUAGE TypeFamilies #-} + + +module Types where + + +data Quux = Bar | Baz + +newtype Foo = Foo () + +type FooQuux = (Foo, Quux) +type QuuxFoo = (Quux, Foo) + + +data family Norf a b + +data instance Norf Foo Quux = NFQ Foo Quux +data instance Norf Quux Foo = NQF Quux Foo + + +type family Norf' a b + +type instance Norf' Foo Quux = (Foo, Quux) +type instance Norf' Quux Foo = (Quux, Foo) + + +norf1 :: Norf Foo Quux -> Int +norf1 (NFQ (Foo ()) Bar) = 0 +norf1 (NFQ (Foo ()) Baz) = 1 + +norf2 :: Norf Quux Foo -> Int +norf2 (NQF Bar (Foo ())) = 0 +norf2 (NQF Baz (Foo ())) = 1 + + +norf1' :: Norf' Foo Quux -> Int +norf1' (Foo (), Bar) = 0 +norf1' (Foo (), Baz) = 1 + +norf2' :: Norf' Quux Foo -> Int +norf2' (Bar, Foo ()) = 0 +norf2' (Baz, Foo ()) = 1 diff --git a/latex-test/run.lhs b/latex-test/run.lhs index c1d48d97..d3e39e90 100755 --- a/latex-test/run.lhs +++ b/latex-test/run.lhs @@ -6,7 +6,7 @@ import Control.Monad import Control.Applicative import Data.List import Data.Maybe -import Distribution.InstalledPackageInfo +import Distribution.InstalledPackageInfo hiding (dataDir) import Distribution.Package (PackageName (..)) import Distribution.Simple.Compiler import Distribution.Simple.GHC |