diff options
222 files changed, 5887 insertions, 1837 deletions
@@ -1,4 +1,5 @@ /dist/ +/dist-newstyle/ /haddock-api/dist/ /haddock-library/dist/ /haddock-test/dist/ @@ -20,3 +21,5 @@ TAGS .cabal-sandbox cabal.sandbox.config + +.stack-work/ diff --git a/.travis.yml b/.travis.yml index 7fb97c8e..f7a9d921 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,26 +1,80 @@ +# This Travis job script has been generated by a script via +# +# make_travis_yml_2.hs 'haddock.cabal' +# +# For more information, see https://github.com/hvr/multi-ghc-travis +# +language: c sudo: false +git: + submodules: false # whether to recursively clone submodules + +cache: + directories: + - $HOME/.cabal/packages + - $HOME/.cabal/store + +before_cache: + - rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log + # remove files that are regenerated by 'cabal update' + - rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.* + - rm -fv $HOME/.cabal/packages/hackage.haskell.org/*.json + - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.cache + - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar + - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar.idx + matrix: include: - - env: CABALVER=head GHCVER=head - addons: {apt: {packages: [cabal-install-head,ghc-head], sources: [hvr-ghc]}} + - compiler: "ghc-8.2.1" + # env: TEST=--disable-tests BENCH=--disable-benchmarks + addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.2.1], sources: [hvr-ghc]}} + - compiler: "ghc-head" + # env: TEST=--disable-tests BENCH=--disable-benchmarks + addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-head], sources: [hvr-ghc]}} allow_failures: - - env: CABALVER=head GHCVER=head + - compiler: "ghc-head" before_install: - - export PATH=$HOME/.cabal/bin:/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH + - HC=${CC} + - unset CC + - PATH=/opt/ghc/bin:/opt/ghc-ppa-tools/bin:$PATH + - PKGNAME='haddock' + +install: - cabal --version - - cabal update - - cd haddock-library - - cabal install --only-dependencies --enable-tests - - cabal install doctest - # --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 && cabal build && cabal test && cabal install) + - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]" + - BENCH=${BENCH---enable-benchmarks} + - TEST=${TEST---enable-tests} + - travis_retry cabal update -v + - sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config + - rm -fv cabal.project.local + - rm -f cabal.project.freeze + - travis_retry cabal new-build -w ${HC} ${TEST} ${BENCH} --dep -j2 all + - travis_retry cabal new-build -w ${HC} --disable-tests --disable-benchmarks --dep -j2 all +# Here starts the actual work to be performed for the package under test; +# any command which exits with a non-zero exit code causes the build to fail. script: - - cabal configure --enable-tests && cabal build && cabal test
\ No newline at end of file + - if [ -f configure.ac ]; then autoreconf -i; fi + - rm -rf dist/ + - cabal sdist # test that a source-distribution can be generated + - cd dist/ + - SRCTAR=(${PKGNAME}-*.tar.gz) + - SRC_BASENAME="${SRCTAR/%.tar.gz}" + - tar -xvf "./$SRC_BASENAME.tar.gz" + - cd "$SRC_BASENAME/" +## from here on, CWD is inside the extracted source-tarball + - rm -fv cabal.project.local + # this builds all libraries and executables (without tests/benchmarks) + - rm -f cabal.project.freeze + - cabal new-build -w ${HC} --disable-tests --disable-benchmarks all + # this builds all libraries and executables (including tests/benchmarks) + # - rm -rf ./dist-newstyle + + # build & run tests + - cabal new-build -w ${HC} ${TEST} ${BENCH} all + - if [ "x$TEST" = "x--enable-tests" ]; then cabal new-test -w ${HC} ${TEST} all; fi + +# EOF @@ -1,12 +1,49 @@ -Changes in version 2.17.3 +## Changes in version 2.18.2 + + * to be released + + * Fix renaming of type variables after specializing instance method signatures (#613) + + * Move markup related data types to haddock-library + + * Fix: Show empty constraint contexts in pattern type signatures (#663) + + * Fix: Generate constraint signatures for constructors exported as pattern + synonyms (#663) + +## Changes in version 2.18.1 + + * Synopsis is working again (#599) + + * Per-argument documentation on class methods working again (#647) + + * Support user defined signatures on pattern synonyms + + * Support for bundled pattern synonyms (#494, #551, #626) + +## Changes in version 2.17.4 + + * Fix 'internal error: links: UnhelpfulSpan' (#554, #565) + + * Hyperlink backend knows about `DataKinds` (#510) + + * Fix rendering of class methods for `Eq` and `Ord` (#549) + + * Export `MDoc` and `toInstalledIface` from `Haddock.Types` + +## Changes in version 2.17.3.1 + + * Disable `NFData` instances for GHC types when GHC >= 8.0.2 (#537) + +## Changes in version 2.17.3 * Remove framed view of the HTML documentation -Changes in version 2.17.2 +## Changes in version 2.17.2 * Fix portability of documentation building within GHC -Changes in version 2.17.1 +## Changes in version 2.17.1 * Included with GHC 8.0.1 @@ -14,7 +51,7 @@ Changes in version 2.17.1 * Fixed clean rule of GHC Makefile -Changes in version 2.17.0 (not released) +## Changes in version 2.17.0 (not released) * Support typesetting of mathematical expressions via Mathjax (#397) @@ -24,7 +61,7 @@ Changes in version 2.17.0 (not released) * Support GCC-like response files (#470) -Changes in version 2.16.2 +## Changes in version 2.16.2 * Generate hyperlinked source ourselves (#410, part of GSOC 2015) @@ -36,7 +73,7 @@ Changes in version 2.16.2 * Line anchors in hyperlinked source (#420) -Changes in version 2.16.1 +## Changes in version 2.16.1 * Don't default to type constructors for out-of-scope names (#253 and #375) @@ -59,7 +96,7 @@ Changes in version 2.16.1 * Fix alignment of Source link for instances in Firefox (#384) -Changes in version 2.16.0 +## Changes in version 2.16.0 * Experimental collapsible header support (#335) @@ -93,7 +130,7 @@ Changes in version 2.16.0 * Deal better with long synopsis lines (#151) -Changes in version 2.15.0 +## Changes in version 2.15.0 * Always read in prologue files as UTF8 (#286 and Cabal #1721) @@ -123,13 +160,13 @@ Changes in version 2.15.0 * Remove some files which were really old or did not belong in the repository in the first place. -Changes in version 2.14.3 +## Changes in version 2.14.3 * Fix parsing of identifiers with ^ or ⋆ in them (#298) * Fix anchors (#308) -Changes in version 2.14.2 +## Changes in version 2.14.2 * Always drop --split-objs GHC flag for performance reasons (#292) @@ -139,7 +176,7 @@ Changes in version 2.14.2 * Fix crashes associated with exporting data family record selectors (#294) -Changes in version 2.14.1 +## Changes in version 2.14.1 * Render * and -> with their UnicodeSyntax equivalents if -U is enabled @@ -147,7 +184,7 @@ Changes in version 2.14.1 * Hide right hand side of TF instances with hidden names on the RHS -Changes in version 2.14.0 +## Changes in version 2.14.0 * Print entities with missing documentation (#258) @@ -196,7 +233,7 @@ Changes in version 2.14.0 * Bird tracks specified like "> code" no longer suffer from an extra leading space in the code output -Changes in version 2.13.2 +## Changes in version 2.13.2 * Handle HsExplicitListTy in renamer (#213) @@ -207,7 +244,7 @@ Changes in version 2.13.2 * Include everything that is required to run the test suite with the cabal package (#230) -Changes in version 2.13.1 +## Changes in version 2.13.1 * Hide instances that are "internal" to a module @@ -217,13 +254,13 @@ Changes in version 2.13.1 * Fix and extend the Haddock API -Changes in version 2.12.0 +## Changes in version 2.12.0 * Labeled URLs (e.g <http://example.net/ some label>) * Improved memory usage (new dependency: deepseq) -Changes in version 2.11.0 +## Changes in version 2.11.0 * Show deprecation messages for identifiers @@ -244,7 +281,7 @@ Changes in version 2.11.0 * Access to unexported identifiers through the Haddock API again -Changes in version 2.10.0 +## Changes in version 2.10.0 * Require GHC >= 7.4 @@ -260,13 +297,13 @@ Changes in version 2.10.0 * Bug fix: module references to other packages work again -Changes in version 2.9.4 +## Changes in version 2.9.4 * Require GHC >= 7.2 * Support Alex 3.x -Changes in version 2.9.3 +## Changes in version 2.9.3 [This is the version that comes with GHC 7.2.1 although it claims it's 2.9.2!] @@ -278,19 +315,19 @@ Changes in version 2.9.3 * Minor bug fixes -Changes in version 2.9.2 +## Changes in version 2.9.2 * Build with GHC 7.0.2 * Write Hoogle output in utf8; fixes GHC build on Windows -Changes in version 2.9.1 +## Changes in version 2.9.1 * Fix build in GHC tree * Improve .cabal file -Changes in version 2.9.0 +## Changes in version 2.9.0 * Drop support for ghc < 7 @@ -304,7 +341,7 @@ Changes in version 2.9.0 * Minor changes to the API -Changes in the version that comes with GHC 7.0.1 +## Changes in the version that comes with GHC 7.0.1 [This version claims it is 2.8.0 but is actually based on 2.8.1] @@ -312,11 +349,11 @@ Changes in the version that comes with GHC 7.0.1 * Support GHC 7.0 -Changes in version 2.8.1 +## Changes in version 2.8.1 * Fix build on Windows with MinGW -Changes in version 2.8.0 +## Changes in version 2.8.0 * HTML backend completely rewritten to generate semantically rich XHTML using the xhtml package. @@ -350,25 +387,25 @@ Changes in version 2.8.0 ----------------------------------------------------------------------------- -Changes in version 2.6.1 (bug fix release from the stable branch) +## Changes in version 2.6.1 (bug fix release from the stable branch) * Fix #128 ----------------------------------------------------------------------------- -Changes in version 2.7.2 +## Changes in version 2.7.2 * Add Paths_haddock to library ----------------------------------------------------------------------------- -Changes in version 2.7.1: +## Changes in version 2.7.1: * Fix problems with library part of .cabal file ----------------------------------------------------------------------------- -Changes in version 2.7.0: +## Changes in version 2.7.0: * Instances can be commented @@ -378,7 +415,7 @@ Changes in version 2.7.0: ----------------------------------------------------------------------------- -Changes in version 2.6.0: +## Changes in version 2.6.0: * Drop support for GHC 6.10.* @@ -498,7 +535,7 @@ Changed in version 2.2.2: ----------------------------------------------------------------------------- -Changes in version 2.2.1: +## Changes in version 2.2.1: * Support for GHC 6.8.3 @@ -519,7 +556,7 @@ Changes in version 2.2.1: ----------------------------------------------------------------------------- -Changes in version 2.1.0: +## Changes in version 2.1.0: * Fix a bug that made links point to the defining module instead of the "best" one (e.g Int pointing to GHC.Base instead of Data.Int) @@ -532,7 +569,7 @@ Changes in version 2.1.0: ----------------------------------------------------------------------------- -Changes in version 2.0.0.0: +## Changes in version 2.0.0.0: * The GHC API is used as the front-end @@ -565,7 +602,7 @@ Changes in version 2.0.0.0: ----------------------------------------------------------------------------- -Changes in version 0.9: +## Changes in version 0.9: * Infix type operators, e.g., first :: a~>a' -> (a,b)~>(a',b) @@ -591,7 +628,7 @@ Changes in version 0.9: ----------------------------------------------------------------------------- -Changes in version 0.8: +## Changes in version 0.8: * Haddock has a Cabal build system, and will build on Windows without Cygwin or MSYS. GHC 6.4 or later is required. @@ -610,9 +647,9 @@ Changes in version 0.8: ----------------------------------------------------------------------------- -Changes in version 0.7: +## Changes in version 0.7: - * Changes in the way Haddock decides where to direct hyperlinks. Each entity + * ## Changes in the way Haddock decides where to direct hyperlinks. Each entity is now assigned a single "home" module, and all hyperlinks are directed to that module. See the docs ("Hyperlinking and re-exported entities") for details. @@ -638,7 +675,7 @@ Changes in version 0.7: ----------------------------------------------------------------------------- -Changes in version 0.6: +## Changes in version 0.6: * Implicit parameters, zip comprehensions and 'mdo' are now supported by the parser. @@ -675,7 +712,7 @@ Changes in version 0.6: ----------------------------------------------------------------------------- -Changes in version 0.5: +## Changes in version 0.5: * Compiles with recent versions of GHC. @@ -685,7 +722,7 @@ Changes in version 0.5: ----------------------------------------------------------------------------- -Changes in version 0.4: +## Changes in version 0.4: * Import declarations which list entities in parentheses, or with hiding clauses, are now properly supported. Modulo one or two @@ -708,7 +745,7 @@ Changes in version 0.4: * Many bugs fixed ----------------------------------------------------------------------------- -Changes in version 0.3: +## Changes in version 0.3: * Documentation on individual function arguments is now implemented @@ -729,7 +766,7 @@ Changes in version 0.3: * Various bugs fixed. ----------------------------------------------------------------------------- -Changes in version 0.2: +## Changes in version 0.2: * The [...] markup for typewriter font has been changed to @...@. @@ -1,52 +1,21 @@ -# Haddock, a Haskell Documentation Tool +# Haddock, a Haskell Documentation Tool [![Build Status](https://travis-ci.org/haskell/haddock.svg?branch=master)](https://travis-ci.org/haskell/haddock) -#### About haddock +## About haddock -This is Haddock, a tool for automatically generating documentation -from annotated Haskell source code. It is primary intended for -documenting library interfaces, but it should be useful for any kind -of Haskell code. +See [Description on Hackage](https://hackage.haskell.org/package/haddock). -Haddock lets you write documentation annotations next to the -definitions of functions and types in the source code, in a syntax -that is easy on the eye when writing the source code (no heavyweight -mark-up). The documentation generated by Haddock is fully hyperlinked -- click on a type name in a type signature to go straight to the -definition, and documentation, for that type. +## Source code documentation -Haddock understands Haskell's module system, so you can structure your -code however you like without worrying that internal structure will be -exposed in the generated documentation. For example, it is common to -implement a library in several modules, but define the external API by -having a single module which re-exports parts of these implementation -modules. Using Haddock, you can still write documentation annotations -next to the actual definitions of the functions and types in the -library, but the documentation annotations from the implementation -will be propagated to the external API when the documentation is -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 +Full documentation can be found in the `doc/` subdirectory, in +[reStructedText format](http://www.sphinx-doc.org/en/stable/rest.html) format. - -#### Contributing +## Contributing Please create issues when you have any problems and pull requests if you have some code. -##### Hacking +## Hacking To get started you'll need a latest GHC release installed. @@ -59,7 +28,15 @@ Clone the repository: and then proceed using your favourite build tool. -###### Using Cabal sandboxes +#### Using [`cabal new-build`](http://cabal.readthedocs.io/en/latest/nix-local-build-overview.html) + +```bash +cabal new-build -w ghc-8.2.1 +# build & run the test suite +cabal new-test -w ghc-8.2.1 +``` + +#### Using Cabal sandboxes ```bash cabal sandbox init @@ -75,7 +52,7 @@ export HADDOCK_PATH="dist/build/haddock/haddock" cabal test ``` -###### Using Stack +#### Using Stack ```bash stack init @@ -85,9 +62,14 @@ export HADDOCK_PATH="$HOME/.local/bin/haddock" stack test ``` +### Git Branches 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. +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. + +The `master` branch usually requires a GHC from the latest GHC stable +branch. The required GHC version can be inferred from the version +bounds on `ghc` in the respective `.cabal` files. diff --git a/cabal.project b/cabal.project new file mode 100644 index 00000000..ba925e3d --- /dev/null +++ b/cabal.project @@ -0,0 +1,4 @@ +packages: ./ + ./haddock-api + ./haddock-library + ./haddock-test diff --git a/doc/cheatsheet/LICENSE b/doc/cheatsheet/LICENSE new file mode 100644 index 00000000..fd662a7e --- /dev/null +++ b/doc/cheatsheet/LICENSE @@ -0,0 +1,428 @@ +Attribution-ShareAlike 4.0 International + +======================================================================= + +Creative Commons Corporation ("Creative Commons") is not a law firm and +does not provide legal services or legal advice. Distribution of +Creative Commons public licenses does not create a lawyer-client or +other relationship. Creative Commons makes its licenses and related +information available on an "as-is" basis. Creative Commons gives no +warranties regarding its licenses, any material licensed under their +terms and conditions, or any related information. Creative Commons +disclaims all liability for damages resulting from their use to the +fullest extent possible. + +Using Creative Commons Public Licenses + +Creative Commons public licenses provide a standard set of terms and +conditions that creators and other rights holders may use to share +original works of authorship and other material subject to copyright +and certain other rights specified in the public license below. The +following considerations are for informational purposes only, are not +exhaustive, and do not form part of our licenses. + + Considerations for licensors: Our public licenses are + intended for use by those authorized to give the public + permission to use material in ways otherwise restricted by + copyright and certain other rights. Our licenses are + irrevocable. Licensors should read and understand the terms + and conditions of the license they choose before applying it. + Licensors should also secure all rights necessary before + applying our licenses so that the public can reuse the + material as expected. Licensors should clearly mark any + material not subject to the license. This includes other CC- + licensed material, or material used under an exception or + limitation to copyright. More considerations for licensors: + wiki.creativecommons.org/Considerations_for_licensors + + Considerations for the public: By using one of our public + licenses, a licensor grants the public permission to use the + licensed material under specified terms and conditions. If + the licensor's permission is not necessary for any reason--for + example, because of any applicable exception or limitation to + copyright--then that use is not regulated by the license. Our + licenses grant only permissions under copyright and certain + other rights that a licensor has authority to grant. Use of + the licensed material may still be restricted for other + reasons, including because others have copyright or other + rights in the material. A licensor may make special requests, + such as asking that all changes be marked or described. + Although not required by our licenses, you are encouraged to + respect those requests where reasonable. More_considerations + for the public: + wiki.creativecommons.org/Considerations_for_licensees + +======================================================================= + +Creative Commons Attribution-ShareAlike 4.0 International Public +License + +By exercising the Licensed Rights (defined below), You accept and agree +to be bound by the terms and conditions of this Creative Commons +Attribution-ShareAlike 4.0 International Public License ("Public +License"). To the extent this Public License may be interpreted as a +contract, You are granted the Licensed Rights in consideration of Your +acceptance of these terms and conditions, and the Licensor grants You +such rights in consideration of benefits the Licensor receives from +making the Licensed Material available under these terms and +conditions. + + +Section 1 -- Definitions. + + a. Adapted Material means material subject to Copyright and Similar + Rights that is derived from or based upon the Licensed Material + and in which the Licensed Material is translated, altered, + arranged, transformed, or otherwise modified in a manner requiring + permission under the Copyright and Similar Rights held by the + Licensor. For purposes of this Public License, where the Licensed + Material is a musical work, performance, or sound recording, + Adapted Material is always produced where the Licensed Material is + synched in timed relation with a moving image. + + b. Adapter's License means the license You apply to Your Copyright + and Similar Rights in Your contributions to Adapted Material in + accordance with the terms and conditions of this Public License. + + c. BY-SA Compatible License means a license listed at + creativecommons.org/compatiblelicenses, approved by Creative + Commons as essentially the equivalent of this Public License. + + d. Copyright and Similar Rights means copyright and/or similar rights + closely related to copyright including, without limitation, + performance, broadcast, sound recording, and Sui Generis Database + Rights, without regard to how the rights are labeled or + categorized. For purposes of this Public License, the rights + specified in Section 2(b)(1)-(2) are not Copyright and Similar + Rights. + + e. Effective Technological Measures means those measures that, in the + absence of proper authority, may not be circumvented under laws + fulfilling obligations under Article 11 of the WIPO Copyright + Treaty adopted on December 20, 1996, and/or similar international + agreements. + + f. Exceptions and Limitations means fair use, fair dealing, and/or + any other exception or limitation to Copyright and Similar Rights + that applies to Your use of the Licensed Material. + + g. License Elements means the license attributes listed in the name + of a Creative Commons Public License. The License Elements of this + Public License are Attribution and ShareAlike. + + h. Licensed Material means the artistic or literary work, database, + or other material to which the Licensor applied this Public + License. + + i. Licensed Rights means the rights granted to You subject to the + terms and conditions of this Public License, which are limited to + all Copyright and Similar Rights that apply to Your use of the + Licensed Material and that the Licensor has authority to license. + + j. Licensor means the individual(s) or entity(ies) granting rights + under this Public License. + + k. Share means to provide material to the public by any means or + process that requires permission under the Licensed Rights, such + as reproduction, public display, public performance, distribution, + dissemination, communication, or importation, and to make material + available to the public including in ways that members of the + public may access the material from a place and at a time + individually chosen by them. + + l. Sui Generis Database Rights means rights other than copyright + resulting from Directive 96/9/EC of the European Parliament and of + the Council of 11 March 1996 on the legal protection of databases, + as amended and/or succeeded, as well as other essentially + equivalent rights anywhere in the world. + + m. You means the individual or entity exercising the Licensed Rights + under this Public License. Your has a corresponding meaning. + + +Section 2 -- Scope. + + a. License grant. + + 1. Subject to the terms and conditions of this Public License, + the Licensor hereby grants You a worldwide, royalty-free, + non-sublicensable, non-exclusive, irrevocable license to + exercise the Licensed Rights in the Licensed Material to: + + a. reproduce and Share the Licensed Material, in whole or + in part; and + + b. produce, reproduce, and Share Adapted Material. + + 2. Exceptions and Limitations. For the avoidance of doubt, where + Exceptions and Limitations apply to Your use, this Public + License does not apply, and You do not need to comply with + its terms and conditions. + + 3. Term. The term of this Public License is specified in Section + 6(a). + + 4. Media and formats; technical modifications allowed. The + Licensor authorizes You to exercise the Licensed Rights in + all media and formats whether now known or hereafter created, + and to make technical modifications necessary to do so. The + Licensor waives and/or agrees not to assert any right or + authority to forbid You from making technical modifications + necessary to exercise the Licensed Rights, including + technical modifications necessary to circumvent Effective + Technological Measures. For purposes of this Public License, + simply making modifications authorized by this Section 2(a) + (4) never produces Adapted Material. + + 5. Downstream recipients. + + a. Offer from the Licensor -- Licensed Material. Every + recipient of the Licensed Material automatically + receives an offer from the Licensor to exercise the + Licensed Rights under the terms and conditions of this + Public License. + + b. Additional offer from the Licensor -- Adapted Material. + Every recipient of Adapted Material from You + automatically receives an offer from the Licensor to + exercise the Licensed Rights in the Adapted Material + under the conditions of the Adapter's License You apply. + + c. No downstream restrictions. You may not offer or impose + any additional or different terms or conditions on, or + apply any Effective Technological Measures to, the + Licensed Material if doing so restricts exercise of the + Licensed Rights by any recipient of the Licensed + Material. + + 6. No endorsement. Nothing in this Public License constitutes or + may be construed as permission to assert or imply that You + are, or that Your use of the Licensed Material is, connected + with, or sponsored, endorsed, or granted official status by, + the Licensor or others designated to receive attribution as + provided in Section 3(a)(1)(A)(i). + + b. Other rights. + + 1. Moral rights, such as the right of integrity, are not + licensed under this Public License, nor are publicity, + privacy, and/or other similar personality rights; however, to + the extent possible, the Licensor waives and/or agrees not to + assert any such rights held by the Licensor to the limited + extent necessary to allow You to exercise the Licensed + Rights, but not otherwise. + + 2. Patent and trademark rights are not licensed under this + Public License. + + 3. To the extent possible, the Licensor waives any right to + collect royalties from You for the exercise of the Licensed + Rights, whether directly or through a collecting society + under any voluntary or waivable statutory or compulsory + licensing scheme. In all other cases the Licensor expressly + reserves any right to collect such royalties. + + +Section 3 -- License Conditions. + +Your exercise of the Licensed Rights is expressly made subject to the +following conditions. + + a. Attribution. + + 1. If You Share the Licensed Material (including in modified + form), You must: + + a. retain the following if it is supplied by the Licensor + with the Licensed Material: + + i. identification of the creator(s) of the Licensed + Material and any others designated to receive + attribution, in any reasonable manner requested by + the Licensor (including by pseudonym if + designated); + + ii. a copyright notice; + + iii. a notice that refers to this Public License; + + iv. a notice that refers to the disclaimer of + warranties; + + v. a URI or hyperlink to the Licensed Material to the + extent reasonably practicable; + + b. indicate if You modified the Licensed Material and + retain an indication of any previous modifications; and + + c. indicate the Licensed Material is licensed under this + Public License, and include the text of, or the URI or + hyperlink to, this Public License. + + 2. You may satisfy the conditions in Section 3(a)(1) in any + reasonable manner based on the medium, means, and context in + which You Share the Licensed Material. For example, it may be + reasonable to satisfy the conditions by providing a URI or + hyperlink to a resource that includes the required + information. + + 3. If requested by the Licensor, You must remove any of the + information required by Section 3(a)(1)(A) to the extent + reasonably practicable. + + b. ShareAlike. + + In addition to the conditions in Section 3(a), if You Share + Adapted Material You produce, the following conditions also apply. + + 1. The Adapter's License You apply must be a Creative Commons + license with the same License Elements, this version or + later, or a BY-SA Compatible License. + + 2. You must include the text of, or the URI or hyperlink to, the + Adapter's License You apply. You may satisfy this condition + in any reasonable manner based on the medium, means, and + context in which You Share Adapted Material. + + 3. You may not offer or impose any additional or different terms + or conditions on, or apply any Effective Technological + Measures to, Adapted Material that restrict exercise of the + rights granted under the Adapter's License You apply. + + +Section 4 -- Sui Generis Database Rights. + +Where the Licensed Rights include Sui Generis Database Rights that +apply to Your use of the Licensed Material: + + a. for the avoidance of doubt, Section 2(a)(1) grants You the right + to extract, reuse, reproduce, and Share all or a substantial + portion of the contents of the database; + + b. if You include all or a substantial portion of the database + contents in a database in which You have Sui Generis Database + Rights, then the database in which You have Sui Generis Database + Rights (but not its individual contents) is Adapted Material, + + including for purposes of Section 3(b); and + c. You must comply with the conditions in Section 3(a) if You Share + all or a substantial portion of the contents of the database. + +For the avoidance of doubt, this Section 4 supplements and does not +replace Your obligations under this Public License where the Licensed +Rights include other Copyright and Similar Rights. + + +Section 5 -- Disclaimer of Warranties and Limitation of Liability. + + a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE + EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS + AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF + ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, + IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, + WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, + ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT + KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT + ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. + + b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE + TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, + NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, + INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, + COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR + USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN + ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR + DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR + IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. + + c. The disclaimer of warranties and limitation of liability provided + above shall be interpreted in a manner that, to the extent + possible, most closely approximates an absolute disclaimer and + waiver of all liability. + + +Section 6 -- Term and Termination. + + a. This Public License applies for the term of the Copyright and + Similar Rights licensed here. However, if You fail to comply with + this Public License, then Your rights under this Public License + terminate automatically. + + b. Where Your right to use the Licensed Material has terminated under + Section 6(a), it reinstates: + + 1. automatically as of the date the violation is cured, provided + it is cured within 30 days of Your discovery of the + violation; or + + 2. upon express reinstatement by the Licensor. + + For the avoidance of doubt, this Section 6(b) does not affect any + right the Licensor may have to seek remedies for Your violations + of this Public License. + + c. For the avoidance of doubt, the Licensor may also offer the + Licensed Material under separate terms or conditions or stop + distributing the Licensed Material at any time; however, doing so + will not terminate this Public License. + + d. Sections 1, 5, 6, 7, and 8 survive termination of this Public + License. + + +Section 7 -- Other Terms and Conditions. + + a. The Licensor shall not be bound by any additional or different + terms or conditions communicated by You unless expressly agreed. + + b. Any arrangements, understandings, or agreements regarding the + Licensed Material not stated herein are separate from and + independent of the terms and conditions of this Public License. + + +Section 8 -- Interpretation. + + a. For the avoidance of doubt, this Public License does not, and + shall not be interpreted to, reduce, limit, restrict, or impose + conditions on any use of the Licensed Material that could lawfully + be made without permission under this Public License. + + b. To the extent possible, if any provision of this Public License is + deemed unenforceable, it shall be automatically reformed to the + minimum extent necessary to make it enforceable. If the provision + cannot be reformed, it shall be severed from this Public License + without affecting the enforceability of the remaining terms and + conditions. + + c. No term or condition of this Public License will be waived and no + failure to comply consented to unless expressly agreed to by the + Licensor. + + d. Nothing in this Public License constitutes or may be interpreted + as a limitation upon, or waiver of, any privileges and immunities + that apply to the Licensor or You, including from the legal + processes of any jurisdiction or authority. + + +======================================================================= + +Creative Commons is not a party to its public +licenses. Notwithstanding, Creative Commons may elect to apply one of +its public licenses to material it publishes and in those instances +will be considered the “Licensor.” The text of the Creative Commons +public licenses is dedicated to the public domain under the CC0 Public +Domain Dedication. Except for the limited purpose of indicating that +material is shared under a Creative Commons public license or as +otherwise permitted by the Creative Commons policies published at +creativecommons.org/policies, Creative Commons does not authorize the +use of the trademark "Creative Commons" or any other trademark or logo +of Creative Commons without its prior written consent including, +without limitation, in connection with any unauthorized modifications +to any of its public licenses or any other arrangements, +understandings, or agreements concerning use of licensed material. For +the avoidance of doubt, this paragraph does not form part of the +public licenses. + +Creative Commons may be contacted at creativecommons.org. + diff --git a/doc/cheatsheet/README.md b/doc/cheatsheet/README.md new file mode 100644 index 00000000..c5856217 --- /dev/null +++ b/doc/cheatsheet/README.md @@ -0,0 +1,9 @@ +![License: CC BY-SA 4.0](https://img.shields.io/badge/License-CC%20BY--SA%204.0-lightgrey.svg) + +# Haddock Markup Quick Reference + +This page is a single-page quick reference for the markup used in GHC's [Haddock](https://www.haskell.org/haddock/) documentation format. It doesn't list all the details of the format, just the basic markup, so for the vagaries and edge-cases of the syntax, it would be helpful to consult the [Haddock user guide](http://haskell-haddock.readthedocs.io/en/latest/index.html). + +## License + +This document is licensed under the CC BY-SA 4.0 license. diff --git a/doc/cheatsheet/haddocks.md b/doc/cheatsheet/haddocks.md new file mode 100644 index 00000000..fbe71392 --- /dev/null +++ b/doc/cheatsheet/haddocks.md @@ -0,0 +1,120 @@ +# Code Sections + +``` + -- * Section + -- ** Sub-section + -- *** Sub-sub-section + -- et cetera +``` + +# Named Documentation Chunks + +``` + -- $name +[...] + -- $name + -- Here is the documentation text + -- which is embedded elsewhere +``` + +# Code Blocks + +``` +With internal markup: + -- @ + -- fact n = product [1..n] + -- @ +With literal text: + -- > fact n = product [1..n] +``` + +# REPL Examples + +``` + -- >>> fact 5 + -- 120 +``` + +# Properties + +``` + -- prop> a + b = b + a +``` + +# Hyperlinked Identifiers + +``` + -- The value 'x' of type 'T' + -- The out-of-scope 'MyModule.x' + -- The "MyModule" module +``` + +# Textual Markup + +``` + -- Emphasis: /forward slashes/. + -- Bolding: __underscores__. + -- Monospaced text: @ampersands@. +``` + +# Links and Images + +``` + -- A raw link <http://example.com> + -- [a link](http://example.com) + -- ![description](imagepath.png) +``` + +# Lists + +``` +itemized with "*" or "-" + -- * first item + -- * second item +numbered with "(n)" or "n." + -- 1. first item + -- 2. second item +definitions with "[thing]" + -- [one] first item + -- [two] second item +``` + +# Mathematics/LaTeX + +``` + -- \[ + -- f(n) = \Sum_{i=1}^{n} i + -- \] + \\ when \(n > 0\) +``` + +# Headings in Documentation + +``` + -- = Heading + -- == Sub-heading + -- === Sub-sub-heading +``` + +# Metadata + +``` + -- @since 1.2.3 +``` + +# Module Attributes + +``` +{-# OPTIONS_HADDOCK hide #-} + Omit this module from the docs +{-# OPTIONS_HADDOCK prune #-} + Omit definitions without docs +{-# OPTIONS_HADDOCK ignore-exports #-} + Treat this module as though all + top-level items are exported +{-# OPTIONS_HADDOCK not-home #-} + Do not treat this module as the + "home" of identifiers it exports +{-# OPTIONS_HADDOCK show-extensions #-} + Show all enabled LANGUAGE extensions +``` diff --git a/doc/cheatsheet/haddocks.pdf b/doc/cheatsheet/haddocks.pdf Binary files differnew file mode 100644 index 00000000..130e8595 --- /dev/null +++ b/doc/cheatsheet/haddocks.pdf diff --git a/doc/cheatsheet/haddocks.svg b/doc/cheatsheet/haddocks.svg new file mode 100644 index 00000000..ea08781f --- /dev/null +++ b/doc/cheatsheet/haddocks.svg @@ -0,0 +1,624 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="8.5in" + height="11in" + viewBox="0 0 170 220" + version="1.1" + id="svg8" + inkscape:version="0.92.1 r" + sodipodi:docname="haddocks.svg" + inkscape:export-filename="/home/gdritter/projects/haddock-cheatsheet/haddocks.png" + inkscape:export-xdpi="100" + inkscape:export-ydpi="100"> + <defs + id="defs2" /> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.99607843" + inkscape:pageshadow="2" + inkscape:zoom="1.1689792" + inkscape:cx="338.82394" + inkscape:cy="776.62735" + inkscape:document-units="in" + inkscape:current-layer="layer1" + showgrid="false" + inkscape:snap-smooth-nodes="true" + inkscape:snap-intersection-paths="true" + units="in" + scale-x="20" + inkscape:window-width="1918" + inkscape:window-height="1036" + inkscape:window-x="0" + inkscape:window-y="42" + inkscape:window-maximized="0" + showguides="true" + inkscape:guide-bbox="true"> + <inkscape:grid + type="xygrid" + id="grid4485" /> + </sodipodi:namedview> + <metadata + id="metadata5"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title /> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1" + transform="translate(0,-17.599983)"> + <text + xml:space="preserve" + style="font-style:normal;font-weight:normal;font-size:23.44835281px;line-height:0px;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.24425368px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + x="9.2960958" + y="44.426563" + id="text4489"><tspan + sodipodi:role="line" + x="9.2960958" + y="44.426563" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.61581755px;line-height:0px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans Bold';stroke-width:0.24425368px" + id="tspan4497">Code Sections</tspan><tspan + sodipodi:role="line" + x="9.2960958" + y="49.229057" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + id="tspan4507"> -- * Section</tspan><tspan + sodipodi:role="line" + x="9.2960958" + y="54.461079" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + id="tspan4511"> -- ** Sub-section</tspan><tspan + sodipodi:role="line" + x="9.2960958" + y="59.6931" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + id="tspan4513"> -- *** Sub-sub-section</tspan><tspan + sodipodi:role="line" + x="9.2960958" + y="64.925117" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + id="tspan4515"> -- et cetera</tspan></text> + <text + id="text4569" + y="70.848915" + x="9.3546734" + style="font-style:normal;font-weight:normal;font-size:23.44835281px;line-height:0px;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.24425368px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + xml:space="preserve"><tspan + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.61581755px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans Bold';stroke-width:0.24425368px" + y="70.848915" + x="9.3546734" + sodipodi:role="line" + id="tspan4753">Named Documentation Chunks</tspan><tspan + id="tspan4567" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:2.82077742px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + y="75.651405" + x="9.3546734" + sodipodi:role="line"> -- $name</tspan><tspan + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:2.82077742px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + y="80.955017" + x="9.3546734" + sodipodi:role="line" + id="tspan4580"><tspan + style="font-size:2.82077742px;fill:#808080;stroke-width:0.24425368px" + id="tspan4586">[...]</tspan></tspan><tspan + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:2.82077742px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + y="86.258629" + x="9.3546734" + sodipodi:role="line" + id="tspan4578"> -- $name</tspan><tspan + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:2.82077742px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + y="91.562233" + x="9.3546734" + sodipodi:role="line" + id="tspan4582"> -- Here is the documentation text</tspan><tspan + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:2.82077742px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + y="96.865845" + x="9.3546734" + sodipodi:role="line" + id="tspan4584"> -- which is embedded elsewhere</tspan></text> + <text + id="text4661" + y="102.25972" + x="9.3546734" + style="font-style:normal;font-weight:normal;font-size:23.44835281px;line-height:0px;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.24425368px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + xml:space="preserve"><tspan + id="tspan4647" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.61581755px;line-height:0px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans Bold';stroke-width:0.24425368px" + y="102.25972" + x="9.3546734" + sodipodi:role="line">Code Blocks</tspan><tspan + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';fill:#808080;stroke-width:0.24425368px" + y="107.06221" + x="9.3546734" + sodipodi:role="line" + id="tspan4649">With internal markup:</tspan><tspan + id="tspan4651" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + y="112.29424" + x="9.3546734" + sodipodi:role="line"> -- @</tspan><tspan + id="tspan4653" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + y="117.52625" + x="9.3546734" + sodipodi:role="line"> -- fact n = product [1..n]</tspan><tspan + id="tspan4655" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + y="122.75829" + x="9.3546734" + sodipodi:role="line"> -- @</tspan><tspan + id="tspan4657" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';fill:#808080;stroke-width:0.24425368px" + y="127.9903" + x="9.3546734" + sodipodi:role="line">With literal text:</tspan><tspan + id="tspan4659" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + y="133.22232" + x="9.3546734" + sodipodi:role="line"> -- > fact n = product [1..n]</tspan></text> + <text + xml:space="preserve" + style="font-style:normal;font-weight:normal;font-size:23.44835281px;line-height:0px;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.24425368px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + x="9.3546734" + y="140.30173" + id="text4602"><tspan + sodipodi:role="line" + x="9.3546734" + y="140.30173" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.61581755px;line-height:0px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans Bold';stroke-width:0.24425368px" + id="tspan4588">REPL Examples</tspan><tspan + sodipodi:role="line" + x="9.3546734" + y="145.10422" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + id="tspan4629"> -- >>> fact 5</tspan><tspan + sodipodi:role="line" + x="9.3546734" + y="150.33624" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + id="tspan4674"> -- 120</tspan></text> + <text + id="text4692" + y="156.90796" + x="9.3546734" + style="font-style:normal;font-weight:normal;font-size:23.44835281px;line-height:0px;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.24425368px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + xml:space="preserve"><tspan + id="tspan4680" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.61581755px;line-height:0px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans Bold';stroke-width:0.24425368px" + y="156.90796" + x="9.3546734" + sodipodi:role="line">Properties</tspan><tspan + id="tspan4690" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + y="161.71045" + x="9.3546734" + sodipodi:role="line"> -- prop> a + b = b + a</tspan></text> + <text + xml:space="preserve" + style="font-style:normal;font-weight:normal;font-size:23.3177433px;line-height:0px;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.24289316px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + x="9.5486708" + y="169.6808" + id="text4731"><tspan + sodipodi:role="line" + x="9.5486708" + y="169.6808" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.59010696px;line-height:0px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans Bold';stroke-width:0.24289316px" + id="tspan4727">Hyperlinked Identifiers</tspan><tspan + sodipodi:role="line" + x="9.5486708" + y="174.45654" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.06007123px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24289316px" + id="tspan4729"> -- The value 'x' of type 'T'</tspan><tspan + sodipodi:role="line" + x="9.5486708" + y="179.65942" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.06007123px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24289316px" + id="tspan4733"> -- The out-of-scope 'MyModule.x'</tspan><tspan + sodipodi:role="line" + x="9.5486708" + y="184.8623" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.06007123px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24289316px" + id="tspan4747"> -- The "MyModule" module</tspan></text> + <text + id="text4741" + y="192.34953" + x="9.3546734" + style="font-style:normal;font-weight:normal;font-size:23.44835281px;line-height:0px;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.24425368px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + xml:space="preserve"><tspan + id="tspan4735" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.61581755px;line-height:0px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans Bold';stroke-width:0.24425368px" + y="192.34953" + x="9.3546734" + sodipodi:role="line">Textual Markup</tspan><tspan + id="tspan4737" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + y="197.15202" + x="9.3546734" + sodipodi:role="line"> -- Emphasis: /forward slashes/.</tspan><tspan + id="tspan4739" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + y="202.38405" + x="9.3546734" + sodipodi:role="line"> -- Bolding: __underscores__.</tspan><tspan + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + y="207.61607" + x="9.3546734" + sodipodi:role="line" + id="tspan4745"> -- Monospaced text: @at signs@.</tspan></text> + <text + xml:space="preserve" + style="font-style:normal;font-weight:normal;font-size:23.44835281px;line-height:0px;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.24425368px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + x="9.3546734" + y="215.33546" + id="text4771"><tspan + sodipodi:role="line" + x="9.3546734" + y="215.33546" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.61581755px;line-height:0px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans Bold';stroke-width:0.24425368px" + id="tspan4763">Links and Images</tspan><tspan + id="tspan4769" + sodipodi:role="line" + x="9.3546734" + y="220.13795" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px"> -- A raw link <http://example.com></tspan><tspan + sodipodi:role="line" + x="9.3546734" + y="225.36998" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + id="tspan4780"> -- [a link](http://example.com)</tspan><tspan + sodipodi:role="line" + x="9.3546734" + y="230.60201" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + id="tspan4778"> -- ![description](imagepath.png)</tspan></text> + <text + id="text4806" + y="44.426563" + x="89.102867" + style="font-style:normal;font-weight:normal;font-size:23.44835281px;line-height:0px;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.24425368px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + xml:space="preserve"><tspan + id="tspan4796" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.61581755px;line-height:0px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans Bold';stroke-width:0.24425368px" + y="44.426563" + x="89.102867" + sodipodi:role="line">Lists</tspan><tspan + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.61581755px;line-height:0px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans Bold';stroke-width:0.24425368px" + y="49.229057" + x="89.102867" + sodipodi:role="line" + id="tspan4812" /><tspan + id="tspan4798" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';fill:#808080;stroke-width:0.24425368px" + y="49.229057" + x="89.102867" + sodipodi:role="line">itemized with "*" or "-"</tspan><tspan + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + y="54.461079" + x="89.102867" + sodipodi:role="line" + id="tspan4814"> -- * first item</tspan><tspan + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + y="59.6931" + x="89.102867" + sodipodi:role="line" + id="tspan4810"> -- * second item</tspan><tspan + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';fill:#808080;stroke-width:0.24425368px" + y="64.925117" + x="89.102867" + sodipodi:role="line" + id="tspan4816">numbered with "(n)" or "n."</tspan><tspan + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + y="70.157143" + x="89.102867" + sodipodi:role="line" + id="tspan4818"> -- 1. first item</tspan><tspan + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + y="75.38916" + x="89.102867" + sodipodi:role="line" + id="tspan4822"> -- 2. second item</tspan><tspan + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';fill:#808080;stroke-width:0.24425368px" + y="80.621185" + x="89.102867" + sodipodi:role="line" + id="tspan4826">definitions with "[thing]"</tspan><tspan + id="tspan4804" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + y="85.853203" + x="89.102867" + sodipodi:role="line"> -- [one] first item</tspan><tspan + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + y="91.085228" + x="89.102867" + sodipodi:role="line" + id="tspan4834"> -- [two] second item</tspan></text> + <text + id="text4936" + y="98.872009" + x="89.102867" + style="font-style:normal;font-weight:normal;font-size:23.44835281px;line-height:0px;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.24425368px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + xml:space="preserve"><tspan + id="tspan4920" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.61581755px;line-height:0px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans Bold';stroke-width:0.24425368px" + y="98.872009" + x="89.102867" + sodipodi:role="line">Mathematics/LaTeX</tspan><tspan + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.61581755px;line-height:0px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans Bold';stroke-width:0.24425368px" + y="103.6745" + x="89.102867" + sodipodi:role="line" + id="tspan4922" /><tspan + id="tspan4924" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + y="103.6745" + x="89.102867" + sodipodi:role="line" /><tspan + id="tspan4926" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + y="103.6745" + x="89.102867" + sodipodi:role="line"> -- \[</tspan><tspan + id="tspan4928" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + y="108.90652" + x="89.102867" + sodipodi:role="line"> -- f(n) = \Sum_{i=1}^{n} i</tspan><tspan + id="tspan4930" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + y="114.13854" + x="89.102867" + sodipodi:role="line"> -- \]</tspan><tspan + id="tspan4934" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + y="119.37056" + x="89.102867" + sodipodi:role="line"> -- when \(n > 0\)</tspan></text> + <text + xml:space="preserve" + style="font-style:normal;font-weight:normal;font-size:23.44835281px;line-height:0px;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.24425368px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + x="89.102867" + y="126.79274" + id="text4984"><tspan + sodipodi:role="line" + x="89.102867" + y="126.79274" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.61581755px;line-height:0px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans Bold';stroke-width:0.24425368px" + id="tspan4970">Headings in Documentation</tspan><tspan + id="tspan4972" + sodipodi:role="line" + x="89.102867" + y="131.59523" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.61581755px;line-height:0px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans Bold';stroke-width:0.24425368px" /><tspan + sodipodi:role="line" + x="89.102867" + y="131.59523" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + id="tspan4974" /><tspan + sodipodi:role="line" + x="89.102867" + y="131.59523" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + id="tspan4982"> -- = Heading</tspan><tspan + sodipodi:role="line" + x="89.102867" + y="136.82726" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + id="tspan4995"> -- == Sub-heading</tspan><tspan + sodipodi:role="line" + x="89.102867" + y="142.05928" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + id="tspan4997"> -- === sub-sub-heading</tspan></text> + <text + id="text5011" + y="149.362" + x="89.102867" + style="font-style:normal;font-weight:normal;font-size:23.44835281px;line-height:0px;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.24425368px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + xml:space="preserve"><tspan + id="tspan4999" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.61581755px;line-height:0px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans Bold';stroke-width:0.24425368px" + y="149.362" + x="89.102867" + sodipodi:role="line">Metadata</tspan><tspan + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.61581755px;line-height:0px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans Bold';stroke-width:0.24425368px" + y="154.16449" + x="89.102867" + sodipodi:role="line" + id="tspan5001" /><tspan + id="tspan5009" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + y="154.16449" + x="89.102867" + sodipodi:role="line" /><tspan + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + y="154.16449" + x="89.102867" + sodipodi:role="line" + id="tspan5018"> -- @since 1.2.3</tspan></text> + <flowRoot + xml:space="preserve" + id="flowRoot5020" + style="font-style:normal;font-weight:normal;font-size:96px;line-height:25px;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + transform="matrix(0.92316354,0,0,0.92316354,5.4302439,15.266139)"><flowRegion + id="flowRegion5022"><rect + id="rect5024" + width="238.32765" + height="162.11119" + x="435.52261" + y="59.137138" /></flowRegion><flowPara + id="flowPara5026" /></flowRoot> <text + xml:space="preserve" + style="font-style:normal;font-weight:normal;font-size:23.44835281px;line-height:0px;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.24425368px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + x="89.102867" + y="161.86107" + id="text5038"><tspan + sodipodi:role="line" + x="89.102867" + y="161.86107" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.61581755px;line-height:0px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans Bold';stroke-width:0.24425368px" + id="tspan5028">Module Attributes</tspan><tspan + id="tspan5030" + sodipodi:role="line" + x="89.102867" + y="166.66356" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:4.61581755px;line-height:0px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans Bold';stroke-width:0.24425368px" /><tspan + id="tspan5036" + sodipodi:role="line" + x="89.102867" + y="166.66356" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" /><tspan + sodipodi:role="line" + x="89.102867" + y="166.66356" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + id="tspan5044">{-# OPTIONS_HADDOCK hide #-}</tspan><tspan + sodipodi:role="line" + x="89.102867" + y="171.89558" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + id="tspan5048"><tspan + style="fill:#808080;stroke-width:0.24425368px" + id="tspan5080"> Omit this module from the docs</tspan></tspan><tspan + sodipodi:role="line" + x="89.102867" + y="177.12761" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + id="tspan5050">{-# OPTIONS_HADDOCK prune #-}</tspan><tspan + sodipodi:role="line" + x="89.102867" + y="182.35962" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + id="tspan5054"><tspan + style="fill:#808080;stroke-width:0.24425368px" + id="tspan5082"> Omit definitions without docs</tspan></tspan><tspan + sodipodi:role="line" + x="89.102867" + y="187.59164" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + id="tspan5056">{-# OPTIONS_HADDOCK ignore-exports #-}</tspan><tspan + sodipodi:role="line" + x="89.102867" + y="192.82367" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + id="tspan5060"><tspan + style="fill:#808080;stroke-width:0.24425368px" + id="tspan5084"> Treat this module as though all</tspan></tspan><tspan + sodipodi:role="line" + x="89.102867" + y="198.05569" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';fill:#808080;stroke-width:0.24425368px" + id="tspan5064"> top-level items are exported</tspan><tspan + sodipodi:role="line" + x="89.102867" + y="203.2877" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + id="tspan5066">{-# OPTIONS_HADDOCK not-home #-}</tspan><tspan + sodipodi:role="line" + x="89.102867" + y="208.51973" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';fill:#808080;stroke-width:0.24425368px" + id="tspan5068"> Do not treat this module as the</tspan><tspan + sodipodi:role="line" + x="89.102867" + y="213.75175" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';fill:#808080;stroke-width:0.24425368px" + id="tspan5078"> "home" of identifiers it exports</tspan><tspan + sodipodi:role="line" + x="89.102867" + y="218.98378" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + id="tspan5070">{-# OPTIONS_HADDOCK show-extensions #-}</tspan><tspan + sodipodi:role="line" + x="89.102867" + y="224.21579" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.07721162px;line-height:0px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';stroke-width:0.24425368px" + id="tspan5072"><tspan + style="fill:#808080;stroke-width:0.24425368px" + id="tspan5086"> Show all enabled LANGUAGE extensions</tspan></tspan></text> + <text + xml:space="preserve" + style="font-style:normal;font-weight:normal;font-size:20px;line-height:5.20833302px;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.20833333px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + x="5.544848" + y="32.398926" + id="text5294"><tspan + sodipodi:role="line" + id="tspan5292" + x="5.544848" + y="32.398926" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:13.33333302px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans Bold';stroke-width:0.20833333px">Haddock Markup</tspan></text> + <path + style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.78740158;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" + d="M 6.2499999,37.599983 H 162.5" + id="path5504" + inkscape:connector-curvature="0" /> + <text + xml:space="preserve" + style="font-style:normal;font-weight:normal;font-size:20px;line-height:5.20833302px;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.20833333px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + x="121.27747" + y="21.599566" + id="text5529"><tspan + sodipodi:role="line" + id="tspan5527" + x="121.27747" + y="29.399044" + style="stroke-width:0.20833333px" /></text> + <text + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:2.22222233px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:end;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:end;fill:#666666;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + x="163.25969" + y="21.504742" + id="text4489-0"><tspan + sodipodi:role="line" + x="163.25969" + y="21.504742" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:1.94444454px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:end;writing-mode:lr-tb;text-anchor:end;fill:#666666;stroke-width:0.26458332px" + id="tspan5579">Haddock Markup Cheat-sheet, Version 1.1</tspan><tspan + sodipodi:role="line" + x="163.25969" + y="24.28252" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:1.94444454px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:end;writing-mode:lr-tb;text-anchor:end;fill:#666666;stroke-width:0.26458332px" + id="tspan5571">Getty Ritter (<tspan + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:1.94444454px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';fill:#666666" + id="tspan5597">@aisamanra</tspan>)</tspan><tspan + sodipodi:role="line" + x="163.25969" + y="27.060297" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:1.94444454px;font-family:'Fira Mono';-inkscape-font-specification:'Fira Mono';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:end;writing-mode:lr-tb;text-anchor:end;fill:#666666;stroke-width:0.26458332px" + id="tspan5565">github.com/aisamanra/haddock-cheatsheet</tspan><tspan + sodipodi:role="line" + x="163.25969" + y="29.838076" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:1.94444454px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:end;writing-mode:lr-tb;text-anchor:end;fill:#666666;stroke-width:0.26458332px" + id="tspan5601" /><tspan + sodipodi:role="line" + x="163.25969" + y="32.615852" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:1.94444454px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:end;writing-mode:lr-tb;text-anchor:end;fill:#666666;stroke-width:0.26458332px" + id="tspan5605">This work is licensed under a Creative Commons</tspan><tspan + sodipodi:role="line" + x="163.25969" + y="35.393631" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:1.94444454px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:end;writing-mode:lr-tb;text-anchor:end;fill:#666666;stroke-width:0.26458332px" + id="tspan5593">Attribution-ShareAlike 4.0 International License</tspan></text> + </g> +</svg> diff --git a/doc/invoking.rst b/doc/invoking.rst index 83087bac..fc1e4410 100644 --- a/doc/invoking.rst +++ b/doc/invoking.rst @@ -88,6 +88,11 @@ The following options are available: :option:`--read-interface` option for more details. The interface file is in a binary format; don't try to read it. +.. option:: --show-interface=<file> + + Dumps a binary interface file to stdout in a human readable fashion. + Uses json as output format. + .. [1] Haddock interface files are not the same as Haskell interface files, I just couldn't think of a better name. diff --git a/doc/markup.rst b/doc/markup.rst index b0ebc738..d0b9392d 100644 --- a/doc/markup.rst +++ b/doc/markup.rst @@ -8,7 +8,7 @@ will just generate documentation that contains the type signatures, data type declarations, and class declarations exported by each of the modules being processed. -Documenting a top-level declaration +Documenting a Top-Level Declaration ----------------------------------- The simplest example of a documentation annotation is for documenting @@ -35,6 +35,8 @@ the following: - A type signature for a top-level function, +- A definition for a top-level function with no type signature, + - A ``data`` declaration, - A ``newtype`` declaration, @@ -57,9 +59,12 @@ this is possible in Haddock too: :: -- ^The 'square' function squares an integer. square x = x * x -Note that Haddock doesn't contain a Haskell type system — if you don't -write the type signature for a function, then Haddock can't tell what -its type is and it won't be included in the documentation. +Since Haddock uses the GHC API internally, it can infer types for +top-level functions without type signatures. However, you're +encouraged to add explicit type signatures for all top-level +functions, to make your source code more readable for your users, and +at times to avoid GHC inferring overly general type signatures that +are less helpful to your users. Documentation annotations may span several lines; the annotation continues until the first non-comment line in the source file. For @@ -81,13 +86,13 @@ comments: :: square :: Int -> Int square x = x * x -Documenting parts of a declaration +Documenting Parts of a Declaration ---------------------------------- In addition to documenting the whole declaration, in some cases we can also document individual parts of the declaration. -Class methods +Class Methods ~~~~~~~~~~~~~ Class methods are documented in the same way as top level type @@ -99,7 +104,7 @@ signatures, by using either the ``-- |`` or ``-- ^`` annotations: :: -- | This is the documentation for the 'g' method g :: Int -> a -Constructors and record fields +Constructors and Record Fields ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Constructors are documented like so: :: @@ -150,7 +155,7 @@ would join up documentation of each field and render the result. The reason for this seemingly weird behaviour is the fact that ``someField`` is actually the same (partial) function. -Function arguments +Function Arguments ~~~~~~~~~~~~~~~~~~ Individual arguments to a function may be documented like this: :: @@ -159,7 +164,9 @@ Individual arguments to a function may be documented like this: :: -> Float -- ^ The 'Float' argument -> IO () -- ^ The return value -The module description +.. _module-description: + +The Module Description ---------------------- A module itself may be documented with multiple fields that can then be @@ -183,50 +190,100 @@ module documentation example and then talk about the fields. :: module W where ... -The “Module” field should be clear. It currently doesn't affect the -output of any of the backends but you might want to include it for human -information or for any other tools that might be parsing these comments +All fields are optional but they must be in order if they do appear. +Multi-line fields are accepted but the consecutive lines have to start +indented more than their label. If your label is indented one space as +is often the case with the ``--`` syntax, the consecutive lines have +to start at two spaces at the very least. For example, above we saw a +multiline ``Copyright`` field: :: + + {-| + ... + Copyright : (c) Some Guy, 2013 + Someone Else, 2014 + ... + -} + +That could equivalently be written as :: + + -- | ... + -- Copyright: + -- (c) Some Guy, 2013 + -- Someone Else, 2014 + -- ... + +or as :: + + -- | ... + -- Copyright: (c) Some Guy, 2013 + -- Someone Else, 2014 + -- ... + +but not as :: + + -- | ... + -- Copyright: (c) Some Guy, 2013 + -- Someone Else, 2014 + -- ... + +since the ``Someone`` needs to be indented more than the +``Copyright``. + +Whether new lines and other formatting in multiline fields is +preserved depends on the field type. For example, new lines in the +``Copyright`` field are preserved, but new lines in the +``Description`` field are not; leading whitespace is not preserved in +either [#backend]_. Please note that we do not enforce the format for +any of the fields and the established formats are just a convention. + +.. [#backend] Technically, whitespace and newlines in the + ``Description`` field are preserved verbatim by the HTML backend, + but because most browsers collapse whitespace in HTML, they don't + render as such. But other backends may render this whitespace. + +Fields of the Module Description +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The ``Module`` field specifies the current module name. Since the module +name can be inferred automatically from the source file, it doesn't +affect the output of any of the backends. But you might want to +include it for any other tools that might be parsing these comments without the help of GHC. -The “Description” field accepts some short text which outlines the +The ``Description`` field accepts some short text which outlines the general purpose of the module. If you're generating HTML, it will show up next to the module link in the module index. -The “Copyright”, “License”, “Maintainer” and “Stability” fields should -be obvious. An alternative spelling for the “License” field is accepted -as “Licence” but the output will always prefer “License”. +The ``Copyright``, ``License``, ``Maintainer`` and ``Stability`` fields should +be obvious. An alternative spelling for the ``License`` field is accepted +as ``Licence`` but the output will always prefer ``License``. -The “Portability” field has seen varied use by different library +The ``Portability`` field has seen varied use by different library authors. Some people put down things like operating system constraints there while others put down which GHC extensions are used in the module. -Note that you might want to consider using the “show-extensions” module -flag for the latter. +Note that you might want to consider using the ``show-extensions`` module +flag for the latter (see :ref:`module-attrs`). -Finally, a module may contain a documentation comment before the module -header, in which case this comment is interpreted by Haddock as an -overall description of the module itself, and placed in a section -entitled “Description” in the documentation for the module. All usual -Haddock markup is valid in this comment. +Finally, a module may contain a documentation comment before the +module header, in which case this comment is interpreted by Haddock as +an overall description of the module itself, and placed in a section +entitled ``Description`` in the documentation for the module. All the +usual Haddock :ref:`markup` is valid in this comment. -All fields are optional but they must be in order if they do appear. -Multi-line fields are accepted but the consecutive lines have to start -indented more than their label. If your label is indented one space as -is often the case with “--” syntax, the consecutive lines have to start -at two spaces at the very least. Please note that we do not enforce the -format for any of the fields and the established formats are just a -convention. - -Controlling the documentation structure +Controlling the Documentation Structure --------------------------------------- Haddock produces interface documentation that lists only the entities -actually exported by the module. The documentation for a module will +actually exported by the module. If there is no export list then all +entities defined by the module are exported. + +The documentation for a module will include *all* entities exported by that module, even if they were -re-exported by another module. The only exception is when Haddock can't +re-exported from another module. The only exception is when Haddock can't see the declaration for the re-exported entity, perhaps because it isn't part of the batch of modules currently being processed. -However, to Haddock the export list has even more significance than just +To Haddock the export list has even more significance than just specifying the entities to be included in the documentation. It also specifies the *order* that entities will be listed in the generated documentation. This leaves the programmer free to implement functions in @@ -237,9 +294,154 @@ is often used as a kind of ad-hoc interface documentation, with headings, groups of functions, type signatures and declarations in comments. +In the next section we give examples illustrating most of the +structural markup features. After the examples we go into more detail +explaining the related markup, namely :ref:`section-headings`, +:ref:`named-chunks`, and :ref:`re-exporting-entire-module`. + +.. _structure-examples: + +Documentation Structure Examples +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +We now give several examples that produce similar results and +illustrate most of the structural markup features. The first two +example use an export list, but the third example does not. + +The first example, using an export list with :ref:`section-headings` +and inline section descriptions: :: + + module Image + ( -- * Image importers + -- + -- | There is a "smart" importer, 'readImage', that determines + -- the image format from the file extension, and several + -- "dumb" format-specific importers that decode the file at + -- the specified type. + readImage + , readPngImage + , readGifImage + , ... + -- * Image exporters + -- ... + ) where + + import Image.Types ( Image ) + + -- | Read an image, guessing the format from the file name. + readImage :: FilePath -> IO Image + readImage = ... + + -- | Read a GIF. + readGifImage :: FilePath -> IO Image + readGifImage = ... + + -- | Read a PNG. + readPngImage :: FilePath -> IO Image + readPngImage = ... + + ... + +Note that the order of the entities ``readPngImage`` and +``readGifImage`` in the export list is different from the order of the +actual declarations farther down; the order in the export list is the +order used in the generated docs. Also, the imported ``Image`` type +itself is not re-exported, so it will not be included in the rendered +docs (see :ref:`hyperlinking-re-exported`). + +The second example, using an export list with a section description +defined elsewhere (the ``$imageImporters``; see :ref:`named-chunks`): +:: + + module Image + ( -- * Image importers + -- + -- $imageImporters + readImage + , readPngImage + , readGifImage + , ... + -- * Image exporters + -- ... + ) where + + import Image.Types ( Image ) + + -- $imageImporters + -- + -- There is a "smart" importer, 'readImage', that determines the + -- image format from the file extension, and several "dumb" + -- format-specific importers that decode the file at the specified + -- type. + + -- | Read an image, guessing the format from the file name. + readImage :: FilePath -> IO Image + readImage = ... + + -- | Read a GIF. + readGifImage :: FilePath -> IO Image + readGifImage = ... + + -- | Read a PNG. + readPngImage :: FilePath -> IO Image + readPngImage = ... + + ... + +This produces the same rendered docs as the first example, but the +source code itself is arguably more readable, since the documentation +for the group of importer functions is closer to their definitions. + +The third example, without an export list: :: + + module Image where + + import Image.Types ( Image ) + + -- * Image importers + -- + -- $imageImporters + -- + -- There is a "smart" importer, 'readImage', that determines the + -- image format from the file extension, and several "dumb" + -- format-specific importers that decode the file at the specified + -- type. + + -- | Read an image, guessing the format from the file name. + readImage :: FilePath -> IO Image + readImage = ... + + -- | Read a GIF. + readGifImage :: FilePath -> IO Image + readGifImage = ... + + -- | Read a PNG. + readPngImage :: FilePath -> IO Image + readPngImage = ... + + ... + + -- * Image exporters + -- ... + +Note that the section headers (e.g. ``-- * Image importers``) now +appear in the module body itself, and that the section documentation +is still given using :ref:`named-chunks`. Unlike in the first example +when using an export list, the named chunk syntax ``$imageImporters`` +*must* be used for the section documentation; attempting to use the +``-- | ...`` syntax to document the image importers here will wrongly +associate the documentation chunk with the next definition! + +.. _section-headings: + +Section Headings +~~~~~~~~~~~~~~~~ + You can insert headings and sub-headings in the documentation by -including annotations at the appropriate point in the export list. For -example: :: +including annotations at the appropriate point in the export list, or +in the module body directly when not using an export list. + +For example: :: module Foo ( -- * Classes @@ -276,7 +478,31 @@ line is also supported. e.g.: :: , g ) where -Re-exporting an entire module +When not using an export list, you may insert section headers in the +module body. Such section headers associate with all entities +declaried up until the next section header. For example: :: + + module Foo where + + -- * Classes + class C a where ... + + -- * Types + -- ** A data type + data T = ... + + -- ** A record + data R = ... + + -- * Some functions + f :: ... + f = ... + g :: ... + g = ... + +.. _re-exporting-entire-module: + +Re-Exporting an Entire Module ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Haskell allows you to re-export the entire contents of a module (or at @@ -292,8 +518,10 @@ What will the Haddock-generated documentation for this module look like? Well, it depends on how the modules ``B`` and ``C`` are imported. If they are imported wholly and without any ``hiding`` qualifiers, then the documentation will just contain a cross-reference to the documentation -for ``B`` and ``C``. However, if the modules are not *completely* -re-exported, for example: :: +for ``B`` and ``C``. + +However, if the modules are not *completely* re-exported, for example: +:: module A ( module B, @@ -304,48 +532,39 @@ re-exported, for example: :: import C (a, b) then Haddock behaves as if the set of entities re-exported from ``B`` -and ``C`` had been listed explicitly in the export list [2]_. +and ``C`` had been listed explicitly in the export list [#notImplemented]_. + +.. Comment: was this ever implemented? Perhaps this part of the docs + should just be removed until it is implemented? -.. [2] - NOTE: this is not fully implemented at the time of writing (version - 0.2). At the moment, Haddock always inserts a cross-reference. +.. [#notImplemented] This is not implemented at the time of writing + (Haddock version 2.17.3 with GHC 8.0.2). At the moment, Haddock + always inserts a module cross-reference. The exception to this rule is when the re-exported module is declared -with the ``hide`` attribute (:ref:`module-attrs`), in which case the module is +with the ``hide`` attribute (see :ref:`module-attrs`), in which +case the module is never cross-referenced; the contents are always expanded in place in the re-exporting module. -Omitting the export list -~~~~~~~~~~~~~~~~~~~~~~~~ - -If there is no export list in the module, how does Haddock generate -documentation? Well, when the export list is omitted, e.g.: :: - - module Foo where - -this is equivalent to an export list which mentions every entity defined -at the top level in this module, and Haddock treats it in the same way. -Furthermore, the generated documentation will retain the order in which -entities are defined in the module. In this special case the module body -may also include section headings (normally they would be ignored by -Haddock). :: +.. _named-chunks: - module Foo where - - -- * This heading will now appear before foo. - - -- | Documentation for 'foo'. - foo :: Integer - foo = 5 +(Named) Chunks of Documentation +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Named chunks of documentation ------------------------------ +It is often desirable to include a chunk of documentation which is not +attached to any particular Haskell declaration, for example, when +giving summary documentation for a group of related definitions (see +:ref:`structure-examples`). In addition to including such documenation +chunks at the top of the file, as part of the +:ref:`module-description`, you can also associate them with +:ref:`section-headings`. -Occasionally it is desirable to include a chunk of documentation which -is not attached to any particular Haskell declaration. There are two -ways to do this: +There are several ways to associate documentation chunks with section +headings, depending on whether you are using an export list or not: -- The documentation can be included in the export list directly, e.g.: :: +- The documentation can be included in the export list directly, by + preceding it with a ``-- |``. For example: :: module Foo ( -- * A section heading @@ -354,11 +573,13 @@ ways to do this: ... ) where + In this case the chunk is not "named". + - If the documentation is large and placing it inline in the export list might bloat the export list and obscure the structure, then it can be given a name and placed out of line in the body of the module. This is achieved with a special form of documentation annotation - “``-- $``”: :: + ``-- $``, which we call a *named chunk*: :: module Foo ( -- * A section heading @@ -371,11 +592,48 @@ ways to do this: -- Here is a large chunk of documentation which may be referred to by -- the name $doc. - The documentation chunk is given a name, which is the sequence of - alphanumeric characters directly after the “``-- $``”, and it may be - referred to by the same name in the export list. + The documentation chunk is given a name of your choice (here + ``doc``), which is the sequence of alphanumeric characters directly + after the ``-- $``, and it may be referred to by the same name in + the export list. Note that named chunks must come *after* any + imports in the module body. + +- If you aren't using an export list, then your only choice is to use + a named chunk with the ``-- $`` syntax. For example: :: + + module Foo where + + -- * A section heading + -- + -- $doc + -- Here is a large chunk of documentation which may be referred to by + -- the name $doc. + + Just like with entity declariations when not using an export list, + named chunks of documentation are associated with the preceding + section header here, or with the implicit top-level documentation + section if there is no preceding section header. + + **Warning**: the form used in the first bullet above, where the + chunk is not named, *does not work* when you aren't using an + export list. For example :: -Hyperlinking and re-exported entities + module Foo where + + -- * A section heading + -- + -- | Some documentation not attached to a particular Haskell entity + + -- | The fooifier. + foo :: ... + + will result in ``Some documentation not ...`` being attached to + *next* entity declaration, here ``foo``, in addition to any other + documentation that next entity already has! + +.. _hyperlinking-re-exported: + +Hyperlinking and Re-Exported Entities ------------------------------------- When Haddock renders a type in the generated documentation, it @@ -455,26 +713,27 @@ The options and module description can be in either order. The following attributes are currently understood by Haddock: -``hide`` ``hide`` +``hide`` Omit this module from the generated documentation, but nevertheless propagate definitions and documentation from within this module to modules that re-export those definitions. -``hide`` ``prune`` +``prune`` Omit definitions that have no documentation annotations from the generated documentation. -``ignore-exports`` ``ignore-exports`` +``ignore-exports`` Ignore the export list. Generate documentation as if the module had no export list - i.e. all the top-level declarations are exported, and section headings may be given in the body of the module. -``not-home`` ``not-home`` +``not-home`` Indicates that the current module should not be considered to be the home module for each entity it exports, unless that entity is not - exported from any other module. See ? for more details. + exported from any other module. See :ref:`hyperlinking-re-exported` + for more details. -``show-extensions`` ``show-extensions`` +``show-extensions`` Indicates that we should render the extensions used in this module in the resulting documentation. This will only render if the output format supports it. If Language is set, it will be shown as well and @@ -482,6 +741,8 @@ The following attributes are currently understood by Haddock: be rendered, including those implied by their more powerful versions. +.. _markup: + Markup ------ @@ -497,7 +758,7 @@ Paragraphs One or more blank lines separates two paragraphs in a documentation comment. -Special characters +Special Characters ~~~~~~~~~~~~~~~~~~ The following characters have special meanings in documentation @@ -514,7 +775,7 @@ Furthermore, the character sequence ``>>>`` has a special meaning at the beginning of a line. To escape it, just prefix the characters in the sequence with a backslash. -Character references +Character References ~~~~~~~~~~~~~~~~~~~~ Although Haskell source files may contain any character from the Unicode @@ -546,7 +807,9 @@ call these “bird tracks”). For example: :: There is an important difference between the two forms of code block: in the bird-track form, the text to the right of the ‘\ ``>``\ ’ is interpreted literally, whereas the ``@...@`` form interprets markup as -normal inside the code block. +normal inside the code block. In particular, ``/`` is markup for italics, +and so e.g. ``@x / y / z@`` renders as ``x`` followed by italic +``y`` with no slashes, followed by ``z``. Examples ~~~~~~~~ @@ -621,7 +884,7 @@ markup is accepted [3]_: ```T'``. because strictly speaking the ````` character should not be used as a left quote, it is a grave accent. -Emphasis, Bold and Monospaced text +Emphasis, Bold and Monospaced Text ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Emphasis may be added by surrounding text with ``/.../``. Other markup @@ -637,9 +900,10 @@ underscore if you need it bold: Monospaced (or typewriter) text is indicated by surrounding it with ``@...@``. Other markup is valid inside a monospaced span: for example ``@'f' a b@`` will hyperlink the identifier ``f`` inside the code -fragment. +fragment, but ``@__FILE__@`` will render ``FILE`` in bold with no +underscores, which may not be what you had in mind. -Linking to modules +Linking to Modules ~~~~~~~~~~~~~~~~~~ Linking to a module is done by surrounding the module name with double @@ -652,7 +916,7 @@ is valid before turning it into a link but unlike with identifiers, whether the module is in scope isn't checked and will always be turned into a link. -Itemized and Enumerated lists +Itemized and Enumerated Lists ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ A bulleted item is represented by preceding a paragraph with either @@ -732,7 +996,7 @@ which was unexpected. :: * bar -} -Definition lists +Definition Lists ~~~~~~~~~~~~~~~~ Definition lists are written as follows: :: @@ -833,7 +1097,7 @@ and will be removed in the future. Headings ~~~~~~~~ -Headings inside of comment documentation are possible be preceding them +Headings inside of comment documentation are possible by preceding them with a number of ``=``\ s. From 1 to 6 are accepted. Extra ``=``\ s will be treated as belonging to the text of the heading. Note that it's up to the output format to decide how to render the different levels. :: diff --git a/haddock-api/CHANGES.md b/haddock-api/CHANGES.md new file mode 100644 index 00000000..70d575ec --- /dev/null +++ b/haddock-api/CHANGES.md @@ -0,0 +1 @@ +See [`haddock`'s changelog](https://hackage.haskell.org/package/haddock/changelog). diff --git a/haddock-api/haddock-api.cabal b/haddock-api/haddock-api.cabal index 6a3ef944..d86c1c69 100644 --- a/haddock-api/haddock-api.cabal +++ b/haddock-api/haddock-api.cabal @@ -1,19 +1,21 @@ name: haddock-api -version: 2.17.3 +version: 2.18.2 synopsis: A documentation-generation tool for Haskell libraries description: Haddock is a documentation-generation tool for Haskell libraries license: BSD3 license-file: LICENSE author: Simon Marlow, David Waern -maintainer: Simon Hengel <sol@typeful.net>, Mateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk> +maintainer: Alex Biehl <alexbiehl@gmail.com>, Simon Hengel <sol@typeful.net>, Mateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk> homepage: http://www.haskell.org/haddock/ bug-reports: https://github.com/haskell/haddock/issues copyright: (c) Simon Marlow, David Waern category: Documentation build-type: Simple -cabal-version: >= 1.10 -stability: experimental +cabal-version: >= 2.0 + +extra-source-files: + CHANGES.md data-dir: resources @@ -33,30 +35,34 @@ data-files: latex/haddock.sty library - default-language: - Haskell2010 + default-language: Haskell2010 - build-depends: - base >= 4.3 && < 4.11 - , bytestring - , filepath - , directory - , containers - , transformers - , deepseq - , array - , xhtml >= 3000.2 && < 3000.3 - , Cabal >= 1.10 - , ghc-boot - , ghc >= 8.3 && < 8.4 + -- this package typically supports only single major versions + build-depends: base >= 4.10.0 + , Cabal ^>= 2.0.0 + , ghc ^>= 8.3 + , ghc-paths ^>= 0.1.0.9 + , haddock-library ^>= 1.4.6 + , xhtml ^>= 3000.2.2 - , ghc-paths - , haddock-library == 1.4.* + -- Versions for the dependencies below are transitively pinned by + -- the non-reinstallable `ghc` package and hence need no version + -- bounds + build-depends: array + , bytestring + , containers + , deepseq + , directory + , filepath + , ghc-boot + , transformers - hs-source-dirs: - src + hs-source-dirs: src ghc-options: -funbox-strict-fields -Wall -fwarn-tabs -O2 + ghc-options: -Wall + if impl(ghc >= 8.0) + ghc-options: -Wcompat -Wnoncanonical-monad-instances -Wnoncanonical-monadfail-instances exposed-modules: Documentation.Haddock @@ -67,6 +73,7 @@ library Haddock.Interface.Rename Haddock.Interface.Create Haddock.Interface.AttachInstances + Haddock.Interface.Json Haddock.Interface.LexParseRn Haddock.Interface.ParseModuleHeader Haddock.Interface.Specialize @@ -100,6 +107,9 @@ library Haddock.Convert Paths_haddock_api + autogen-modules: + Paths_haddock_api + test-suite spec type: exitcode-stdio-1.0 default-language: Haskell2010 @@ -110,16 +120,29 @@ test-suite spec test , src + -- NB: We only use a small subset of lib:haddock-api here, which + -- explains why this component has a smaller build-depends set other-modules: Haddock.Backends.Hyperlinker.ParserSpec + Haddock.Backends.Hyperlinker.Parser + Haddock.Backends.Hyperlinker.Types build-depends: + ghc ^>= 8.2 + , hspec ^>= 2.4.4 + , QuickCheck ^>= 2.10 + + -- Versions for the dependencies below are transitively pinned by + -- the non-reinstallable `ghc` package and hence need no version + -- bounds + build-depends: base , containers - , ghc - , hspec - , QuickCheck == 2.* + + build-tool-depends: + hspec-discover:hspec-discover ^>= 2.4.4 source-repository head type: git + subdir: haddock-api location: https://github.com/haskell/haddock.git diff --git a/haddock-api/resources/html/Classic.theme/xhaddock.css b/haddock-api/resources/html/Classic.theme/xhaddock.css index 19dc28ec..1bf668e9 100644 --- a/haddock-api/resources/html/Classic.theme/xhaddock.css +++ b/haddock-api/resources/html/Classic.theme/xhaddock.css @@ -285,6 +285,7 @@ div.top h5 { padding: 0 8px 2px 5px; margin-right: -3px; background-color: #f0f0f0; + -moz-user-select: none; } div.subs { diff --git a/haddock-api/resources/html/Ocean.std-theme/ocean.css b/haddock-api/resources/html/Ocean.std-theme/ocean.css index 29af691b..8d3f91a9 100644 --- a/haddock-api/resources/html/Ocean.std-theme/ocean.css +++ b/haddock-api/resources/html/Ocean.std-theme/ocean.css @@ -327,10 +327,6 @@ div#style-menu-holder { } #synopsis { - display: none; -} - -.no-frame #synopsis { display: block; position: fixed; right: 0; @@ -398,6 +394,7 @@ div#style-menu-holder { background: #f0f0f0; padding: 0 0.5em 0.2em; margin: 0 -0.5em 0 0; + -moz-user-select: none; } #interface .src .selflink { border-left: 1px solid #919191; @@ -614,4 +611,8 @@ div#style-menu-holder { float: right; } +:target { + background-color: #ffff00; +} + /* @end */ diff --git a/haddock-api/resources/html/haddock-util.js b/haddock-api/resources/html/haddock-util.js index 92d07d2a..967e2026 100644 --- a/haddock-api/resources/html/haddock-util.js +++ b/haddock-api/resources/html/haddock-util.js @@ -1,7 +1,7 @@ // Haddock JavaScript utilities var rspace = /\s\s+/g, - rtrim = /^\s+|\s+$/g; + rtrim = /^\s+|\s+$/g; function spaced(s) { return (" " + s + " ").replace(rspace, " "); } function trim(s) { return s.replace(rtrim, ""); } @@ -52,17 +52,17 @@ function toggleSection(id) { var b = toggleShow(document.getElementById("section." + id)); toggleCollapser(document.getElementById("control." + id), b); - rememberCollapsed(id, b); + rememberCollapsed(id); return b; } var collapsed = {}; -function rememberCollapsed(id, b) +function rememberCollapsed(id) { - if(b) + if(collapsed[id]) delete collapsed[id] else - collapsed[id] = null; + collapsed[id] = true; var sections = []; for(var i in collapsed) @@ -109,136 +109,6 @@ function getCookie(name) { return null; } - - -var max_results = 75; // 50 is not enough to search for map in the base libraries -var shown_range = null; -var last_search = null; - -function quick_search() -{ - perform_search(false); -} - -function full_search() -{ - perform_search(true); -} - - -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)); - - if (first == -1) - { - table.className = ""; - status.innerHTML = "No results found, displaying all"; - } - else if (first == 0 && last == children.length - 1) - { - table.className = ""; - status.innerHTML = ""; - } - else if (last - first >= max_results && !full) - { - table.className = ""; - status.innerHTML = "More than " + max_results + ", press Search to display"; - } - else - { - // decide what you need to clear/show - if (shown_range) - setclass(shown_range[0], shown_range[1], "indexrow"); - setclass(first, last, "indexshow"); - shown_range = [first, last]; - table.className = "indexsearch"; - status.innerHTML = ""; - } - - - function setclass(first, last, status) - { - for (var i = first; i <= last; i++) - { - 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) - { - var first = 0, finish = children.length - 1; - var mid, success = false; - - while (finish - first > 3) - { - mid = Math.floor((finish + first) / 2); - - var i = checkitem(mid); - if (i == 0) i = dir; - if (i == -1) - finish = mid; - else - first = mid; - } - var a = (dir == 1 ? first : finish); - var b = (dir == 1 ? finish : first); - for (var i = b; i != a - dir; i -= dir) - { - 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) - { - var s = getitem(i).toLowerCase().substr(0, text.length); - if (s == text) return 0; - else return (s > text ? -1 : 1); - } - - - // from an index, get its string - // this abstracts over alternates - function getitem(i) - { - for ( ; i >= 0; i--) - { - var s = children[i].firstChild.firstChild.data; - if (s.indexOf(' ') == -1) - return s; - } - return ""; // should never be reached - } -} - -function setSynopsis(filename) { - 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); - } else { - parent.window.synopsis.location = filename; - } - } -} - function addMenuItem(html) { var menu = document.getElementById("page-menu"); if (menu) { diff --git a/haddock-api/src/Documentation/Haddock.hs b/haddock-api/src/Documentation/Haddock.hs index 1ff5cf75..10d6849a 100644 --- a/haddock-api/src/Documentation/Haddock.hs +++ b/haddock-api/src/Documentation/Haddock.hs @@ -16,6 +16,7 @@ module Documentation.Haddock ( -- * Interface Interface(..), InstalledInterface(..), + toInstalledIface, createInterfaces, processModules, @@ -34,10 +35,12 @@ module Documentation.Haddock ( -- * Documentation comments Doc, + MDoc, DocH(..), Example(..), Hyperlink(..), - DocMarkup(..), + DocMarkup, + DocMarkupH(..), Documentation(..), ArgMap, AliasMap, @@ -67,12 +70,11 @@ module Documentation.Haddock ( withGhc ) where - +import Documentation.Haddock.Markup (markup) import Haddock.InterfaceFile import Haddock.Interface import Haddock.Types import Haddock.Options -import Haddock.Utils import Haddock diff --git a/haddock-api/src/Haddock.hs b/haddock-api/src/Haddock.hs index 080ff926..44dfb7b2 100644 --- a/haddock-api/src/Haddock.hs +++ b/haddock-api/src/Haddock.hs @@ -32,6 +32,7 @@ import Haddock.Backends.LaTeX import Haddock.Backends.Hoogle import Haddock.Backends.Hyperlinker import Haddock.Interface +import Haddock.Interface.Json import Haddock.Parser import Haddock.Types import Haddock.Version @@ -68,12 +69,11 @@ import System.Directory (doesDirectoryExist) import GHC hiding (verbosity) import Config import DynFlags hiding (projectVersion, verbosity) +import ErrUtils import Packages import Panic (handleGhcException) import Module import FastString -import HscTypes -import GhcMonad -------------------------------------------------------------------------------- -- * Exception handling @@ -165,6 +165,11 @@ haddockWithGhc ghc args = handleTopExceptions $ do ghc flags' $ do dflags <- getDynFlags + forM_ (optShowInterfaceFile flags) $ \path -> liftIO $ do + mIfaceFile <- readInterfaceFiles freshNameCache [(("", Nothing), path)] + forM_ mIfaceFile $ \(_, ifaceFile) -> do + putMsg dflags (renderJson (jsonInterfaceFile ifaceFile)) + if not (null files) then do (packages, ifaces, homeLinks) <- readPackagesAndProcessModules flags files @@ -403,12 +408,11 @@ withGhc' libDir flags ghcActs = runGhc (Just libDir) $ do let dynflags'' = unsetPatternMatchWarnings $ updOptLevel 0 $ gopt_unset dynflags' Opt_SplitObjs - defaultCleanupHandler dynflags'' $ do - -- ignore the following return-value, which is a list of packages - -- that may need to be re-linked: Haddock doesn't do any - -- dynamic or static linking at all! - _ <- setSessionDynFlags dynflags'' - ghcActs dynflags'' + -- ignore the following return-value, which is a list of packages + -- that may need to be re-linked: Haddock doesn't do any + -- dynamic or static linking at all! + _ <- setSessionDynFlags dynflags'' + ghcActs dynflags'' where parseGhcFlags :: MonadIO m => DynFlags -> m DynFlags parseGhcFlags dynflags = do @@ -442,15 +446,22 @@ getHaddockLibDir flags = #ifdef IN_GHC_TREE getInTreeDir #else - d <- getDataDir -- provided by Cabal - doesDirectoryExist d >>= \exists -> case exists of - True -> return d - False -> do - -- If directory does not exist then we are probably invoking from - -- ./dist/build/haddock/haddock so we use ./resources as a fallback. - doesDirectoryExist "resources" >>= \exists_ -> case exists_ of - True -> return "resources" - False -> die ("Haddock's resource directory (" ++ d ++ ") does not exist!\n") + -- if data directory does not exist we are probably + -- invoking from either ./haddock-api or ./ + let res_dirs = [ getDataDir -- provided by Cabal + , pure "resources" + , pure "haddock-api/resources" + ] + + check get_path = do + p <- get_path + exists <- doesDirectoryExist p + pure $ if exists then Just p else Nothing + + dirs <- mapM check res_dirs + case [p | Just p <- dirs] of + (p : _) -> return p + _ -> die "Haddock's resource directory does not exist!\n" #endif fs -> return (last fs) @@ -498,7 +509,7 @@ shortcutFlags flags = do when ((Flag_GenIndex `elem` flags || Flag_GenContents `elem` flags) && Flag_Html `elem` flags) $ - throwE "-h cannot be used with --gen-index or --gen-contents" + throwE "-h/--html cannot be used with --gen-index or --gen-contents" when ((Flag_GenIndex `elem` flags || Flag_GenContents `elem` flags) && Flag_Hoogle `elem` flags) $ diff --git a/haddock-api/src/Haddock/Backends/Hoogle.hs b/haddock-api/src/Haddock/Backends/Hoogle.hs index 02430deb..56f8176c 100644 --- a/haddock-api/src/Haddock/Backends/Hoogle.hs +++ b/haddock-api/src/Haddock/Backends/Hoogle.hs @@ -18,10 +18,12 @@ module Haddock.Backends.Hoogle ( import BasicTypes (OverlapFlag(..), OverlapMode(..), SourceText(..)) import InstEnv (ClsInst(..)) +import Documentation.Haddock.Markup import Haddock.GhcUtils import Haddock.Types hiding (Version) import Haddock.Utils hiding (out) +import HsBinds (emptyLHsBinds) import GHC import Outputable import NameSet @@ -157,7 +159,9 @@ pp_sig dflags names (L _ typ) = -- note: does not yet output documentation for class methods ppClass :: DynFlags -> TyClDecl GhcRn -> [(Name, DocForDecl Name)] -> [String] -ppClass dflags decl subdocs = (out dflags decl{tcdSigs=[]} ++ ppTyFams) : ppMethods +ppClass dflags decl subdocs = + (out dflags decl{tcdSigs=[], tcdATs=[], tcdATDefs=[], tcdMeths=emptyLHsBinds} + ++ ppTyFams) : ppMethods where ppMethods = concat . map (ppSig' . unLoc . add_ctxt) $ tcdSigs decl diff --git a/haddock-api/src/Haddock/Backends/Hyperlinker/Ast.hs b/haddock-api/src/Haddock/Backends/Hyperlinker/Ast.hs index 1b39e5e8..759a31d4 100644 --- a/haddock-api/src/Haddock/Backends/Hyperlinker/Ast.hs +++ b/haddock-api/src/Haddock/Backends/Hyperlinker/Ast.hs @@ -1,21 +1,29 @@ +{-# LANGUAGE BangPatterns #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE TypeFamilies #-} - +{-# LANGUAGE TypeApplications #-} module Haddock.Backends.Hyperlinker.Ast (enrich) where -import Haddock.Syb +import qualified Haddock.Syb as Syb import Haddock.Backends.Hyperlinker.Types import qualified GHC import Control.Applicative +import Control.Monad (guard) import Data.Data +import qualified Data.Map.Strict as Map import Data.Maybe +import Prelude hiding (span) + +everythingInRenamedSource :: (Alternative f, Data x) + => (forall a. Data a => a -> f r) -> x -> f r +everythingInRenamedSource f = Syb.everythingButType @GHC.Name (<|>) f -- | Add more detailed information to token stream using GHC API. enrich :: GHC.RenamedSource -> [Token] -> [RichToken] @@ -25,25 +33,45 @@ enrich src = , rtkDetails = enrichToken token detailsMap } where - detailsMap = concatMap ($ src) - [ variables - , types - , decls - , binds - , imports - ] + detailsMap = + mkDetailsMap (concatMap ($ src) + [ variables + , types + , decls + , binds + , imports + ]) + +type LTokenDetails = [(GHC.SrcSpan, TokenDetails)] -- | 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)] +type DetailsMap = Map.Map Position (Span, TokenDetails) + +mkDetailsMap :: [(GHC.SrcSpan, TokenDetails)] -> DetailsMap +mkDetailsMap xs = + Map.fromListWith select_details [ (start, (token_span, token_details)) + | (ghc_span, token_details) <- xs + , Just !token_span <- [ghcSrcSpanToSpan ghc_span] + , let start = spStart token_span + ] + where + -- favour token details which appear earlier in the list + select_details _new old = old lookupBySpan :: Span -> DetailsMap -> Maybe TokenDetails -lookupBySpan tspan = listToMaybe . map snd . filter (matches tspan . fst) +lookupBySpan span details = do + (_, (tok_span, tok_details)) <- Map.lookupLE (spStart span) details + guard (tok_span `containsSpan` span ) + return tok_details + +ghcSrcSpanToSpan :: GHC.SrcSpan -> Maybe Span +ghcSrcSpanToSpan (GHC.RealSrcSpan span) = + Just (Span { spStart = Position (GHC.srcSpanStartLine span) (GHC.srcSpanStartCol span) + , spEnd = Position (GHC.srcSpanEndLine span) (GHC.srcSpanEndCol span) + }) +ghcSrcSpanToSpan _ = Nothing enrichToken :: Token -> DetailsMap -> Maybe TokenDetails enrichToken (Token typ _ spn) dm @@ -51,9 +79,9 @@ enrichToken (Token typ _ spn) dm enrichToken _ _ = Nothing -- | Obtain details map for variables ("normally" used identifiers). -variables :: GHC.RenamedSource -> DetailsMap +variables :: GHC.RenamedSource -> LTokenDetails variables = - everything (<|>) (var `combine` rec) + everythingInRenamedSource (var `Syb.combine` rec) where var term = case cast term of (Just ((GHC.L sspan (GHC.HsVar name)) :: GHC.LHsExpr GHC.GhcRn)) -> @@ -67,9 +95,8 @@ variables = _ -> empty -- | Obtain details map for types. -types :: GHC.RenamedSource -> DetailsMap -types = - everything (<|>) ty +types :: GHC.RenamedSource -> LTokenDetails +types = everythingInRenamedSource ty where ty term = case cast term of (Just ((GHC.L sspan (GHC.HsTyVar _ name)) :: GHC.LHsType GHC.GhcRn)) -> @@ -81,9 +108,10 @@ types = -- 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) + +binds :: GHC.RenamedSource -> LTokenDetails +binds = everythingInRenamedSource + (fun `Syb.combine` pat `Syb.combine` tvar) where fun term = case cast term of (Just (GHC.FunBind (GHC.L sspan name) _ _ _ _ :: GHC.HsBind GHC.GhcRn)) -> @@ -93,7 +121,7 @@ binds = (Just ((GHC.L sspan (GHC.VarPat name)) :: GHC.LPat GHC.GhcRn)) -> pure (sspan, RtkBind (GHC.unLoc name)) (Just (GHC.L _ (GHC.ConPatIn (GHC.L sspan name) recs))) -> - [(sspan, RtkVar name)] ++ everything (<|>) rec recs + [(sspan, RtkVar name)] ++ everythingInRenamedSource rec recs (Just (GHC.L _ (GHC.AsPat (GHC.L sspan name) _))) -> pure (sspan, RtkBind name) _ -> empty @@ -109,11 +137,11 @@ binds = _ -> empty -- | Obtain details map for top-level declarations. -decls :: GHC.RenamedSource -> DetailsMap +decls :: GHC.RenamedSource -> LTokenDetails decls (group, _, _, _) = concatMap ($ group) [ concat . map typ . concat . map GHC.group_tyclds . GHC.hs_tyclds - , everything (<|>) fun . GHC.hs_valds - , everything (<|>) (con `combine` ins) + , everythingInRenamedSource fun . GHC.hs_valds + , everythingInRenamedSource (con `Syb.combine` ins) ] where typ (GHC.L _ t) = case t of @@ -127,7 +155,8 @@ decls (group, _, _, _) = concatMap ($ group) _ -> empty con term = case cast term of (Just (cdcl :: GHC.ConDecl GHC.GhcRn)) -> - map decl (GHC.getConNames cdcl) ++ everything (<|>) fld cdcl + map decl (GHC.getConNames cdcl) + ++ everythingInRenamedSource fld cdcl Nothing -> empty ins term = case cast term of (Just ((GHC.DataFamInstD inst) :: GHC.InstDecl GHC.GhcRn)) @@ -148,9 +177,9 @@ decls (group, _, _, _) = concatMap ($ group) -- -- This map also includes type and variable details for items in export and -- import lists. -imports :: GHC.RenamedSource -> DetailsMap +imports :: GHC.RenamedSource -> LTokenDetails imports src@(_, imps, _, _) = - everything (<|>) ie src ++ mapMaybe (imp . GHC.unLoc) imps + everythingInRenamedSource ie src ++ mapMaybe (imp . GHC.unLoc) imps where ie term = case cast term of (Just ((GHC.IEVar v) :: GHC.IE GHC.GhcRn)) -> pure $ var $ GHC.ieLWrappedName v @@ -165,22 +194,3 @@ imports src@(_, imps, _, _) = 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/Types.hs b/haddock-api/src/Haddock/Backends/Hyperlinker/Types.hs index b27ec4d8..d8ae89e4 100644 --- a/haddock-api/src/Haddock/Backends/Hyperlinker/Types.hs +++ b/haddock-api/src/Haddock/Backends/Hyperlinker/Types.hs @@ -10,7 +10,7 @@ import qualified Data.Map as Map data Token = Token { tkType :: TokenType , tkValue :: String - , tkSpan :: Span + , tkSpan :: {-# UNPACK #-} !Span } deriving (Show) @@ -18,14 +18,20 @@ data Position = Position { posRow :: !Int , posCol :: !Int } - deriving (Show) + deriving (Eq, Ord, Show) data Span = Span - { spStart :: Position - , spEnd :: Position + { spStart :: !Position + , spEnd :: !Position } deriving (Show) +-- | Tests whether the first span "contains" the other span, meaning +-- that it covers at least as much source code. True where spans are equal. +containsSpan :: Span -> Span -> Bool +containsSpan s1 s2 = + spStart s1 <= spStart s2 && spEnd s1 >= spEnd s2 + data TokenType = TkIdentifier | TkKeyword diff --git a/haddock-api/src/Haddock/Backends/LaTeX.hs b/haddock-api/src/Haddock/Backends/LaTeX.hs index 8ca9075b..d4a3012e 100644 --- a/haddock-api/src/Haddock/Backends/LaTeX.hs +++ b/haddock-api/src/Haddock/Backends/LaTeX.hs @@ -16,6 +16,7 @@ module Haddock.Backends.LaTeX ( ) where +import Documentation.Haddock.Markup import Haddock.Types import Haddock.Utils import Haddock.GhcUtils @@ -227,8 +228,8 @@ isExportModule _ = Nothing processExport :: ExportItem DocNameI -> LaTeX processExport (ExportGroup lev _id0 doc) = ppDocGroup lev (docToLaTeX doc) -processExport (ExportDecl decl doc subdocs insts fixities _splice) - = ppDecl decl doc insts subdocs fixities +processExport (ExportDecl decl pats doc subdocs insts fixities _splice) + = ppDecl decl pats doc insts subdocs fixities processExport (ExportNoDecl y []) = ppDocName y processExport (ExportNoDecl y subs) @@ -278,16 +279,17 @@ moduleBasename mdl = map (\c -> if c == '.' then '-' else c) ppDecl :: LHsDecl DocNameI + -> [(HsDecl DocNameI, DocForDecl DocName)] -> DocForDecl DocName -> [DocInstance DocNameI] -> [(DocName, DocForDecl DocName)] -> [(DocName, Fixity)] -> LaTeX -ppDecl (L loc decl) (doc, fnArgsDoc) instances subdocs _fixities = case decl of +ppDecl (L loc decl) pats (doc, fnArgsDoc) instances subdocs _fixities = case decl of TyClD d@(FamDecl {}) -> ppTyFam False loc doc d unicode TyClD d@(DataDecl {}) - -> ppDataDecl instances subdocs loc (Just doc) d unicode + -> ppDataDecl pats instances subdocs loc (Just doc) d unicode TyClD d@(SynDecl {}) -> ppTySyn loc (doc, fnArgsDoc) d unicode -- Family instances happen via FamInst now -- TyClD d@(TySynonym {}) @@ -565,11 +567,11 @@ lookupAnySubdoc n subdocs = case lookup n subdocs of ------------------------------------------------------------------------------- -ppDataDecl :: [DocInstance DocNameI] -> +ppDataDecl :: [(HsDecl DocNameI, DocForDecl DocName)] -> [DocInstance DocNameI] -> [(DocName, DocForDecl DocName)] -> SrcSpan -> Maybe (Documentation DocName) -> TyClDecl DocNameI -> Bool -> LaTeX -ppDataDecl instances subdocs _loc doc dataDecl unicode +ppDataDecl pats instances subdocs _loc doc dataDecl unicode = declWithDoc (ppDataHeader dataDecl unicode <+> whereBit) (if null body then Nothing else Just (vcat body)) @@ -579,10 +581,12 @@ ppDataDecl instances subdocs _loc doc dataDecl unicode cons = dd_cons (tcdDataDefn dataDecl) resTy = (unLoc . head) cons - body = catMaybes [constrBit, doc >>= documentationToLaTeX] + body = catMaybes [constrBit,patternBit, doc >>= documentationToLaTeX] (whereBit, leaders) - | null cons = (empty,[]) + | null cons + , null pats = (empty,[]) + | null cons = (decltt (keyword "where"), repeat empty) | otherwise = case resTy of ConDeclGADT{} -> (decltt (keyword "where"), repeat empty) _ -> (empty, (decltt (text "=") : repeat (decltt (text "|")))) @@ -594,6 +598,19 @@ ppDataDecl instances subdocs _loc doc dataDecl unicode vcat (zipWith (ppSideBySideConstr subdocs unicode) leaders cons) $$ text "\\end{tabulary}\\par" + patternBit + | null cons = Nothing + | otherwise = Just $ + text "\\haddockbeginconstrs" $$ + vcat [ hsep [ keyword "pattern" + , hsep $ punctuate comma $ map (ppDocBinder . unLoc) lnames + , dcolon unicode + , ppLType unicode (hsSigType ty) + ] <-> rDoc (fmap _doc . combineDocumentation . fst $ d) + | (SigD (PatSynSig lnames ty),d) <- pats + ] $$ + text "\\end{tabulary}\\par" + instancesBit = ppDocInstances unicode instances diff --git a/haddock-api/src/Haddock/Backends/Xhtml.hs b/haddock-api/src/Haddock/Backends/Xhtml.hs index 4a3562ae..7fbf9bb4 100644 --- a/haddock-api/src/Haddock/Backends/Xhtml.hs +++ b/haddock-api/src/Haddock/Backends/Xhtml.hs @@ -109,8 +109,8 @@ copyHtmlBits odir libdir themes = do return () -headHtml :: String -> Maybe String -> Themes -> Maybe String -> Html -headHtml docTitle miniPage themes mathjax_url = +headHtml :: String -> Themes -> Maybe String -> Html +headHtml docTitle themes mathjax_url = header << [ meta ! [httpequiv "Content-Type", content "text/html; charset=UTF-8"], thetitle << docTitle, @@ -119,15 +119,12 @@ headHtml docTitle miniPage themes mathjax_url = script ! [src mjUrl, thetype "text/javascript"] << noHtml, script ! [thetype "text/javascript"] -- NB: Within XHTML, the content of script tags needs to be - -- a <![CDATA[ section. Will break if the miniPage name could - -- have "]]>" in it! - << primHtml ( - "//<![CDATA[\nwindow.onload = function () {pageLoad();" - ++ setSynopsis ++ "};\n//]]>\n") + -- a <![CDATA[ section. + << primHtml + "//<![CDATA[\nwindow.onload = function () {pageLoad();};\n//]]>\n" ] where - setSynopsis = maybe "" (\p -> "setSynopsis(\"" ++ p ++ "\");") miniPage - mjUrl = maybe "https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" id mathjax_url + mjUrl = maybe "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" id mathjax_url srcButton :: SourceURLs -> Maybe Interface -> Maybe Html @@ -272,7 +269,7 @@ ppHtmlContents dflags odir doctitle _maybe_package | iface <- ifaces , instIsSig iface] html = - headHtml doctitle Nothing themes mathjax_url +++ + headHtml doctitle themes mathjax_url +++ bodyHtml doctitle Nothing maybe_source_url maybe_wiki_url Nothing maybe_index_url << [ @@ -373,7 +370,7 @@ ppHtmlIndex odir doctitle _maybe_package themes where indexPage showLetters ch items = - headHtml (doctitle ++ " (" ++ indexName ch ++ ")") Nothing themes maybe_mathjax_url +++ + headHtml (doctitle ++ " (" ++ indexName ch ++ ")") themes maybe_mathjax_url +++ bodyHtml doctitle Nothing maybe_source_url maybe_wiki_url maybe_contents_url Nothing << [ @@ -495,7 +492,7 @@ ppHtmlModule odir doctitle themes = toHtml mdl_str real_qual = makeModuleQual qual aliases mdl html = - headHtml mdl_str_annot (Just $ "mini_" ++ moduleHtmlFile mdl) themes maybe_mathjax_url +++ + headHtml mdl_str_annot themes maybe_mathjax_url +++ bodyHtml doctitle (Just iface) maybe_source_url maybe_wiki_url maybe_contents_url maybe_index_url << [ @@ -505,23 +502,10 @@ ppHtmlModule odir doctitle themes createDirectoryIfMissing True odir writeFile (joinPath [odir, moduleHtmlFile mdl]) (renderToString debug html) - ppHtmlModuleMiniSynopsis odir doctitle themes maybe_mathjax_url iface unicode real_qual debug signatureDocURL :: String signatureDocURL = "https://wiki.haskell.org/Module_signature" -ppHtmlModuleMiniSynopsis :: FilePath -> String -> Themes - -> Maybe String -> Interface -> Bool -> Qualification -> Bool -> IO () -ppHtmlModuleMiniSynopsis odir _doctitle themes maybe_mathjax_url iface unicode qual debug = do - let mdl = ifaceMod iface - html = - headHtml (moduleString mdl) Nothing themes maybe_mathjax_url +++ - miniBody << - (divModuleHeader << sectionName << moduleString mdl +++ - miniSynopsis mdl iface unicode qual) - createDirectoryIfMissing True odir - writeFile (joinPath [odir, "mini_" ++ moduleHtmlFile mdl]) (renderToString debug html) - ifaceToHtml :: SourceURLs -> WikiURLs -> Interface -> Bool -> Qualification -> Html ifaceToHtml maybe_source_url maybe_wiki_url iface unicode qual @@ -573,43 +557,6 @@ ifaceToHtml maybe_source_url maybe_wiki_url iface unicode qual linksInfo = (maybe_source_url, maybe_wiki_url) -miniSynopsis :: Module -> Interface -> Bool -> Qualification -> Html -miniSynopsis mdl iface unicode qual = - divInterface << concatMap (processForMiniSynopsis mdl unicode qual) exports - where - exports = numberSectionHeadings (ifaceRnExportItems iface) - - -processForMiniSynopsis :: Module -> Bool -> Qualification -> ExportItem DocNameI - -> [Html] -processForMiniSynopsis mdl unicode qual ExportDecl { expItemDecl = L _loc decl0 } = - ((divTopDecl <<).(declElem <<)) <$> case decl0 of - TyClD d -> let b = ppTyClBinderWithVarsMini mdl d in case d of - (FamDecl decl) -> [ppTyFamHeader True False decl unicode qual] - (DataDecl{}) -> [keyword "data" <+> b] - (SynDecl{}) -> [keyword "type" <+> b] - (ClassDecl {}) -> [keyword "class" <+> b] - SigD (TypeSig lnames _) -> - map (ppNameMini Prefix mdl . nameOccName . getName . unLoc) lnames - _ -> [] -processForMiniSynopsis _ _ qual (ExportGroup lvl _id txt) = - [groupTag lvl << docToHtml Nothing qual (mkMeta txt)] -processForMiniSynopsis _ _ _ _ = [] - - -ppNameMini :: Notation -> Module -> OccName -> Html -ppNameMini notation mdl nm = - anchor ! [ href (moduleNameUrl mdl nm) - , target mainFrameName ] - << ppBinder' notation nm - - -ppTyClBinderWithVarsMini :: Module -> TyClDecl DocNameI -> Html -ppTyClBinderWithVarsMini mdl decl = - let n = tcdName decl - ns = tyvarNames $ tcdTyVars decl -- it's safe to use tcdTyVars, see code above - in ppTypeApp n [] ns (\is_infix -> ppNameMini is_infix mdl . nameOccName . getName) ppTyName - ppModuleContents :: Qualification -> [ExportItem DocNameI] -> Bool -- ^ Orphans sections @@ -659,8 +606,8 @@ processExport :: Bool -> LinksInfo -> Bool -> Qualification processExport _ _ _ _ ExportDecl { expItemDecl = L _ (InstD _) } = Nothing -- Hide empty instances processExport summary _ _ qual (ExportGroup lev id0 doc) = nothingIf summary $ groupHeading lev id0 << docToHtml (Just id0) qual (mkMeta doc) -processExport summary links unicode qual (ExportDecl decl doc subdocs insts fixities splice) - = processDecl summary $ ppDecl summary links decl doc insts fixities subdocs splice unicode qual +processExport summary links unicode qual (ExportDecl decl pats doc subdocs insts fixities splice) + = processDecl summary $ ppDecl summary links decl pats doc insts fixities subdocs splice unicode qual processExport summary _ _ qual (ExportNoDecl y []) = processDeclOneLiner summary $ ppDocName qual Prefix True y processExport summary _ _ qual (ExportNoDecl y subs) diff --git a/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs b/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs index 2d9d7392..59ad41e4 100644 --- a/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs +++ b/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs @@ -41,11 +41,12 @@ import BooleanFormula import RdrName ( rdrNameOcc ) ppDecl :: Bool -> LinksInfo -> LHsDecl DocNameI - -> DocForDecl DocName -> [DocInstance DocNameI] -> [(DocName, Fixity)] + -> [(HsDecl DocNameI, DocForDecl DocName)] + -> DocForDecl DocName -> [DocInstance DocNameI] -> [(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 +ppDecl summ links (L loc decl) pats (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@(DataDecl {}) -> ppDataDecl summ links instances fixities subdocs loc mbDoc d pats 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 @@ -70,9 +71,9 @@ ppFunSig :: Bool -> LinksInfo -> SrcSpan -> DocForDecl DocName -> Splice -> Unicode -> Qualification -> Html ppFunSig summary links loc doc docnames typ fixities splice unicode qual = ppSigLike summary links loc mempty doc docnames fixities (unLoc typ, pp_typ) - splice unicode qual + splice unicode qual HideEmptyContexts where - pp_typ = ppLType unicode qual typ + pp_typ = ppLType unicode qual HideEmptyContexts typ ppLPatSig :: Bool -> LinksInfo -> SrcSpan -> DocForDecl DocName -> [Located DocName] -> LHsSigType DocNameI -> @@ -86,20 +87,20 @@ ppLPatSig summary links loc (doc, _argDocs) docnames typ fixities splice unicode pref1 = hsep [ keyword "pattern" , hsep $ punctuate comma $ map (ppBinder summary . getOccName) docnames , dcolon unicode - , ppLType unicode qual (hsSigType typ) + , ppPatSigType unicode qual (hsSigType typ) ] ppSigLike :: Bool -> LinksInfo -> SrcSpan -> Html -> DocForDecl DocName -> [DocName] -> [(DocName, Fixity)] -> (HsType DocNameI, Html) -> - Splice -> Unicode -> Qualification -> Html + Splice -> Unicode -> Qualification -> HideEmptyContexts -> Html ppSigLike summary links loc leader doc docnames fixities (typ, pp_typ) - splice unicode qual = + splice unicode qual emptyCtxts = ppTypeOrFunSig summary links loc docnames typ doc ( addFixities $ leader <+> ppTypeSig summary occnames pp_typ unicode , addFixities . concatHtml . punctuate comma $ map (ppBinder False) occnames , dcolon unicode ) - splice unicode qual + splice unicode qual emptyCtxts where occnames = map (nameOccName . getName) docnames addFixities html @@ -109,8 +110,8 @@ ppSigLike summary links loc leader doc docnames fixities (typ, pp_typ) ppTypeOrFunSig :: Bool -> LinksInfo -> SrcSpan -> [DocName] -> HsType DocNameI -> DocForDecl DocName -> (Html, Html, Html) - -> Splice -> Unicode -> Qualification -> Html -ppTypeOrFunSig summary links loc docnames typ (doc, argDocs) (pref1, pref2, sep) splice unicode qual + -> Splice -> Unicode -> Qualification -> HideEmptyContexts -> Html +ppTypeOrFunSig summary links loc docnames typ (doc, argDocs) (pref1, pref2, sep) splice unicode qual emptyCtxts | summary = pref1 | Map.null argDocs = topDeclElem links loc splice docnames pref1 +++ docSection curName qual doc | otherwise = topDeclElem links loc splice docnames pref2 +++ @@ -131,14 +132,14 @@ ppTypeOrFunSig summary links loc docnames typ (doc, argDocs) (pref1, pref2, sep) | null (unLoc lctxt) = do_largs n leader ltype | otherwise - = (leader <+> ppLContextNoArrow lctxt unicode qual, Nothing, []) + = (leader <+> ppLContextNoArrow lctxt unicode qual emptyCtxts, Nothing, []) : do_largs n (darrow unicode) ltype do_args n leader (HsFunTy lt r) - = (leader <+> ppLFunLhType unicode qual lt, argDoc n, []) + = (leader <+> ppLFunLhType unicode qual emptyCtxts lt, argDoc n, []) : do_largs (n+1) (arrow unicode) r do_args n leader t - = [(leader <+> ppType unicode qual t, argDoc n, [])] + = [(leader <+> ppType unicode qual emptyCtxts t, argDoc n, [])] ppForAll :: [LHsTyVarBndr DocNameI] -> Unicode -> Qualification -> Html ppForAll tvs unicode qual = @@ -171,8 +172,8 @@ ppFixities fs qual = foldr1 (+++) (map ppFix uniq_fs) +++ rightEdge -- | Pretty-print type variables. -ppTyVars :: [LHsTyVarBndr DocNameI] -> [Html] -ppTyVars tvs = map (ppTyName . getName . hsLTyVarName) tvs +ppTyVars :: Unicode -> Qualification -> [LHsTyVarBndr DocNameI] -> [Html] +ppTyVars unicode qual tvs = map (ppHsTyVarBndr unicode qual . unLoc) tvs tyvarNames :: LHsQTyVars DocNameI -> [Name] tyvarNames = map (getName . hsLTyVarName) . hsQTvExplicit @@ -196,11 +197,11 @@ ppTySyn summary links fixities loc doc (SynDecl { tcdLName = L _ name, tcdTyVars splice unicode qual = ppTypeOrFunSig summary links loc [name] (unLoc ltype) doc (full <+> fixs, hdr <+> fixs, spaceHtml +++ equals) - splice unicode qual + splice unicode qual ShowEmptyToplevelContexts where hdr = hsep ([keyword "type", ppBinder summary occ] - ++ ppTyVars (hsQTvExplicit ltyvars)) - full = hdr <+> equals <+> ppLType unicode qual ltype + ++ ppTyVars unicode qual (hsQTvExplicit ltyvars)) + full = hdr <+> equals <+> ppPatSigType unicode qual ltype occ = nameOccName . getName $ name fixs | summary = noHtml @@ -219,14 +220,14 @@ ppTyName :: Name -> Html ppTyName = ppName Prefix -ppSimpleSig :: LinksInfo -> Splice -> Unicode -> Qualification -> SrcSpan +ppSimpleSig :: LinksInfo -> Splice -> Unicode -> Qualification -> HideEmptyContexts -> SrcSpan -> [DocName] -> HsType DocNameI -> Html -ppSimpleSig links splice unicode qual loc names typ = +ppSimpleSig links splice unicode qual emptyCtxts loc names typ = topDeclElem' names $ ppTypeSig True occNames ppTyp unicode where topDeclElem' = topDeclElem links loc splice - ppTyp = ppType unicode qual typ + ppTyp = ppType unicode qual emptyCtxts typ occNames = map getOccName names @@ -320,7 +321,7 @@ ppTyFam summary associated links instances fixities loc doc decl splice unicode ppTyFamEqn TyFamEqn { tfe_tycon = n, tfe_rhs = rhs , tfe_pats = HsIB { hsib_body = ts }} = ( ppAppNameTypes (unLoc n) [] (map unLoc ts) unicode qual - <+> equals <+> ppType unicode qual (unLoc rhs) + <+> equals <+> ppType unicode qual HideEmptyContexts (unLoc rhs) , Nothing, [] ) @@ -353,20 +354,20 @@ ppAssocType summ links doc (L loc decl) fixities splice unicode qual = -- | Print a type family and its variables ppFamDeclBinderWithVars :: Bool -> Unicode -> Qualification -> FamilyDecl DocNameI -> Html ppFamDeclBinderWithVars summ unicode qual (FamilyDecl { fdLName = lname, fdTyVars = tvs }) = - ppAppDocNameTyVarBndrs summ unicode qual (unLoc lname) (map unLoc $ hsq_explicit tvs) + ppAppDocNameTyVarBndrs summ unicode qual (unLoc lname) (hsq_explicit tvs) -- | Print a newtype / data binder and its variables -ppDataBinderWithVars :: Bool -> TyClDecl DocNameI -> Html -ppDataBinderWithVars summ decl = - ppAppDocNameNames summ (tcdName decl) (tyvarNames $ tcdTyVars decl) +ppDataBinderWithVars :: Bool -> Unicode -> Qualification -> TyClDecl DocNameI -> Html +ppDataBinderWithVars summ unicode qual decl = + ppAppDocNameTyVarBndrs summ unicode qual (tcdName decl) (hsQTvExplicit $ tcdTyVars decl) -------------------------------------------------------------------------------- -- * Type applications -------------------------------------------------------------------------------- -ppAppDocNameTyVarBndrs :: Bool -> Unicode -> Qualification -> DocName -> [HsTyVarBndr DocNameI] -> Html +ppAppDocNameTyVarBndrs :: Bool -> Unicode -> Qualification -> DocName -> [LHsTyVarBndr DocNameI] -> Html ppAppDocNameTyVarBndrs summ unicode qual n vs = - ppTypeApp n [] vs ppDN (ppHsTyVarBndr unicode qual) + ppTypeApp n [] vs ppDN (ppHsTyVarBndr unicode qual . unLoc) where ppDN notation = ppBinderFixity notation summ . nameOccName . getName ppBinderFixity Infix = ppBinderInfix @@ -376,18 +377,9 @@ ppAppDocNameTyVarBndrs summ unicode qual n vs = ppAppNameTypes :: DocName -> [HsType DocNameI] -> [HsType DocNameI] -> Unicode -> Qualification -> Html ppAppNameTypes n ks ts unicode qual = - ppTypeApp n ks ts (\p -> ppDocName qual p True) (ppParendType unicode qual) + ppTypeApp n ks ts (\p -> ppDocName qual p True) (ppParendType unicode qual HideEmptyContexts) --- | Print an application of a 'DocName' and a list of 'Names' -ppAppDocNameNames :: Bool -> DocName -> [Name] -> Html -ppAppDocNameNames summ n ns = - ppTypeApp n [] ns ppDN ppTyName - where - ppDN notation = ppBinderFixity notation summ . nameOccName . getName - ppBinderFixity Infix = ppBinderInfix - ppBinderFixity _ = ppBinder - -- | General printing of type applications ppTypeApp :: DocName -> [a] -> [a] -> (Notation -> DocName -> Html) -> (a -> Html) -> Html ppTypeApp n [] (t1:t2:rest) ppDN ppT @@ -406,32 +398,35 @@ ppTypeApp n ks ts ppDN ppT = ppDN Prefix n <+> hsep (map ppT $ ks ++ ts) ppLContext, ppLContextNoArrow :: Located (HsContext DocNameI) -> Unicode - -> Qualification -> Html + -> Qualification -> HideEmptyContexts -> Html ppLContext = ppContext . unLoc ppLContextNoArrow = ppContextNoArrow . unLoc -ppContextNoArrow :: HsContext DocNameI -> Unicode -> Qualification -> Html -ppContextNoArrow cxt unicode qual = fromMaybe noHtml $ - ppContextNoLocsMaybe (map unLoc cxt) unicode qual +ppContextNoArrow :: HsContext DocNameI -> Unicode -> Qualification -> HideEmptyContexts -> Html +ppContextNoArrow cxt unicode qual emptyCtxts = fromMaybe noHtml $ + ppContextNoLocsMaybe (map unLoc cxt) unicode qual emptyCtxts -ppContextNoLocs :: [HsType DocNameI] -> Unicode -> Qualification -> Html -ppContextNoLocs cxt unicode qual = maybe noHtml (<+> darrow unicode) $ - ppContextNoLocsMaybe cxt unicode qual +ppContextNoLocs :: [HsType DocNameI] -> Unicode -> Qualification -> HideEmptyContexts -> Html +ppContextNoLocs cxt unicode qual emptyCtxts = maybe noHtml (<+> darrow unicode) $ + ppContextNoLocsMaybe cxt unicode qual emptyCtxts -ppContextNoLocsMaybe :: [HsType DocNameI] -> Unicode -> Qualification -> Maybe Html -ppContextNoLocsMaybe [] _ _ = Nothing -ppContextNoLocsMaybe cxt unicode qual = Just $ ppHsContext cxt unicode qual +ppContextNoLocsMaybe :: [HsType DocNameI] -> Unicode -> Qualification -> HideEmptyContexts -> Maybe Html +ppContextNoLocsMaybe [] _ _ emptyCtxts = + case emptyCtxts of + HideEmptyContexts -> Nothing + ShowEmptyToplevelContexts -> Just (toHtml "()") +ppContextNoLocsMaybe cxt unicode qual _ = Just $ ppHsContext cxt unicode qual -ppContext :: HsContext DocNameI -> Unicode -> Qualification -> Html -ppContext cxt unicode qual = ppContextNoLocs (map unLoc cxt) unicode qual +ppContext :: HsContext DocNameI -> Unicode -> Qualification -> HideEmptyContexts -> Html +ppContext cxt unicode qual emptyCtxts = ppContextNoLocs (map unLoc cxt) unicode qual emptyCtxts -ppHsContext :: [HsType DocNameI] -> Unicode -> Qualification-> Html -ppHsContext [] _ _ = noHtml +ppHsContext :: [HsType DocNameI] -> Unicode -> Qualification -> Html +ppHsContext [] _ _ = noHtml ppHsContext [p] unicode qual = ppCtxType unicode qual p -ppHsContext cxt unicode qual = parenList (map (ppType unicode qual) cxt) +ppHsContext cxt unicode qual = parenList (map (ppType unicode qual HideEmptyContexts) cxt) ------------------------------------------------------------------------------- @@ -444,8 +439,8 @@ ppClassHdr :: Bool -> Located [LHsType DocNameI] -> DocName -> Unicode -> Qualification -> Html ppClassHdr summ lctxt n tvs fds unicode qual = keyword "class" - <+> (if not . null . unLoc $ lctxt then ppLContext lctxt unicode qual else noHtml) - <+> ppAppDocNameNames summ n (tyvarNames tvs) + <+> (if not . null . unLoc $ lctxt then ppLContext lctxt unicode qual HideEmptyContexts else noHtml) + <+> ppAppDocNameTyVarBndrs summ unicode qual n (hsQTvExplicit tvs) <+> ppFds fds unicode qual @@ -529,9 +524,8 @@ ppClassDecl summary links instances fixities loc d subdocs , f@(n',_) <- fixities , n == n' ] names = map unLoc lnames ] - -- FIXME: is taking just the first name ok? Is it possible that - -- there are different subdocs for different names in a single - -- type signature? + -- N.B. taking just the first name is ok. Signatures with multiple names + -- are expanded so that each name gets its own signature. minimalBit = case [ s | MinimalSig _ (L _ s) <- sigs ] of -- Miminal complete definition = every shown method @@ -601,7 +595,7 @@ ppInstHead :: LinksInfo -> Splice -> Unicode -> Qualification ppInstHead links splice unicode qual mdoc origin orphan no ihd@(InstHead {..}) = case ihdInstType of ClassInst { .. } -> - ( subInstHead iid $ ppContextNoLocs clsiCtx unicode qual <+> typ + ( subInstHead iid $ ppContextNoLocs clsiCtx unicode qual HideEmptyContexts <+> typ , mdoc , [subInstDetails iid ats sigs] ) @@ -616,14 +610,14 @@ ppInstHead links splice unicode qual mdoc origin orphan no ihd@(InstHead {..}) = where ptype = keyword "type" <+> typ prhs = ptype <+> maybe noHtml - (\t -> equals <+> ppType unicode qual t) rhs + (\t -> equals <+> ppType unicode qual HideEmptyContexts t) rhs DataInst dd -> ( subInstHead iid pdata , mdoc , [subFamInstDetails iid pdecl]) where pdata = keyword "data" <+> typ - pdecl = pdata <+> ppShortDataDecl False True dd unicode qual + pdecl = pdata <+> ppShortDataDecl False True dd [] unicode qual where iid = instanceId origin no orphan ihd typ = ppAppNameTypes ihdClsName ihdKinds ihdTypes unicode qual @@ -644,8 +638,10 @@ ppInstanceSigs :: LinksInfo -> Splice -> Unicode -> Qualification ppInstanceSigs links splice unicode qual sigs = do TypeSig lnames typ <- sigs let names = map unLoc lnames - L loc rtyp = hsSigWcType typ - return $ ppSimpleSig links splice unicode qual loc names rtyp + L _ rtyp = hsSigWcType typ + -- Instance methods signatures are synified and thus don't have a useful + -- SrcSpan value. Use the methods name location instead. + return $ ppSimpleSig links splice unicode qual HideEmptyContexts (getLoc $ head $ lnames) names rtyp lookupAnySubdoc :: Eq id1 => id1 -> [(id1, DocForDecl id2)] -> DocForDecl id2 @@ -672,20 +668,23 @@ instanceId origin no orphan ihd = concat $ -- TODO: print contexts -ppShortDataDecl :: Bool -> Bool -> TyClDecl DocNameI -> Unicode -> Qualification -> Html -ppShortDataDecl summary dataInst dataDecl unicode qual +ppShortDataDecl :: Bool -> Bool -> TyClDecl DocNameI + -> [(HsDecl DocNameI, DocForDecl DocName)] + -> Unicode -> Qualification -> Html +ppShortDataDecl summary dataInst dataDecl pats unicode qual - | [] <- cons = dataHeader + | [] <- cons + , [] <- pats = dataHeader - | [lcon] <- cons, isH98, + | [lcon] <- cons, [] <- pats, isH98, (cHead,cBody,cFoot) <- ppShortConstrParts summary dataInst (unLoc lcon) unicode qual = (dataHeader <+> equals <+> cHead) +++ cBody +++ cFoot - | isH98 = dataHeader - +++ shortSubDecls dataInst (zipWith doConstr ('=':repeat '|') cons) + | [] <- pats, isH98 = dataHeader + +++ shortSubDecls dataInst (zipWith doConstr ('=':repeat '|') cons ++ pats1) | otherwise = (dataHeader <+> keyword "where") - +++ shortSubDecls dataInst (map doGADTConstr cons) + +++ shortSubDecls dataInst (map doGADTConstr cons ++ pats1) where dataHeader @@ -699,16 +698,25 @@ ppShortDataDecl summary dataInst dataDecl unicode qual ConDeclH98 {} -> True ConDeclGADT{} -> False + pats1 = [ hsep [ keyword "pattern" + , hsep $ punctuate comma $ map (ppBinder summary . getOccName) lnames + , dcolon unicode + , ppPatSigType unicode qual (hsSigType typ) + ] + | (SigD (PatSynSig lnames typ),_) <- pats + ] + ppDataDecl :: Bool -> LinksInfo -> [DocInstance DocNameI] -> [(DocName, Fixity)] -> [(DocName, DocForDecl DocName)] -> SrcSpan -> Documentation DocName -> TyClDecl DocNameI -> + [(HsDecl DocNameI, DocForDecl DocName)] -> Splice -> Unicode -> Qualification -> Html -ppDataDecl summary links instances fixities subdocs loc doc dataDecl +ppDataDecl summary links instances fixities subdocs loc doc dataDecl pats splice unicode qual - | summary = ppShortDataDecl summary False dataDecl unicode qual - | otherwise = header_ +++ docSection Nothing qual doc +++ constrBit +++ instancesBit + | summary = ppShortDataDecl summary False dataDecl pats unicode qual + | otherwise = header_ +++ docSection Nothing qual doc +++ constrBit +++ patternBit +++ instancesBit where docname = tcdName dataDecl @@ -723,7 +731,9 @@ ppDataDecl summary links instances fixities subdocs loc doc dataDecl fix = ppFixities (filter (\(n,_) -> n == docname) fixities) qual whereBit - | null cons = noHtml + | null cons + , null pats = noHtml + | null cons = keyword "where" | otherwise = if isH98 then noHtml else keyword "where" constrBit = subConstructors qual @@ -733,6 +743,17 @@ ppDataDecl summary links instances fixities subdocs loc doc dataDecl (map unLoc (getConNames (unLoc c)))) fixities ] + patternBit = subPatterns qual + [ (hsep [ keyword "pattern" + , hsep $ punctuate comma $ map (ppBinder summary . getOccName) lnames + , dcolon unicode + , ppPatSigType unicode qual (hsSigType typ) + ] <+> ppFixities subfixs qual + ,combineDocumentation (fst d), []) + | (SigD (PatSynSig lnames typ),d) <- pats + , let subfixs = filter (\(n,_) -> any (\cn -> cn == n) (map unLoc lnames)) fixities + ] + instancesBit = ppInstances links (OriginData docname) instances splice unicode qual @@ -751,17 +772,17 @@ 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) + : map (ppLParendType unicode qual HideEmptyContexts) args), noHtml, noHtml) RecCon (L _ fields) -> (header_ unicode qual +++ ppOcc <+> char '{', doRecordFields fields, char '}') InfixCon arg1 arg2 -> - (header_ unicode qual +++ hsep [ppLParendType unicode qual arg1, - ppOccInfix, ppLParendType unicode qual arg2], + (header_ unicode qual +++ hsep [ppLParendType unicode qual HideEmptyContexts arg1, + ppOccInfix, ppLParendType unicode qual HideEmptyContexts arg2], noHtml, noHtml) - ConDeclGADT {} -> (ppOcc <+> dcolon unicode <+> ppLType unicode qual resTy,noHtml,noHtml) + ConDeclGADT {} -> (ppOcc <+> dcolon unicode <+> ppLType unicode qual HideEmptyContexts resTy,noHtml,noHtml) where resTy = hsib_body (con_type con) @@ -793,7 +814,7 @@ ppConstrHdr forall_ tvs ctxt unicode qual = (if null tvs then noHtml else ppForall) +++ (if null ctxt then noHtml - else ppContextNoArrow ctxt unicode qual + else ppContextNoArrow ctxt unicode qual HideEmptyContexts <+> darrow unicode +++ toHtml " ") where ppForall | forall_ = forallSymbol unicode <+> hsep (map (ppName Prefix) tvs) @@ -809,15 +830,15 @@ ppSideBySideConstr subdocs fixities unicode qual (L _ con) ConDeclH98{} -> case con_details con of PrefixCon args -> hsep ((header_ +++ ppOcc) - : map (ppLParendType unicode qual) args) + : map (ppLParendType unicode qual HideEmptyContexts) args) <+> fixity RecCon _ -> header_ +++ ppOcc <+> fixity InfixCon arg1 arg2 -> - hsep [header_ +++ ppLParendType unicode qual arg1, + hsep [header_ +++ ppLParendType unicode qual HideEmptyContexts arg1, ppOccInfix, - ppLParendType unicode qual arg2] + ppLParendType unicode qual HideEmptyContexts arg2] <+> fixity ConDeclGADT{} -> doGADTCon resTy @@ -834,7 +855,7 @@ ppSideBySideConstr subdocs fixities unicode qual (L _ con) doGADTCon :: Located (HsType DocNameI) -> Html doGADTCon ty = ppOcc <+> dcolon unicode -- ++AZ++ make this prepend "{..}" when it is a record style GADT - <+> ppLType unicode qual ty + <+> ppLType unicode qual HideEmptyContexts ty <+> fixity fixity = ppFixities fixities qual @@ -861,9 +882,12 @@ ppSideBySideConstr subdocs fixities unicode qual (L _ con) ppSideBySideField :: [(DocName, DocForDecl DocName)] -> Unicode -> Qualification -> ConDeclField DocNameI -> SubDecl ppSideBySideField subdocs unicode qual (ConDeclField names ltype _) = - (hsep (punctuate comma (map ((ppBinder False) . rdrNameOcc . unLoc . rdrNameFieldOcc . unLoc) names)) <+> dcolon unicode <+> ppLType unicode qual ltype, - mbDoc, - []) + ( hsep (punctuate comma (map ((ppBinder False) . rdrNameOcc . unLoc . rdrNameFieldOcc . unLoc) names)) + <+> dcolon unicode + <+> ppLType unicode qual HideEmptyContexts 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 @@ -873,7 +897,7 @@ ppSideBySideField subdocs unicode qual (ConDeclField names ltype _) = ppShortField :: Bool -> Unicode -> Qualification -> ConDeclField DocNameI -> Html ppShortField summary unicode qual (ConDeclField names ltype _) = hsep (punctuate comma (map ((ppBinder summary) . rdrNameOcc . unLoc . rdrNameFieldOcc . unLoc) names)) - <+> dcolon unicode <+> ppLType unicode qual ltype + <+> dcolon unicode <+> ppLType unicode qual HideEmptyContexts ltype -- | Print the LHS of a data\/newtype declaration. @@ -888,9 +912,9 @@ ppDataHeader summary decl@(DataDecl { tcdDataDefn = (case nd of { NewType -> keyword "newtype"; DataType -> keyword "data" }) <+> -- context - ppLContext ctxt unicode qual <+> + ppLContext ctxt unicode qual HideEmptyContexts <+> -- T a b c ..., or a :+: b - ppDataBinderWithVars summary decl + ppDataBinderWithVars summary unicode qual decl <+> case ks of Nothing -> mempty Just (L _ x) -> dcolon unicode <+> ppKind unicode qual x @@ -940,19 +964,18 @@ maybeParen ctxt_prec op_prec p | ctxt_prec >= op_prec = parens p | otherwise = p -ppLType, ppLParendType, ppLFunLhType :: Unicode -> Qualification - -> Located (HsType DocNameI) -> Html -ppLType unicode qual y = ppType unicode qual (unLoc y) -ppLParendType unicode qual y = ppParendType unicode qual (unLoc y) -ppLFunLhType unicode qual y = ppFunLhType unicode qual (unLoc y) +ppLType, ppLParendType, ppLFunLhType :: Unicode -> Qualification -> HideEmptyContexts -> Located (HsType DocNameI) -> Html +ppLType unicode qual emptyCtxts y = ppType unicode qual emptyCtxts (unLoc y) +ppLParendType unicode qual emptyCtxts y = ppParendType unicode qual emptyCtxts (unLoc y) +ppLFunLhType unicode qual emptyCtxts y = ppFunLhType unicode qual emptyCtxts (unLoc y) +ppCtxType :: Unicode -> Qualification -> HsType DocNameI -> Html +ppCtxType unicode qual ty = ppr_mono_ty pREC_CTX ty unicode qual HideEmptyContexts -ppType, ppCtxType, ppParendType, ppFunLhType :: Unicode -> Qualification - -> HsType DocNameI -> Html -ppType unicode qual ty = ppr_mono_ty pREC_TOP ty unicode qual -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 +ppType, ppParendType, ppFunLhType :: Unicode -> Qualification -> HideEmptyContexts -> HsType DocNameI -> Html +ppType unicode qual emptyCtxts ty = ppr_mono_ty pREC_TOP ty unicode qual emptyCtxts +ppParendType unicode qual emptyCtxts ty = ppr_mono_ty pREC_CON ty unicode qual emptyCtxts +ppFunLhType unicode qual emptyCtxts ty = ppr_mono_ty pREC_FUN ty unicode qual emptyCtxts ppHsTyVarBndr :: Unicode -> Qualification -> HsTyVarBndr DocNameI -> Html ppHsTyVarBndr _ qual (UserTyVar (L _ name)) = @@ -965,62 +988,85 @@ ppLKind :: Unicode -> Qualification -> LHsKind DocNameI -> Html ppLKind unicode qual y = ppKind unicode qual (unLoc y) ppKind :: Unicode -> Qualification -> HsKind DocNameI -> Html -ppKind unicode qual ki = ppr_mono_ty pREC_TOP ki unicode qual - -ppForAllPart :: [LHsTyVarBndr DocNameI] -> Unicode -> Html -ppForAllPart tvs unicode = hsep (forallSymbol unicode : ppTyVars tvs) +++ dot - -ppr_mono_lty :: Int -> LHsType DocNameI -> Unicode -> Qualification -> Html +ppKind unicode qual ki = ppr_mono_ty pREC_TOP ki unicode qual HideEmptyContexts + +ppPatSigType :: Unicode -> Qualification -> LHsType DocNameI -> Html +ppPatSigType unicode qual typ = + let emptyCtxts = + if hasNonEmptyContext typ && isFirstContextEmpty typ + then ShowEmptyToplevelContexts + else HideEmptyContexts + in ppLType unicode qual emptyCtxts typ + where + hasNonEmptyContext :: LHsType name -> Bool + hasNonEmptyContext t = + case unLoc t of + HsForAllTy _ s -> hasNonEmptyContext s + HsQualTy cxt s -> if null (unLoc cxt) then hasNonEmptyContext s else True + HsFunTy _ s -> hasNonEmptyContext s + _ -> False + isFirstContextEmpty :: LHsType name -> Bool + isFirstContextEmpty t = + case unLoc t of + HsForAllTy _ s -> isFirstContextEmpty s + HsQualTy cxt _ -> null (unLoc cxt) + HsFunTy _ s -> isFirstContextEmpty s + _ -> False + +ppForAllPart :: Unicode -> Qualification -> [LHsTyVarBndr DocNameI] -> Html +ppForAllPart unicode qual tvs = hsep (forallSymbol unicode : ppTyVars unicode qual tvs) +++ dot + +ppr_mono_lty :: Int -> LHsType DocNameI -> Unicode -> Qualification -> HideEmptyContexts -> Html ppr_mono_lty ctxt_prec ty = ppr_mono_ty ctxt_prec (unLoc ty) -ppr_mono_ty :: Int -> HsType DocNameI -> Unicode -> Qualification -> Html -ppr_mono_ty ctxt_prec (HsForAllTy tvs ty) unicode qual +ppr_mono_ty :: Int -> HsType DocNameI -> Unicode -> Qualification -> HideEmptyContexts -> Html +ppr_mono_ty ctxt_prec (HsForAllTy tvs ty) unicode qual emptyCtxts = maybeParen ctxt_prec pREC_FUN $ - ppForAllPart tvs unicode <+> ppr_mono_lty pREC_TOP ty unicode qual + ppForAllPart unicode qual tvs <+> ppr_mono_lty pREC_TOP ty unicode qual emptyCtxts -ppr_mono_ty ctxt_prec (HsQualTy ctxt ty) unicode qual +ppr_mono_ty ctxt_prec (HsQualTy ctxt ty) unicode qual emptyCtxts = maybeParen ctxt_prec pREC_FUN $ - ppLContext ctxt unicode qual <+> ppr_mono_lty pREC_TOP ty unicode qual + ppLContext ctxt unicode qual emptyCtxts <+> ppr_mono_lty pREC_TOP ty unicode qual emptyCtxts -- UnicodeSyntax alternatives -ppr_mono_ty _ (HsTyVar _ (L _ 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 _ (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 _ (HsSumTy tys) u q = sumParens (map (ppLType u q) tys) -ppr_mono_ty _ (HsKindSig ty kind) u q = - parens (ppr_mono_lty pREC_TOP ty u q <+> dcolon u <+> ppLKind u q kind) -ppr_mono_ty _ (HsListTy ty) u q = brackets (ppr_mono_lty pREC_TOP ty u q) -ppr_mono_ty _ (HsPArrTy ty) u q = pabrackets (ppr_mono_lty pREC_TOP ty u q) -ppr_mono_ty ctxt_prec (HsIParamTy (L _ 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 {}) _ _ = toHtml "{..}" +ppr_mono_ty _ (HsBangTy b ty) u q _ = ppBang b +++ ppLParendType u q HideEmptyContexts ty +ppr_mono_ty _ (HsTyVar _ (L _ name)) _ q _ = ppDocName q Prefix True name +ppr_mono_ty ctxt_prec (HsFunTy ty1 ty2) u q e = ppr_fun_ty ctxt_prec ty1 ty2 u q e +ppr_mono_ty _ (HsTupleTy con tys) u q _ = tupleParens con (map (ppLType u q HideEmptyContexts) tys) +ppr_mono_ty _ (HsSumTy tys) u q _ = sumParens (map (ppLType u q HideEmptyContexts) tys) +ppr_mono_ty _ (HsKindSig ty kind) u q e = + parens (ppr_mono_lty pREC_TOP ty u q e <+> dcolon u <+> ppLKind u q kind) +ppr_mono_ty _ (HsListTy ty) u q _ = brackets (ppr_mono_lty pREC_TOP ty u q HideEmptyContexts) +ppr_mono_ty _ (HsPArrTy ty) u q _ = pabrackets (ppr_mono_lty pREC_TOP ty u q HideEmptyContexts) +ppr_mono_ty ctxt_prec (HsIParamTy (L _ n) ty) u q _ = + maybeParen ctxt_prec pREC_CTX $ ppIPName n <+> dcolon u <+> ppr_mono_lty pREC_TOP ty u q HideEmptyContexts +ppr_mono_ty _ (HsSpliceTy {}) _ _ _ = error "ppr_mono_ty HsSpliceTy" +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 Promoted _ tys) u q = promoQuote $ brackets $ hsep $ punctuate comma $ map (ppLType u q) tys -ppr_mono_ty _ (HsExplicitListTy NotPromoted _ tys) u q = 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 _ (HsCoreTy {}) _ _ _ = error "ppr_mono_ty HsCoreTy" +ppr_mono_ty _ (HsExplicitListTy Promoted _ tys) u q _ = promoQuote $ brackets $ hsep $ punctuate comma $ map (ppLType u q HideEmptyContexts) tys +ppr_mono_ty _ (HsExplicitListTy NotPromoted _ tys) u q _ = brackets $ hsep $ punctuate comma $ map (ppLType u q HideEmptyContexts) tys +ppr_mono_ty _ (HsExplicitTupleTy _ tys) u q _ = promoQuote $ parenList $ map (ppLType u q HideEmptyContexts) tys +ppr_mono_ty _ (HsAppsTy {}) _ _ _ = error "ppr_mono_ty HsAppsTy" -ppr_mono_ty ctxt_prec (HsEqTy ty1 ty2) unicode qual +ppr_mono_ty ctxt_prec (HsEqTy ty1 ty2) unicode qual _ = maybeParen ctxt_prec pREC_CTX $ - ppr_mono_lty pREC_OP ty1 unicode qual <+> char '~' <+> ppr_mono_lty pREC_OP ty2 unicode qual + ppr_mono_lty pREC_OP ty1 unicode qual HideEmptyContexts <+> char '~' <+> ppr_mono_lty pREC_OP ty2 unicode qual HideEmptyContexts -ppr_mono_ty ctxt_prec (HsAppTy fun_ty arg_ty) unicode qual +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] + hsep [ppr_mono_lty pREC_FUN fun_ty unicode qual HideEmptyContexts, ppr_mono_lty pREC_CON arg_ty unicode qual HideEmptyContexts] -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 + ppr_mono_lty pREC_OP ty1 unicode qual HideEmptyContexts <+> ppr_op <+> ppr_mono_lty pREC_OP ty2 unicode qual HideEmptyContexts where -- `(:)` 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. @@ -1029,25 +1075,24 @@ ppr_mono_ty ctxt_prec (HsOpTy ty1 op ty2) unicode qual | otherwise = ppr_op' ppr_op' = ppLDocName qual Infix op -ppr_mono_ty ctxt_prec (HsParTy ty) unicode qual +ppr_mono_ty ctxt_prec (HsParTy ty) unicode qual emptyCtxts -- = parens (ppr_mono_lty pREC_TOP ty) - = ppr_mono_lty ctxt_prec ty unicode qual + = ppr_mono_lty ctxt_prec ty unicode qual emptyCtxts -ppr_mono_ty ctxt_prec (HsDocTy ty _) unicode qual - = ppr_mono_lty ctxt_prec ty unicode qual +ppr_mono_ty ctxt_prec (HsDocTy ty _) unicode qual emptyCtxts + = ppr_mono_lty ctxt_prec ty unicode qual emptyCtxts -ppr_mono_ty _ (HsWildCardTy (AnonWildCard _)) _ _ = char '_' -ppr_mono_ty _ (HsTyLit n) _ _ = ppr_tylit n +ppr_mono_ty _ (HsWildCardTy (AnonWildCard _)) _ _ _ = char '_' +ppr_mono_ty _ (HsTyLit n) _ _ _ = ppr_tylit n ppr_tylit :: HsTyLit -> Html ppr_tylit (HsNumTy _ n) = toHtml (show n) ppr_tylit (HsStrTy _ s) = toHtml (show s) - -ppr_fun_ty :: Int -> LHsType DocNameI -> LHsType DocNameI -> Unicode -> Qualification -> Html -ppr_fun_ty ctxt_prec ty1 ty2 unicode qual - = let p1 = ppr_mono_lty pREC_FUN ty1 unicode qual - p2 = ppr_mono_lty pREC_TOP ty2 unicode qual +ppr_fun_ty :: Int -> LHsType DocNameI -> LHsType DocNameI -> Unicode -> Qualification -> HideEmptyContexts -> Html +ppr_fun_ty ctxt_prec ty1 ty2 unicode qual emptyCtxts + = let p1 = ppr_mono_lty pREC_FUN ty1 unicode qual HideEmptyContexts + p2 = ppr_mono_lty pREC_TOP ty2 unicode qual emptyCtxts in maybeParen ctxt_prec pREC_FUN $ hsep [p1, arrow unicode <+> p2] diff --git a/haddock-api/src/Haddock/Backends/Xhtml/DocMarkup.hs b/haddock-api/src/Haddock/Backends/Xhtml/DocMarkup.hs index e36f9528..18c8a0ff 100644 --- a/haddock-api/src/Haddock/Backends/Xhtml/DocMarkup.hs +++ b/haddock-api/src/Haddock/Backends/Xhtml/DocMarkup.hs @@ -20,6 +20,7 @@ module Haddock.Backends.Xhtml.DocMarkup ( ) where import Data.List +import Documentation.Haddock.Markup import Haddock.Backends.Xhtml.Names import Haddock.Backends.Xhtml.Utils import Haddock.Types diff --git a/haddock-api/src/Haddock/Backends/Xhtml/Layout.hs b/haddock-api/src/Haddock/Backends/Xhtml/Layout.hs index 41457f72..6993c7f6 100644 --- a/haddock-api/src/Haddock/Backends/Xhtml/Layout.hs +++ b/haddock-api/src/Haddock/Backends/Xhtml/Layout.hs @@ -29,6 +29,7 @@ module Haddock.Backends.Xhtml.Layout ( subArguments, subAssociatedTypes, subConstructors, + subPatterns, subEquations, subFields, subInstances, subOrphanInstances, @@ -180,6 +181,9 @@ subAssociatedTypes = divSubDecls "associated-types" "Associated Types" . subBloc subConstructors :: Qualification -> [SubDecl] -> Html subConstructors qual = divSubDecls "constructors" "Constructors" . subTable qual +subPatterns :: Qualification -> [SubDecl] -> Html +subPatterns qual = divSubDecls "bundled-patterns" "Bundled Patterns" . subTable qual + subFields :: Qualification -> [SubDecl] -> Html subFields qual = divSubDecls "fields" "Fields" . subDlist qual diff --git a/haddock-api/src/Haddock/Convert.hs b/haddock-api/src/Haddock/Convert.hs index 2b25174c..36efb3e4 100644 --- a/haddock-api/src/Haddock/Convert.hs +++ b/haddock-api/src/Haddock/Convert.hs @@ -30,7 +30,7 @@ import Name import NameSet ( emptyNameSet ) import RdrName ( mkVarUnqual ) import PatSyn -import SrcLoc ( Located, noLoc, unLoc ) +import SrcLoc ( Located, noLoc, unLoc, GenLocated(..), srcLocSpan ) import TcType ( tcSplitSigmaTy ) import TyCon import Type @@ -319,7 +319,7 @@ synifyDataCon use_gadt_syntax dc = , con_doc = Nothing } synifyName :: NamedThing n => n -> Located Name -synifyName = noLoc . getName +synifyName n = L (srcLocSpan (getSrcLoc n)) (getName n) synifyIdSig :: SynifyTypeState -> Id -> Sig GhcRn diff --git a/haddock-api/src/Haddock/GhcUtils.hs b/haddock-api/src/Haddock/GhcUtils.hs index 83e4dbd8..561c126f 100644 --- a/haddock-api/src/Haddock/GhcUtils.hs +++ b/haddock-api/src/Haddock/GhcUtils.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE FlexibleInstances, ViewPatterns #-} +{-# LANGUAGE BangPatterns, FlexibleInstances, ViewPatterns #-} {-# OPTIONS_GHC -fno-warn-orphans #-} {-# OPTIONS_HADDOCK hide #-} ----------------------------------------------------------------------------- @@ -17,17 +17,14 @@ module Haddock.GhcUtils where import Control.Arrow -import Data.Function import Exception import Outputable import Name +import NameSet import Lexeme import Module -import RdrName (GlobalRdrEnv) -import GhcMonad (withSession) import HscTypes -import UniqFM import GHC import Class @@ -92,6 +89,10 @@ filterSigNames p (ClassOpSig is_default ns ty) = case filter (p . unLoc) ns of [] -> Nothing filtered -> Just (ClassOpSig is_default filtered ty) +filterSigNames p (PatSynSig ns ty) = + case filter (p . unLoc) ns of + [] -> Nothing + filtered -> Just (PatSynSig filtered ty) filterSigNames _ _ = Nothing ifTrueJust :: Bool -> name -> Maybe name @@ -114,6 +115,7 @@ sigNameNoLoc _ = [] isUserLSig :: LSig name -> Bool isUserLSig (L _(TypeSig {})) = True isUserLSig (L _(ClassOpSig {})) = True +isUserLSig (L _(PatSynSig {})) = True isUserLSig _ = False @@ -134,6 +136,17 @@ declATs _ = [] pretty :: Outputable a => DynFlags -> a -> String pretty = showPpr +nubByName :: (a -> Name) -> [a] -> [a] +nubByName f ns = go emptyNameSet ns + where + go !_ [] = [] + go !s (x:xs) + | y `elemNameSet` s = go s xs + | otherwise = let !s' = extendNameSet s y + in x : go s' xs + where + y = f x + ------------------------------------------------------------------------------- -- * Located ------------------------------------------------------------------------------- diff --git a/haddock-api/src/Haddock/Interface.hs b/haddock-api/src/Haddock/Interface.hs index 31991e25..4c7b70d7 100644 --- a/haddock-api/src/Haddock/Interface.hs +++ b/haddock-api/src/Haddock/Interface.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} ----------------------------------------------------------------------------- -- | -- Module : Haddock.Interface @@ -56,6 +57,13 @@ import Exception import GHC hiding (verbosity) import HscTypes import FastString (unpackFS) +import MonadUtils (liftIO) + +#if defined(mingw32_HOST_OS) +import System.IO +import GHC.IO.Encoding.CodePage (mkLocaleEncoding) +import GHC.IO.Encoding.Failure (CodingFailureMode(TransliterateCodingFailure)) +#endif -- | Create 'Interface's and a link environment by typechecking the list of -- modules using the GHC API and processing the resulting syntax trees. @@ -68,6 +76,10 @@ processModules -> Ghc ([Interface], LinkEnv) -- ^ Resulting list of interfaces and renaming -- environment processModules verbosity modules flags extIfaces = do +#if defined(mingw32_HOST_OS) + -- Avoid internal error: <stderr>: hPutChar: invalid argument (invalid character)' non UTF-8 Windows + liftIO $ hSetEncoding stderr $ mkLocaleEncoding TransliterateCodingFailure +#endif out verbosity verbose "Creating interfaces..." let instIfaceMap = Map.fromList [ (instMod iface, iface) | ext <- extIfaces diff --git a/haddock-api/src/Haddock/Interface/AttachInstances.hs b/haddock-api/src/Haddock/Interface/AttachInstances.hs index 1eb227b9..0e5811b1 100644 --- a/haddock-api/src/Haddock/Interface/AttachInstances.hs +++ b/haddock-api/src/Haddock/Interface/AttachInstances.hs @@ -19,14 +19,13 @@ import Haddock.Types import Haddock.Convert import Haddock.GhcUtils +import Control.Applicative import Control.Arrow hiding ((<+>)) import Data.List import Data.Ord (comparing) -import Data.Function (on) import Data.Maybe ( maybeToList, mapMaybe, fromMaybe ) import qualified Data.Map as Map import qualified Data.Set as Set -import Control.Monad import Class import DynFlags @@ -35,7 +34,6 @@ import ErrUtils import FamInstEnv import FastString import GHC -import GhcMonad (withSession) import InstEnv import MonadUtils (liftIO) import Name @@ -118,13 +116,17 @@ attachToExportItem index expInfo iface ifaceMap instIfaceMap export = return $ e { expItemInstances = insts } e -> return e where - attachFixities e@ExportDecl{ expItemDecl = L _ d } = e { expItemFixities = - nubBy ((==) `on` fst) $ expItemFixities e ++ + attachFixities e@ExportDecl{ expItemDecl = L _ d + , expItemPats = patsyns + } = e { expItemFixities = + nubByName fst $ expItemFixities e ++ [ (n',f) | n <- getMainDeclBinder d - , Just subs <- [instLookup instSubMap n iface ifaceMap instIfaceMap] - , n' <- n : subs + , Just subs <- [instLookup instSubMap n iface ifaceMap instIfaceMap <|> Just []] + , n' <- n : (subs ++ patsyn_names) , Just f <- [instLookup instFixMap n' iface ifaceMap instIfaceMap] ] } + where + patsyn_names = concatMap (getMainDeclBinder . fst) patsyns attachFixities e = e -- spanName: attach the location to the name that is the same file as the instance location diff --git a/haddock-api/src/Haddock/Interface/Create.hs b/haddock-api/src/Haddock/Interface/Create.hs index 2b352d90..292680a7 100644 --- a/haddock-api/src/Haddock/Interface/Create.hs +++ b/haddock-api/src/Haddock/Interface/Create.hs @@ -20,6 +20,7 @@ module Haddock.Interface.Create (createInterface) where import Documentation.Haddock.Doc (metaDocAppend) +import Documentation.Haddock.Utf8 as Utf8 import Haddock.Types import Haddock.Options import Haddock.GhcUtils @@ -30,6 +31,8 @@ import Haddock.Backends.Hyperlinker.Types import Haddock.Backends.Hyperlinker.Ast as Hyperlinker import Haddock.Backends.Hyperlinker.Parser as Hyperlinker +import Data.Bitraversable +import qualified Data.ByteString as BS import qualified Data.Map as M import Data.Map (Map) import Data.List @@ -37,10 +40,9 @@ import Data.Maybe import Data.Monoid import Data.Ord import Control.Applicative -import Control.Arrow (second) -import Control.DeepSeq +import Control.Exception (evaluate) import Control.Monad -import Data.Function (on) +import Data.Traversable import qualified Packages import qualified Module @@ -48,6 +50,7 @@ import qualified SrcLoc import GHC import HscTypes import Name +import NameSet import Bag import RdrName import TcRnTypes @@ -76,9 +79,12 @@ createInterface tm flags modMap instIfaceMap = do dflags = ms_hspp_opts ms !instances = modInfoInstances mi !fam_instances = md_fam_insts md - !exportedNames = modInfoExports mi + !exportedNames = modInfoExportsWithSelectors mi - (TcGblEnv {tcg_rdr_env = gre, tcg_warns = warnings}, md) = tm_internals_ tm + (TcGblEnv { tcg_rdr_env = gre + , tcg_warns = warnings + , tcg_patsyns = patsyns + }, md) = tm_internals_ tm -- The renamed source should always be available to us, but it's best -- to be on the safe side. @@ -98,6 +104,27 @@ createInterface tm flags modMap instIfaceMap = do (!info, mbDoc) <- liftErrMsg $ processModuleHeader dflags gre safety mayDocHeader let declsWithDocs = topDecls group_ + + exports0 = fmap (reverse . map unLoc) mayExports + exports + | OptIgnoreExports `elem` opts = Nothing + | otherwise = exports0 + + localBundledPatSyns :: Map Name [Name] + localBundledPatSyns = + case exports of + Nothing -> M.empty + Just ies -> + M.map (nubByName id) $ + M.fromListWith (++) [ (ieWrappedName ty_name, bundled_patsyns) + | IEThingWith (L _ ty_name) _ exported _ <- ies + , let bundled_patsyns = + filter is_patsyn (map (ieWrappedName . unLoc) exported) + , not (null bundled_patsyns) + ] + where + is_patsyn name = elemNameSet name (mkNameSet (map getName patsyns)) + fixMap = mkFixMap group_ (decls, _) = unzip declsWithDocs localInsts = filter (nameIsLocalOrFrom sem_mdl) @@ -106,21 +133,17 @@ createInterface tm flags modMap instIfaceMap = do -- Locations of all TH splices splices = [ l | L l (SpliceD _) <- hsmodDecls hsm ] - maps@(!docMap, !argMap, !subMap, !declMap, _) = - mkMaps dflags gre localInsts declsWithDocs + warningMap <- liftErrMsg (mkWarningMap dflags warnings gre exportedNames) - let exports0 = fmap (reverse . map unLoc) mayExports - exports - | OptIgnoreExports `elem` opts = Nothing - | otherwise = exports0 - warningMap = mkWarningMap dflags warnings gre exportedNames + maps@(!docMap, !argMap, !subMap, !declMap, _) <- + liftErrMsg (mkMaps dflags gre localInsts declsWithDocs) let allWarnings = M.unions (warningMap : map ifaceWarningMap (M.elems modMap)) -- The MAIN functionality: compute the export items which will -- each be the actual documentation of this module. exportItems <- mkExportItems is_sig modMap mdl sem_mdl allWarnings gre exportedNames decls - maps fixMap splices exports instIfaceMap dflags + maps localBundledPatSyns fixMap splices exports instIfaceMap dflags let !visibleNames = mkVisibleNames maps exportItems opts @@ -139,37 +162,39 @@ createInterface tm flags modMap instIfaceMap = do let !aliases = mkAliasMap dflags $ tm_renamed_source tm - modWarn = moduleWarning dflags gre warnings + + modWarn <- liftErrMsg (moduleWarning dflags gre warnings) tokenizedSrc <- mkMaybeTokenizedSrc flags tm return $! Interface { - ifaceMod = mdl - , ifaceIsSig = is_sig - , ifaceOrigFilename = msHsFilePath ms - , ifaceInfo = info - , ifaceDoc = Documentation mbDoc modWarn - , ifaceRnDoc = Documentation Nothing Nothing - , ifaceOptions = opts - , ifaceDocMap = docMap - , ifaceArgMap = argMap - , ifaceRnDocMap = M.empty - , ifaceRnArgMap = M.empty - , ifaceExportItems = prunedExportItems - , ifaceRnExportItems = [] - , ifaceExports = exportedNames - , ifaceVisibleExports = visibleNames - , ifaceDeclMap = declMap - , ifaceSubMap = subMap - , ifaceFixMap = fixMap - , ifaceModuleAliases = aliases - , ifaceInstances = instances - , ifaceFamInstances = fam_instances + ifaceMod = mdl + , ifaceIsSig = is_sig + , ifaceOrigFilename = msHsFilePath ms + , ifaceInfo = info + , ifaceDoc = Documentation mbDoc modWarn + , ifaceRnDoc = Documentation Nothing Nothing + , ifaceOptions = opts + , ifaceDocMap = docMap + , ifaceArgMap = argMap + , ifaceRnDocMap = M.empty + , ifaceRnArgMap = M.empty + , ifaceExportItems = prunedExportItems + , ifaceRnExportItems = [] + , ifaceExports = exportedNames + , ifaceVisibleExports = visibleNames + , ifaceDeclMap = declMap + , ifaceBundledPatSynMap = localBundledPatSyns + , ifaceSubMap = subMap + , ifaceFixMap = fixMap + , ifaceModuleAliases = aliases + , ifaceInstances = instances + , ifaceFamInstances = fam_instances , ifaceOrphanInstances = [] -- Filled in `attachInstances` , ifaceRnOrphanInstances = [] -- Filled in `renameInterface` - , ifaceHaddockCoverage = coverage - , ifaceWarningMap = warningMap - , ifaceTokenizedSrc = tokenizedSrc + , ifaceHaddockCoverage = coverage + , ifaceWarningMap = warningMap + , ifaceTokenizedSrc = tokenizedSrc } -- | Given all of the @import M as N@ declarations in a package, @@ -222,27 +247,29 @@ lookupModuleDyn dflags Nothing mdlName = -- Warnings ------------------------------------------------------------------------------- -mkWarningMap :: DynFlags -> Warnings -> GlobalRdrEnv -> [Name] -> WarningMap +mkWarningMap :: DynFlags -> Warnings -> GlobalRdrEnv -> [Name] -> ErrMsgM WarningMap mkWarningMap dflags warnings gre exps = case warnings of - NoWarnings -> M.empty - WarnAll _ -> M.empty + NoWarnings -> pure M.empty + WarnAll _ -> pure M.empty WarnSome ws -> - let ws' = [ (n, w) | (occ, w) <- ws, elt <- lookupGlobalRdrEnv gre occ + let ws' = [ (n, w) + | (occ, w) <- ws + , elt <- lookupGlobalRdrEnv gre occ , let n = gre_name elt, n `elem` exps ] - in M.fromList $ map (second $ parseWarning dflags gre) ws' + in M.fromList <$> traverse (bitraverse pure (parseWarning dflags gre)) ws' -moduleWarning :: DynFlags -> GlobalRdrEnv -> Warnings -> Maybe (Doc Name) -moduleWarning _ _ NoWarnings = Nothing -moduleWarning _ _ (WarnSome _) = Nothing -moduleWarning dflags gre (WarnAll w) = Just $ parseWarning dflags gre w +moduleWarning :: DynFlags -> GlobalRdrEnv -> Warnings -> ErrMsgM (Maybe (Doc Name)) +moduleWarning _ _ NoWarnings = pure Nothing +moduleWarning _ _ (WarnSome _) = pure Nothing +moduleWarning dflags gre (WarnAll w) = Just <$> parseWarning dflags gre w -parseWarning :: DynFlags -> GlobalRdrEnv -> WarningTxt -> Doc Name -parseWarning dflags gre w = force $ case w of +parseWarning :: DynFlags -> GlobalRdrEnv -> WarningTxt -> ErrMsgM (Doc Name) +parseWarning dflags gre w = case w of 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 + <$> processDocString dflags gre (HsDocString xs) ------------------------------------------------------------------------------- @@ -290,10 +317,15 @@ mkMaps :: DynFlags -> GlobalRdrEnv -> [Name] -> [(LHsDecl GhcRn, [HsDocString])] - -> Maps -mkMaps dflags gre instances decls = - let (a, b, c, d) = unzip4 $ map mappings decls - in (f' $ map (nubBy ((==) `on` fst)) a , f b, f c, f d, instanceMap) + -> ErrMsgM Maps +mkMaps dflags gre instances decls = do + (a, b, c, d) <- unzip4 <$> traverse mappings decls + pure ( f' (map (nubByName fst) a) + , f (filterMapping (not . M.null) b) + , f (filterMapping (not . null) c) + , f (filterMapping (not . null) d) + , instanceMap + ) where f :: (Ord a, Monoid b) => [[(a, b)]] -> Map a b f = M.fromListWith (<>) . concat @@ -301,36 +333,46 @@ mkMaps dflags gre instances decls = f' :: [[(Name, MDoc Name)]] -> Map Name (MDoc Name) f' = M.fromListWith metaDocAppend . concat + filterMapping :: (b -> Bool) -> [[(a, b)]] -> [[(a, b)]] + filterMapping p = map (filter (p . snd)) + mappings :: (LHsDecl GhcRn, [HsDocString]) - -> ( [(Name, MDoc Name)] - , [(Name, Map Int (MDoc Name))] - , [(Name, [Name])] - , [(Name, [LHsDecl GhcRn])] - ) - mappings (ldecl, docStrs) = + -> ErrMsgM ( [(Name, MDoc Name)] + , [(Name, Map Int (MDoc Name))] + , [(Name, [Name])] + , [(Name, [LHsDecl GhcRn])] + ) + mappings (ldecl, docStrs) = do let L l decl = ldecl declDoc :: [HsDocString] -> Map Int HsDocString - -> (Maybe (MDoc Name), Map Int (MDoc Name)) - declDoc strs m = - let doc' = processDocStrings dflags gre strs - m' = M.map (processDocStringParas dflags gre) m - in (doc', m') - (doc, args) = declDoc docStrs (typeDocs decl) + -> ErrMsgM (Maybe (MDoc Name), Map Int (MDoc Name)) + declDoc strs m = do + doc' <- processDocStrings dflags gre strs + m' <- traverse (processDocStringParas dflags gre) m + pure (doc', m') + + (doc, args) <- declDoc docStrs (typeDocs decl) + + let subs :: [(Name, [HsDocString], Map Int HsDocString)] subs = subordinates instanceMap decl - (subDocs, subArgs) = unzip $ map (\(_, strs, m) -> declDoc strs m) subs + + (subDocs, subArgs) <- unzip <$> traverse (\(_, strs, m) -> declDoc strs m) subs + + let ns = names l decl subNs = [ n | (n, _, _) <- subs ] dm = [ (n, d) | (n, Just d) <- zip ns (repeat doc) ++ zip subNs subDocs ] am = [ (n, args) | n <- ns ] ++ zip subNs subArgs sm = [ (n, subNs) | n <- ns ] cm = [ (n, [ldecl]) | n <- ns ++ subNs ] - in seqList ns `seq` - seqList subNs `seq` - doc `seq` - seqList subDocs `seq` - seqList subArgs `seq` - (dm, am, sm, cm) + + seqList ns `seq` + seqList subNs `seq` + doc `seq` + seqList subDocs `seq` + seqList subArgs `seq` + pure (dm, am, sm, cm) instanceMap :: Map SrcSpan Name instanceMap = M.fromList [ (getSrcSpan n, n) | n <- instances ] @@ -359,7 +401,9 @@ mkMaps dflags gre instances decls = -- | Get all subordinate declarations inside a declaration, and their docs. -- A subordinate declaration is something like the associate type or data -- family of a type class. -subordinates :: InstMap -> HsDecl GhcRn -> [(Name, [HsDocString], Map Int HsDocString)] +subordinates :: InstMap + -> HsDecl GhcRn + -> [(Name, [HsDocString], Map Int HsDocString)] subordinates instMap decl = case decl of InstD (ClsInstD d) -> do DataFamInstDecl { dfid_tycon = L l _ @@ -395,8 +439,9 @@ typeDocs :: HsDecl GhcRn -> Map Int HsDocString typeDocs d = let docs = go 0 in case d of - SigD (TypeSig _ ty) -> docs (unLoc (hsSigWcType ty)) - SigD (PatSynSig _ ty) -> docs (unLoc (hsSigType ty)) + SigD (TypeSig _ ty) -> docs (unLoc (hsSigWcType ty)) + SigD (ClassOpSig _ _ ty) -> docs (unLoc (hsSigType ty)) + SigD (PatSynSig _ ty) -> docs (unLoc (hsSigType ty)) ForD (ForeignImport _ ty _ _) -> docs (unLoc (hsSigType ty)) TyClD (SynDecl { tcdRhs = ty }) -> docs (unLoc ty) _ -> M.empty @@ -536,6 +581,7 @@ mkExportItems -> [Name] -- exported names (orig) -> [LHsDecl GhcRn] -- renamed source declarations -> Maps + -> Map Name [Name] -> FixMap -> [SrcSpan] -- splice locations -> Maybe [IE GhcRn] @@ -544,15 +590,21 @@ mkExportItems -> ErrMsgGhc [ExportItem GhcRn] mkExportItems is_sig modMap thisMod semMod warnings gre exportedNames decls - maps@(docMap, argMap, subMap, declMap, instMap) fixMap splices optExports instIfaceMap dflags = + maps@(docMap, argMap, subMap, declMap, instMap) patSynMap fixMap splices optExports instIfaceMap dflags = case optExports of Nothing -> fullModuleContents dflags warnings gre maps fixMap splices decls Just exports -> liftM concat $ mapM lookupExport exports where - lookupExport (IEVar (L _ x)) = declWith $ ieWrappedName x - lookupExport (IEThingAbs (L _ t)) = declWith $ ieWrappedName t - lookupExport (IEThingAll (L _ t)) = declWith $ ieWrappedName t - lookupExport (IEThingWith (L _ t) _ _ _) = declWith $ ieWrappedName t + lookupExport (IEVar (L _ x)) = declWith [] $ ieWrappedName x + lookupExport (IEThingAbs (L _ t)) = declWith [] $ ieWrappedName t + lookupExport (IEThingAll (L _ t)) = do + let name = ieWrappedName t + pats <- findBundledPatterns name + declWith pats name + lookupExport (IEThingWith (L _ t) _ _ _) = do + let name = ieWrappedName t + pats <- findBundledPatterns name + declWith pats name lookupExport (IEModuleContents (L _ m)) = -- TODO: We could get more accurate reporting here if IEModuleContents -- also recorded the actual names that are exported here. We CAN @@ -560,19 +612,23 @@ mkExportItems -- do so. -- NB: Pass in identity module, so we can look it up in index correctly moduleExports thisMod m dflags warnings gre exportedNames decls modMap instIfaceMap maps fixMap splices - lookupExport (IEGroup lev docStr) = return $ - return . ExportGroup lev "" $ processDocString dflags gre docStr + lookupExport (IEGroup lev docStr) = liftErrMsg $ do + doc <- processDocString dflags gre docStr + return [ExportGroup lev "" doc] - lookupExport (IEDoc docStr) = return $ - return . ExportDoc $ processDocStringParas dflags gre docStr + lookupExport (IEDoc docStr) = liftErrMsg $ do + doc <- processDocStringParas dflags gre docStr + return [ExportDoc doc] lookupExport (IEDocNamed str) = liftErrMsg $ - findNamedDoc str [ unL d | d <- decls ] >>= return . \case - Nothing -> [] - Just doc -> return . ExportDoc $ processDocStringParas dflags gre doc - - declWith :: Name -> ErrMsgGhc [ ExportItem GhcRn ] - declWith t = do + findNamedDoc str [ unL d | d <- decls ] >>= \case + Nothing -> return [] + Just docStr -> do + doc <- processDocStringParas dflags gre docStr + return [ExportDoc doc] + + declWith :: [(HsDecl GhcRn, DocForDecl Name)] -> Name -> ErrMsgGhc [ ExportItem GhcRn ] + declWith pats t = do r <- findDecl t case r of ([L l (ValD _)], (doc, _)) -> do @@ -609,15 +665,15 @@ mkExportItems -- fromJust is safe since we already checked in guards -- that 't' is a name declared in this declaration. let newDecl = L loc . SigD . fromJust $ filterSigNames (== t) sig - in return [ mkExportDecl t newDecl docs_ ] + in return [ mkExportDecl t newDecl pats docs_ ] L loc (TyClD cl@ClassDecl{}) -> do mdef <- liftGhcToErrMsgGhc $ minimalDef t let sig = maybeToList $ fmap (noLoc . MinimalSig NoSourceText . noLoc . fmap noLoc) mdef return [ mkExportDecl t - (L loc $ TyClD cl { tcdSigs = sig ++ tcdSigs cl }) docs_ ] + (L loc $ TyClD cl { tcdSigs = sig ++ tcdSigs cl }) pats docs_ ] - _ -> return [ mkExportDecl t decl docs_ ] + _ -> return [ mkExportDecl t decl pats docs_ ] -- Declaration from another package ([], _) -> do @@ -634,24 +690,27 @@ mkExportItems liftErrMsg $ tell ["Warning: Couldn't find .haddock for export " ++ pretty dflags t] let subs_ = [ (n, noDocForDecl) | (n, _, _) <- subordinates instMap (unLoc decl) ] - return [ mkExportDecl t decl (noDocForDecl, subs_) ] + return [ mkExportDecl t decl pats (noDocForDecl, subs_) ] Just iface -> - return [ mkExportDecl t decl (lookupDocs t warnings (instDocMap iface) (instArgMap iface) (instSubMap iface)) ] + return [ mkExportDecl t decl pats (lookupDocs t warnings (instDocMap iface) (instArgMap iface) (instSubMap iface)) ] _ -> return [] - mkExportDecl :: Name -> LHsDecl GhcRn -> (DocForDecl Name, [(Name, DocForDecl Name)]) -> ExportItem GhcRn - mkExportDecl name decl (doc, subs) = decl' + mkExportDecl :: Name -> LHsDecl GhcRn -> [(HsDecl GhcRn, DocForDecl Name)] + -> (DocForDecl Name, [(Name, DocForDecl Name)]) -> ExportItem GhcRn + mkExportDecl name decl pats (doc, subs) = decl' where - decl' = ExportDecl (restrictTo sub_names (extractDecl name decl)) doc subs' [] fixities False + decl' = ExportDecl (restrictTo sub_names (extractDecl name decl)) pats' doc subs' [] fixities False subs' = filter (isExported . fst) subs + pats' = [ d | d@(patsyn_decl, _) <- pats + , all isExported (getMainDeclBinder patsyn_decl) ] sub_names = map fst subs' - fixities = [ (n, f) | n <- name:sub_names, Just f <- [M.lookup n fixMap] ] - - - isExported = (`elem` exportedNames) + pat_names = [ n | (patsyn_decl, _) <- pats', n <- getMainDeclBinder patsyn_decl] + fixities = [ (n, f) | n <- name:sub_names++pat_names, Just f <- [M.lookup n fixMap] ] + exportedNameSet = mkNameSet exportedNames + isExported n = elemNameSet n exportedNameSet findDecl :: Name -> ErrMsgGhc ([LHsDecl GhcRn], (DocForDecl Name, [(Name, DocForDecl Name)])) findDecl n @@ -682,6 +741,40 @@ mkExportItems where m = nameModule n + findBundledPatterns :: Name -> ErrMsgGhc [(HsDecl GhcRn, DocForDecl Name)] + findBundledPatterns t = + let + m = nameModule t + + local_bundled_patsyns = + M.findWithDefault [] t patSynMap + + iface_bundled_patsyns + | Just iface <- M.lookup (semToIdMod (moduleUnitId thisMod) m) modMap + , Just patsyns <- M.lookup t (ifaceBundledPatSynMap iface) + = patsyns + + | Just iface <- M.lookup m instIfaceMap + , Just patsyns <- M.lookup t (instBundledPatSynMap iface) + = patsyns + + | otherwise + = [] + + patsyn_decls = do + for (local_bundled_patsyns ++ iface_bundled_patsyns) $ \patsyn_name -> do + -- call declWith here so we don't have to prepare the pattern synonym for + -- showing ourselves. + export_items <- declWith [] patsyn_name + pure [ (unLoc patsyn_decl, patsyn_doc) + | ExportDecl { + expItemDecl = patsyn_decl + , expItemMbDoc = patsyn_doc + } <- export_items + ] + + in concat <$> patsyn_decls + -- | Given a 'Module' from a 'Name', convert it into a 'Module' that -- we can actually find in the 'IfaceMap'. semToIdMod :: UnitId -> Module -> Module @@ -716,7 +809,7 @@ hiValExportItem dflags name nLoc doc splice fixity = do mayDecl <- hiDecl dflags name case mayDecl of Nothing -> return (ExportNoDecl name []) - Just decl -> return (ExportDecl (fixSpan 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 @@ -817,26 +910,39 @@ fullModuleContents :: DynFlags -> [LHsDecl GhcRn] -- ^ All the renamed declarations -> ErrMsgGhc [ExportItem GhcRn] fullModuleContents dflags warnings gre (docMap, argMap, subMap, declMap, instMap) fixMap splices decls = - liftM catMaybes $ mapM mkExportItem (expandSig decls) + liftM catMaybes $ mapM mkExportItem (expandSigDecls decls) where -- A type signature can have multiple names, like: -- foo, bar :: Types.. -- -- We go through the list of declarations and expand type signatures, so -- that every type signature has exactly one name! - expandSig :: [LHsDecl name] -> [LHsDecl name] - expandSig = foldr f [] + expandSigDecls :: [LHsDecl name] -> [LHsDecl name] + expandSigDecls = concatMap f where - f :: LHsDecl name -> [LHsDecl name] -> [LHsDecl name] - 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 + f (L l (SigD sig)) = [ L l (SigD s) | s <- expandSig sig ] + + -- also expand type signatures for class methods + f (L l (TyClD cls@ClassDecl{})) = + [ L l (TyClD cls { tcdSigs = concatMap expandLSig (tcdSigs cls) }) ] + f x = [x] + + expandLSig :: LSig name -> [LSig name] + expandLSig (L l sig) = [ L l s | s <- expandSig sig ] + + expandSig :: Sig name -> [Sig name] + expandSig (TypeSig names t) = [ TypeSig [n] t | n <- names ] + expandSig (ClassOpSig b names t) = [ ClassOpSig b [n] t | n <- names ] + expandSig (PatSynSig names t) = [ PatSynSig [n] t | n <- names ] + expandSig x = [x] mkExportItem :: LHsDecl GhcRn -> ErrMsgGhc (Maybe (ExportItem GhcRn)) mkExportItem (L _ (DocD (DocGroup lev docStr))) = do - return . Just . ExportGroup lev "" $ processDocString dflags gre docStr + doc <- liftErrMsg (processDocString dflags gre docStr) + return . Just . ExportGroup lev "" $ doc mkExportItem (L _ (DocD (DocCommentNamed _ docStr))) = do - return . Just . ExportDoc $ processDocStringParas dflags gre docStr + doc <- liftErrMsg (processDocStringParas dflags gre docStr) + return . Just . ExportDoc $ doc mkExportItem (L l (ValD d)) | name:_ <- collectHsBindBinders d, Just [L _ (ValD _)] <- M.lookup name declMap = -- Top-level binding without type signature. @@ -860,12 +966,12 @@ fullModuleContents dflags warnings gre (docMap, argMap, subMap, declMap, instMap fixities name subs = [ (n,f) | n <- name : map fst subs , Just f <- [M.lookup n fixMap] ] - expDecl decl l name = return $ Just (ExportDecl decl doc subs [] (fixities name subs) (l `elem` splices)) + expDecl decl l name = return $ Just (ExportDecl decl [] doc subs [] (fixities name subs) (l `elem` splices)) where (doc, subs) = lookupDocs name warnings docMap argMap subMap expInst decl l name = let (doc, subs) = lookupDocs name warnings docMap argMap subMap in - return $ Just (ExportDecl decl doc subs [] (fixities name subs) (l `elem` splices)) + return $ Just (ExportDecl decl [] doc subs [] (fixities name subs) (l `elem` splices)) -- | Sometimes the declaration we want to export is not the "main" declaration: @@ -895,7 +1001,9 @@ extractDecl name decl O.$$ O.nest 4 (O.ppr matches)) TyClD d@DataDecl {} -> let (n, tyvar_tys) = (tcdName d, lHsQTyVarsToTypes (tyClDeclTyVars d)) - in SigD <$> extractRecSel name n tyvar_tys (dd_cons (tcdDataDefn d)) + in if isDataConName name + then SigD <$> extractPatternSyn name n tyvar_tys (dd_cons (tcdDataDefn d)) + else SigD <$> extractRecSel name n tyvar_tys (dd_cons (tcdDataDefn d)) InstD (DataFamInstD DataFamInstDecl { dfid_tycon = L _ n , dfid_pats = HsIB { hsib_body = tys } , dfid_defn = defn }) -> @@ -913,6 +1021,36 @@ extractDecl name decl _ -> error "internal: extractDecl (ClsInstD)" _ -> error "internal: extractDecl" +extractPatternSyn :: Name -> Name -> [LHsType GhcRn] -> [LConDecl GhcRn] -> LSig GhcRn +extractPatternSyn nm t tvs cons = + case filter matches cons of + [] -> error "extractPatternSyn: constructor pattern not found" + con:_ -> extract <$> con + where + matches :: LConDecl GhcRn -> Bool + matches (L _ con) = nm `elem` (unLoc <$> getConNames con) + extract :: ConDecl GhcRn -> Sig GhcRn + extract con = + let args = + case getConDetails con of + PrefixCon args' -> args' + RecCon (L _ fields) -> cd_fld_type . unLoc <$> fields + InfixCon arg1 arg2 -> [arg1, arg2] + typ = longArrow args (data_ty con) + typ' = + case con of + ConDeclH98 { con_cxt = Just cxt } -> noLoc (HsQualTy cxt typ) + _ -> typ + typ'' = noLoc (HsQualTy (noLoc []) typ') + in PatSynSig [noLoc nm] (mkEmptyImplicitBndrs typ'') + + longArrow :: [LHsType name] -> LHsType name -> LHsType name + longArrow inputs output = foldr (\x y -> noLoc (HsFunTy x y)) output inputs + + data_ty con + | ConDeclGADT{} <- con = hsib_body $ con_type con + | otherwise = foldl' (\x y -> noLoc (HsAppTy x y)) (noLoc (HsTyVar NotPromoted (noLoc t))) tvs + extractRecSel :: Name -> Name -> [LHsType GhcRn] -> [LConDecl GhcRn] -> LSig GhcRn extractRecSel _ _ _ [] = error "extractRecSel: selector not found" @@ -945,8 +1083,9 @@ mkVisibleNames (_, _, _, _, instMap) exports opts | otherwise = let ns = concatMap exportName exports in seqList ns `seq` ns where - exportName e@ExportDecl {} = name ++ subs - where subs = map fst (expItemSubDocs e) + exportName e@ExportDecl {} = name ++ subs ++ patsyns + where subs = map fst (expItemSubDocs e) + patsyns = concatMap (getMainDeclBinder . fst) (expItemPats e) name = case unLoc $ expItemDecl e of InstD d -> maybeToList $ M.lookup (getInstLoc d) instMap decl -> getMainDeclBinder decl @@ -977,10 +1116,11 @@ mkMaybeTokenizedSrc flags tm 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 +mkTokenizedSrc ms src = do + -- make sure to read the whole file at once otherwise + -- we run out of file descriptors (see #495) + rawSrc <- BS.readFile (msHsFilePath ms) >>= evaluate + return $ Hyperlinker.enrich src (Hyperlinker.parse (decodeUtf8 rawSrc)) -- | Find a stand-alone documentation comment by its name. findNamedDoc :: String -> [HsDecl GhcRn] -> ErrMsgM (Maybe HsDocString) diff --git a/haddock-api/src/Haddock/Interface/Json.hs b/haddock-api/src/Haddock/Interface/Json.hs new file mode 100644 index 00000000..9a569204 --- /dev/null +++ b/haddock-api/src/Haddock/Interface/Json.hs @@ -0,0 +1,109 @@ +{-# LANGUAGE RecordWildCards #-} +module Haddock.Interface.Json ( + jsonInstalledInterface + , jsonInterfaceFile + , renderJson + ) where + +import BasicTypes +import Json +import Module +import Name +import Outputable + +import Control.Arrow +import Data.Map (Map) +import Data.Bifunctor +import qualified Data.Map as Map + +import Haddock.Types +import Haddock.InterfaceFile + +jsonInterfaceFile :: InterfaceFile -> JsonDoc +jsonInterfaceFile InterfaceFile{..} = + jsonObject [ ("link_env" , jsonMap nameStableString (jsonString . moduleNameString . moduleName) ifLinkEnv) + , ("inst_ifaces", jsonArray (map jsonInstalledInterface ifInstalledIfaces)) + ] + +jsonInstalledInterface :: InstalledInterface -> JsonDoc +jsonInstalledInterface InstalledInterface{..} = jsonObject properties + where + properties = + [ ("module" , jsonModule instMod) + , ("is_sig" , jsonBool instIsSig) + , ("info" , jsonHaddockModInfo instInfo) + , ("doc_map" , jsonMap nameStableString jsonMDoc instDocMap) + , ("arg_map" , jsonMap nameStableString (jsonMap show jsonMDoc) instArgMap) + , ("exports" , jsonArray (map jsonName instExports)) + , ("visible_exports" , jsonArray (map jsonName instVisibleExports)) + , ("options" , jsonArray (map (jsonString . show) instOptions)) + , ("sub_map" , jsonMap nameStableString (jsonArray . map jsonName) instSubMap) + , ("bundled_patsyns" , jsonMap nameStableString (jsonArray . map jsonName) instBundledPatSynMap) + , ("fix_map" , jsonMap nameStableString jsonFixity instFixMap) + ] + +jsonHaddockModInfo :: HaddockModInfo Name -> JsonDoc +jsonHaddockModInfo HaddockModInfo{..} = + jsonObject [ ("description" , jsonMaybe jsonDoc hmi_description) + , ("copyright" , jsonMaybe jsonString hmi_copyright) + , ("maintainer" , jsonMaybe jsonString hmi_maintainer) + , ("stability" , jsonMaybe jsonString hmi_stability) + , ("protability" , jsonMaybe jsonString hmi_portability) + , ("safety" , jsonMaybe jsonString hmi_safety) + , ("language" , jsonMaybe (jsonString . show) hmi_language) + , ("extensions" , jsonArray (map (jsonString . show) hmi_extensions)) + ] + +jsonMap :: (a -> String) -> (b -> JsonDoc) -> Map a b -> JsonDoc +jsonMap f g = jsonObject . map (f *** g) . Map.toList + +jsonMDoc :: MDoc Name -> JsonDoc +jsonMDoc MetaDoc{..} = + jsonObject [ ("meta", jsonObject [("version", jsonMaybe (jsonString . show) (_version _meta))]) + , ("doc", jsonDoc _doc) + ] + +jsonDoc :: Doc Name -> JsonDoc +jsonDoc doc = jsonString (show (bimap (moduleNameString . fst) nameStableString doc)) + +jsonModule :: Module -> JsonDoc +jsonModule = JSString . moduleStableString + +jsonName :: Name -> JsonDoc +jsonName = JSString . nameStableString + +jsonFixity :: Fixity -> JsonDoc +jsonFixity (Fixity _ prec dir) = + jsonObject [ ("prec" , jsonInt prec) + , ("direction" , jsonFixityDirection dir) + ] + +jsonFixityDirection :: FixityDirection -> JsonDoc +jsonFixityDirection InfixL = jsonString "infixl" +jsonFixityDirection InfixR = jsonString "infixr" +jsonFixityDirection InfixN = jsonString "infix" + +renderJson :: JsonDoc -> SDoc +renderJson = renderJSON + +jsonMaybe :: (a -> JsonDoc) -> Maybe a -> JsonDoc +jsonMaybe = maybe jsonNull + +jsonString :: String -> JsonDoc +jsonString = JSString + +jsonObject :: [(String, JsonDoc)] -> JsonDoc +jsonObject = JSObject + +jsonArray :: [JsonDoc] -> JsonDoc +jsonArray = JSArray + +jsonNull :: JsonDoc +jsonNull = JSNull + +jsonInt :: Int -> JsonDoc +jsonInt = JSInt + +jsonBool :: Bool -> JsonDoc +jsonBool = JSBool + diff --git a/haddock-api/src/Haddock/Interface/LexParseRn.hs b/haddock-api/src/Haddock/Interface/LexParseRn.hs index 608344ad..75b2f223 100644 --- a/haddock-api/src/Haddock/Interface/LexParseRn.hs +++ b/haddock-api/src/Haddock/Interface/LexParseRn.hs @@ -35,20 +35,21 @@ import EnumSet import RnEnv (dataTcOccs) processDocStrings :: DynFlags -> GlobalRdrEnv -> [HsDocString] - -> Maybe (MDoc Name) -processDocStrings dflags gre strs = - case metaDocConcat $ map (processDocStringParas dflags gre) strs of + -> ErrMsgM (Maybe (MDoc Name)) +processDocStrings dflags gre strs = do + mdoc <- metaDocConcat <$> traverse (processDocStringParas dflags gre) strs + case mdoc of -- We check that we don't have any version info to render instead -- of just checking if there is no comment: there may not be a -- comment but we still want to pass through any meta data. - MetaDoc { _meta = Meta { _version = Nothing }, _doc = DocEmpty } -> Nothing - x -> Just x + MetaDoc { _meta = Meta { _version = Nothing }, _doc = DocEmpty } -> pure Nothing + x -> pure (Just x) -processDocStringParas :: DynFlags -> GlobalRdrEnv -> HsDocString -> MDoc Name +processDocStringParas :: DynFlags -> GlobalRdrEnv -> HsDocString -> ErrMsgM (MDoc Name) processDocStringParas dflags gre (HsDocString fs) = - overDoc (rename dflags gre) $ parseParas dflags (unpackFS fs) + overDocF (rename dflags gre) $ parseParas dflags (unpackFS fs) -processDocString :: DynFlags -> GlobalRdrEnv -> HsDocString -> Doc Name +processDocString :: DynFlags -> GlobalRdrEnv -> HsDocString -> ErrMsgM (Doc Name) processDocString dflags gre (HsDocString fs) = rename dflags gre $ parseString dflags (unpackFS fs) @@ -61,9 +62,11 @@ processModuleHeader dflags gre safety mayStr = do Just (L _ (HsDocString fs)) -> do let str = unpackFS fs (hmi, doc) = parseModuleHeader dflags str - !descr = rename dflags gre <$> hmi_description hmi - hmi' = hmi { hmi_description = descr } - doc' = overDoc (rename dflags gre) doc + !descr <- case hmi_description hmi of + Just hmi_descr -> Just <$> rename dflags gre hmi_descr + Nothing -> pure Nothing + let hmi' = hmi { hmi_description = descr } + doc' <- overDocF (rename dflags gre) doc return (hmi', Just doc') let flags :: [LangExt.Extension] @@ -83,12 +86,12 @@ processModuleHeader dflags gre safety mayStr = do -- 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 :: DynFlags -> GlobalRdrEnv -> Doc RdrName -> ErrMsgM (Doc Name) rename dflags gre = rn where rn d = case d of - DocAppend a b -> DocAppend (rn a) (rn b) - DocParagraph doc -> DocParagraph (rn doc) + DocAppend a b -> DocAppend <$> rn a <*> rn b + DocParagraph doc -> DocParagraph <$> rn doc DocIdentifier x -> do -- Generate the choices for the possible kind of thing this -- is. @@ -101,7 +104,7 @@ rename dflags gre = rn -- We found no names in the env so we start guessing. [] -> case choices of - [] -> DocMonospaced (DocString (showPpr dflags x)) + [] -> pure (DocMonospaced (DocString (showPpr dflags x))) -- 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 @@ -110,37 +113,37 @@ rename dflags gre = rn -- 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 + a:_ -> pure (outOfScope dflags a) -- There is only one name in the environment that matches so -- use it. - [a] -> DocIdentifier a + [a] -> pure (DocIdentifier a) -- 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 + a:b:_ | isTyConName a -> pure (DocIdentifier a) + | otherwise -> pure (DocIdentifier b) - DocWarning doc -> DocWarning (rn doc) - DocEmphasis doc -> DocEmphasis (rn doc) - DocBold doc -> DocBold (rn doc) - DocMonospaced doc -> DocMonospaced (rn doc) - DocUnorderedList docs -> DocUnorderedList (map rn docs) - DocOrderedList docs -> DocOrderedList (map rn docs) - DocDefList list -> DocDefList [ (rn a, rn b) | (a, b) <- list ] - DocCodeBlock doc -> DocCodeBlock (rn doc) - DocIdentifierUnchecked x -> DocIdentifierUnchecked x - DocModule str -> DocModule str - DocHyperlink l -> DocHyperlink l - DocPic str -> DocPic str - DocMathInline str -> DocMathInline str - DocMathDisplay str -> DocMathDisplay str - DocAName str -> DocAName str - DocProperty p -> DocProperty p - DocExamples e -> DocExamples e - DocEmpty -> DocEmpty - DocString str -> DocString str - DocHeader (Header l t) -> DocHeader $ Header l (rn t) + DocWarning doc -> DocWarning <$> rn doc + DocEmphasis doc -> DocEmphasis <$> rn doc + DocBold doc -> DocBold <$> rn doc + DocMonospaced doc -> DocMonospaced <$> rn doc + DocUnorderedList docs -> DocUnorderedList <$> traverse rn docs + DocOrderedList docs -> DocOrderedList <$> traverse rn docs + DocDefList list -> DocDefList <$> traverse (\(a, b) -> (,) <$> rn a <*> rn b) list + DocCodeBlock doc -> DocCodeBlock <$> rn doc + DocIdentifierUnchecked x -> pure (DocIdentifierUnchecked x) + DocModule str -> pure (DocModule str) + DocHyperlink l -> pure (DocHyperlink l) + DocPic str -> pure (DocPic str) + DocMathInline str -> pure (DocMathInline str) + DocMathDisplay str -> pure (DocMathDisplay str) + DocAName str -> pure (DocAName str) + DocProperty p -> pure (DocProperty p) + DocExamples e -> pure (DocExamples e) + DocEmpty -> pure (DocEmpty) + DocString str -> pure (DocString str) + DocHeader (Header l t) -> DocHeader . Header l <$> rn t -- | Wrap an identifier that's out of scope (i.e. wasn't found in -- 'GlobalReaderEnv' during 'rename') in an appropriate doc. Currently diff --git a/haddock-api/src/Haddock/Interface/Rename.hs b/haddock-api/src/Haddock/Interface/Rename.hs index 70846b31..2e9a311a 100644 --- a/haddock-api/src/Haddock/Interface/Rename.hs +++ b/haddock-api/src/Haddock/Interface/Rename.hs @@ -55,7 +55,7 @@ renameInterface dflags renamingEnv warnings iface = -- combine the missing names and filter out the built-ins, which would -- otherwise always be missing. - missingNames = nub $ filter isExternalName -- XXX: isExternalName filters out too much + missingNames = nubByName id $ filter isExternalName -- XXX: isExternalName filters out too much (missingNames1 ++ missingNames2 ++ missingNames3 ++ missingNames4 ++ missingNames5) @@ -314,6 +314,11 @@ renameInstHead InstHead {..} = do renameLDecl :: LHsDecl GhcRn -> RnM (LHsDecl DocNameI) renameLDecl (L loc d) = return . L loc =<< renameDecl d +renamePats :: [(HsDecl GhcRn, DocForDecl Name)] -> RnM [(HsDecl DocNameI, DocForDecl DocName)] +renamePats = mapM + (\(d,doc) -> do { d' <- renameDecl d + ; doc' <- renameDocForDecl doc + ; return (d',doc')}) renameDecl :: HsDecl GhcRn -> RnM (HsDecl DocNameI) renameDecl decl = case decl of @@ -601,15 +606,16 @@ renameExportItem item = case item of ExportGroup lev id_ doc -> do doc' <- renameDoc doc return (ExportGroup lev id_ doc') - ExportDecl decl doc subs instances fixities splice -> do + ExportDecl decl pats doc subs instances fixities splice -> do decl' <- renameLDecl decl + pats' <- renamePats pats doc' <- renameDocForDecl doc subs' <- mapM renameSub subs instances' <- forM instances renameDocInstance fixities' <- forM fixities $ \(name, fixity) -> do name' <- lookupRn name return (name', fixity) - return (ExportDecl decl' doc' subs' instances' fixities' splice) + return (ExportDecl decl' pats' doc' subs' instances' fixities' splice) ExportNoDecl x subs -> do x' <- lookupRn x subs' <- mapM lookupRn subs diff --git a/haddock-api/src/Haddock/Interface/Specialize.hs b/haddock-api/src/Haddock/Interface/Specialize.hs index d8bdecec..0c8e89c2 100644 --- a/haddock-api/src/Haddock/Interface/Specialize.hs +++ b/haddock-api/src/Haddock/Interface/Specialize.hs @@ -1,9 +1,9 @@ {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE Rank2Types #-} {-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeApplications #-} {-# LANGUAGE RecordWildCards #-} - module Haddock.Interface.Specialize ( specializeInstHead ) where @@ -17,7 +17,6 @@ import Name import FastString import Control.Monad -import Control.Monad.Trans.Reader import Control.Monad.Trans.State import Data.Data @@ -28,72 +27,64 @@ 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 (IdP name), Typeable name) - => Data a - => IdP 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 (IdP name), Typeable name) +specialize :: forall name a. (Ord (IdP name), DataId name, NamedThing (IdP name)) => Data a => [(IdP name, HsType name)] -> a -> a -specialize' = flip $ foldr (uncurry specialize) +specialize specs = go + where + go :: forall x. Data x => x -> x + go = everywhereButType @name $ mkT $ sugar . specialize_ty_var + specialize_ty_var (HsTyVar _ (L _ name')) + | Just t <- Map.lookup name' spec_map = t + specialize_ty_var typ = typ + -- This is a tricky recursive definition that is guaranteed to terminate + -- because a type binder cannot be instantiated with a type that depends + -- on that binder. i.e. @a -> Maybe a@ is invalid + spec_map = Map.fromList [ (n, go t) | (n, t) <- specs] -- | 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 (IdP name), DataId name) +specializeTyVarBndrs :: (Ord (IdP name), DataId name, NamedThing (IdP name)) => Data a => LHsQTyVars name -> [HsType name] -> a -> a specializeTyVarBndrs bndrs typs = - specialize' $ zip 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 (IdP name), DataId name) +specializePseudoFamilyDecl :: (Ord (IdP name), DataId name, NamedThing (IdP name)) => LHsQTyVars name -> [HsType name] -> PseudoFamilyDecl name -> PseudoFamilyDecl name specializePseudoFamilyDecl bndrs typs decl = - decl { pfdTyVars = map specializeTyVars (pfdTyVars decl) } - where - specializeTyVars = specializeTyVarBndrs bndrs typs - + decl {pfdTyVars = map (specializeTyVarBndrs bndrs typs) (pfdTyVars decl)} -specializeSig :: forall name . (Eq (IdP name), DataId name, SetName (IdP name)) +specializeSig :: forall name . (Ord (IdP name), DataId name, SetName (IdP name), NamedThing (IdP name)) => LHsQTyVars name -> [HsType name] -> Sig name -> Sig name specializeSig bndrs typs (TypeSig lnames typ) = - TypeSig lnames (typ { hswc_body = (hswc_body typ) { hsib_body = noLoc typ'}}) + TypeSig lnames (typ {hswc_body = (hswc_body typ) {hsib_body = noLoc typ'}}) where true_type :: HsType name true_type = unLoc (hsSigWcType typ) typ' :: HsType name - typ' = rename fv . sugar $ specializeTyVarBndrs bndrs typs true_type + typ' = rename fv $ 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 (IdP name), DataId name, SetName (IdP name)) +specializeInstHead :: (Ord (IdP name), DataId name, SetName (IdP name), NamedThing (IdP name)) => InstHead name -> InstHead name specializeInstHead ihd@InstHead { ihdInstType = clsi@ClassInst { .. }, .. } = ihd { ihdInstType = instType' } @@ -115,12 +106,7 @@ specializeInstHead ihd = ihd -- and @(a, b, c)@. sugar :: forall name. (NamedThing (IdP name), DataId name) => HsType name -> HsType name -sugar = - everywhere $ mkT step - where - step :: HsType name -> HsType name - step = sugarOperators . sugarTuples . sugarLists - +sugar = sugarOperators . sugarTuples . sugarLists sugarLists :: NamedThing (IdP name) => HsType name -> HsType name sugarLists (HsAppTy (L _ (HsTyVar _ (L _ name))) ltyp) @@ -217,7 +203,7 @@ setInternalOccName occ name = -- | Compute set of free variables of given type. freeVariables :: forall name. (NamedThing (IdP name), DataId name) - => HsType name -> Set NameRep + => HsType name -> Set Name freeVariables = everythingWithState Set.empty Set.union query where @@ -226,7 +212,7 @@ freeVariables = (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) + | otherwise -> (Set.singleton $ getName name, ctx) _ -> (Set.empty, ctx) bndrsNames = Set.fromList . map (getName . tyVarName . unLoc) @@ -238,33 +224,36 @@ freeVariables = -- @(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 (IdP name) => Set NameRep -> HsType name -> HsType name -rename fv typ = runReader (renameType typ) $ RenameEnv - { rneFV = fv - , rneCtx = Map.empty - } - +-- like @(a -> b0) -> b@). +rename :: (Eq (IdP name), DataId name, SetName (IdP name)) + => Set Name-> HsType name -> HsType name +rename fv typ = evalState (renameType typ) env + where + env = RenameEnv + { rneHeadFVs = Map.fromList . map mkPair . Set.toList $ fv + , rneSigFVs = Set.map getNameRep $ freeVariables typ + , rneCtx = Map.empty + } + mkPair name = (getNameRep name, name) -- | Renaming monad. -type Rename name = Reader (RenameEnv name) - --- | Binding generation monad. -type Rebind name = State (RenameEnv name) +type Rename name = State (RenameEnv name) data RenameEnv name = RenameEnv - { rneFV :: Set NameRep - , rneCtx :: Map Name name - } + { rneHeadFVs :: Map NameRep Name + , rneSigFVs :: Set NameRep + , rneCtx :: Map Name name + } -renameType :: SetName (IdP name) => HsType name -> Rename (IdP name) (HsType name) -renameType (HsForAllTy bndrs lt) = rebind bndrs $ \bndrs' -> +renameType :: (Eq (IdP name), SetName (IdP name)) + => HsType name -> Rename (IdP name) (HsType name) +renameType (HsForAllTy bndrs lt) = HsForAllTy - <$> pure bndrs' + <$> mapM (located renameBinder) bndrs <*> renameLType lt renameType (HsQualTy lctxt lt) = - HsQualTy + HsQualTy <$> located renameContext lctxt <*> renameLType lt renameType (HsTyVar ip name) = HsTyVar ip <$> located renameName name @@ -294,85 +283,58 @@ renameType (HsWildCardTy wc) = pure (HsWildCardTy wc) renameType (HsAppsTy _) = error "HsAppsTy: Only used before renaming" -renameLType :: SetName (IdP name) => LHsType name -> Rename (IdP name) (LHsType name) +renameLType :: (Eq (IdP name), SetName (IdP name)) + => LHsType name -> Rename (IdP name) (LHsType name) renameLType = located renameType -renameLTypes :: SetName (IdP name) => [LHsType name] -> Rename (IdP name) [LHsType name] +renameLTypes :: (Eq (IdP name), SetName (IdP name)) + => [LHsType name] -> Rename (IdP name) [LHsType name] renameLTypes = mapM renameLType -renameContext :: SetName (IdP name) => HsContext name -> Rename (IdP name) (HsContext name) +renameContext :: (Eq (IdP name), SetName (IdP name)) + => HsContext name -> Rename (IdP name) (HsContext name) renameContext = renameLTypes -{- -renameLTyOp :: SetName (IdP name) => LHsTyOp name -> Rename name (LHsTyOp name) -renameLTyOp (wrap, lname) = (,) wrap <$> located renameName lname --} +renameBinder :: (Eq (IdP name), SetName (IdP name)) + => HsTyVarBndr name -> Rename (IdP name) (HsTyVarBndr name) +renameBinder (UserTyVar lname) = UserTyVar <$> located renameName lname +renameBinder (KindedTyVar lname lkind) = + KindedTyVar <$> located renameName lname <*> located renameType lkind -renameName :: SetName name => name -> Rename name name +-- | Core renaming logic. +renameName :: (Eq name, SetName name) => name -> Rename name name renameName name = do - RenameEnv { rneCtx = ctx } <- ask - pure $ fromMaybe name (Map.lookup (getName name) ctx) - - -rebind :: SetName (IdP name) - => [LHsTyVarBndr name] -> ([LHsTyVarBndr name] -> Rename (IdP name) a) - -> Rename (IdP name) a -rebind lbndrs action = do - (lbndrs', env') <- runState (rebindLTyVarBndrs lbndrs) <$> ask - local (const env') (action lbndrs') - - -rebindLTyVarBndrs :: SetName (IdP name) - => [LHsTyVarBndr name] -> Rebind (IdP name) [LHsTyVarBndr name] -rebindLTyVarBndrs lbndrs = mapM (located rebindTyVarBndr) lbndrs - - -rebindTyVarBndr :: SetName (IdP name) - => HsTyVarBndr name -> Rebind (IdP 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 + Nothing + | Just headTv <- Map.lookup (getNameRep name) rneHeadFVs + , headTv /= getName name -> freshName name + Just name' -> return name' + _ -> return name -- | Generate fresh occurrence name, put it into context and return. -freshName :: SetName name => name -> Rebind name name +freshName :: SetName name => name -> Rename 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 } + modify $ \rne -> rne + { rneCtx = Map.insert (getName name) name' (rneCtx rne) } 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 :: NamedThing name => Rename name (Set NameRep) takenNames = do RenameEnv { .. } <- get - return $ Set.union rneFV (ctxElems rneCtx) + return $ Set.unions [headReps rneHeadFVs, rneSigFVs, ctxElems rneCtx] where + headReps = Set.fromList . Map.keys ctxElems = Set.fromList . map getNameRep . Map.elems @@ -384,15 +346,7 @@ findFreshName 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 = +alternativeNames name = [ stringNameRep $ str ++ show i | i :: Int <- [0..] ] where str = nameRepString name diff --git a/haddock-api/src/Haddock/InterfaceFile.hs b/haddock-api/src/Haddock/InterfaceFile.hs index 796a7ce6..dd1358d8 100644 --- a/haddock-api/src/Haddock/InterfaceFile.hs +++ b/haddock-api/src/Haddock/InterfaceFile.hs @@ -83,7 +83,7 @@ binaryInterfaceMagic = 0xD0Cface -- binaryInterfaceVersion :: Word16 #if (__GLASGOW_HASKELL__ >= 803) && (__GLASGOW_HASKELL__ < 805) -binaryInterfaceVersion = 29 +binaryInterfaceVersion = 32 binaryInterfaceVersionCompatibility :: [Word16] binaryInterfaceVersionCompatibility = [binaryInterfaceVersion] @@ -373,32 +373,32 @@ instance Binary InterfaceFile where instance Binary InstalledInterface where put_ bh (InstalledInterface modu is_sig info docMap argMap - exps visExps opts subMap fixMap) = do + exps visExps opts subMap patSynMap fixMap) = do put_ bh modu put_ bh is_sig put_ bh info - put_ bh docMap - put_ bh argMap + lazyPut bh (docMap, argMap) put_ bh exps put_ bh visExps put_ bh opts put_ bh subMap + put_ bh patSynMap put_ bh fixMap get bh = do modu <- get bh is_sig <- get bh info <- get bh - docMap <- get bh - argMap <- get bh + ~(docMap, argMap) <- lazyGet bh exps <- get bh visExps <- get bh opts <- get bh subMap <- get bh + patSynMap <- get bh fixMap <- get bh return (InstalledInterface modu is_sig info docMap argMap - exps visExps opts subMap fixMap) + exps visExps opts subMap patSynMap fixMap) instance Binary DocOption where diff --git a/haddock-api/src/Haddock/Options.hs b/haddock-api/src/Haddock/Options.hs index 0449c829..d73d1a79 100644 --- a/haddock-api/src/Haddock/Options.hs +++ b/haddock-api/src/Haddock/Options.hs @@ -25,6 +25,7 @@ module Haddock.Options ( sourceUrls, wikiUrls, optDumpInterfaceFile, + optShowInterfaceFile, optLaTeXStyle, optMathjax, qualification, @@ -53,6 +54,7 @@ data Flag -- | Flag_DocBook | Flag_ReadInterface String | Flag_DumpInterface String + | Flag_ShowInterface String | Flag_Heading String | Flag_Html | Flag_Hoogle @@ -112,6 +114,8 @@ options backwardsCompat = "read an interface from FILE", Option ['D'] ["dump-interface"] (ReqArg Flag_DumpInterface "FILE") "write the resulting interface to FILE", + Option [] ["show-interface"] (ReqArg Flag_ShowInterface "FILE") + "print the interface in a human readable form", -- Option ['S'] ["docbook"] (NoArg Flag_DocBook) -- "output in DocBook XML", Option ['h'] ["html"] (NoArg Flag_Html) @@ -270,6 +274,8 @@ wikiUrls flags = optDumpInterfaceFile :: [Flag] -> Maybe FilePath optDumpInterfaceFile flags = optLast [ str | Flag_DumpInterface str <- flags ] +optShowInterfaceFile :: [Flag] -> Maybe FilePath +optShowInterfaceFile flags = optLast [ str | Flag_ShowInterface str <- flags ] optLaTeXStyle :: [Flag] -> Maybe String optLaTeXStyle flags = optLast [ str | Flag_LaTeXStyle str <- flags ] diff --git a/haddock-api/src/Haddock/Syb.hs b/haddock-api/src/Haddock/Syb.hs index 4847e486..7e34ae8c 100644 --- a/haddock-api/src/Haddock/Syb.hs +++ b/haddock-api/src/Haddock/Syb.hs @@ -1,8 +1,11 @@ {-# LANGUAGE Rank2Types #-} - +{-# LANGUAGE AllowAmbiguousTypes #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE ScopedTypeVariables #-} module Haddock.Syb - ( everything, everythingWithState, everywhere + ( everything, everythingButType, everythingWithState + , everywhere, everywhereButType , mkT , combine ) where @@ -10,16 +13,41 @@ module Haddock.Syb import Data.Data import Control.Applicative +import Data.Maybe +import Data.Foldable +-- | Returns true if a == t. +-- requires AllowAmbiguousTypes +isType :: forall a b. (Typeable a, Typeable b) => b -> Bool +isType _ = isJust $ eqT @a @b -- | 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) +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) +everything k f x = foldl' k (f x) (gmapQ (everything k f) x) + +-- | Variation of "everything" with an added stop condition +-- Just like 'everything', this is stolen from SYB package. +everythingBut :: (r -> r -> r) + -> (forall a. Data a => a -> (r, Bool)) + -> (forall a. Data a => a -> r) +everythingBut k f x = let (v, stop) = f x + in if stop + then v + else foldl' k v (gmapQ (everythingBut k f) x) +-- | Variation of "everything" that does not recurse into children of type t +-- requires AllowAmbiguousTypes +everythingButType :: + forall t r. (Typeable t) + => (r -> r -> r) + -> (forall a. Data a => a -> r) + -> (forall a. Data a => a -> r) +everythingButType k f = everythingBut k $ (,) <$> f <*> isType @t -- | Perform a query with state on each level of a tree. -- @@ -31,8 +59,7 @@ everythingWithState :: s -> (r -> r -> r) -> (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) - + in foldl' k r (gmapQ (everythingWithState s' k f) x) -- | Apply transformation on each level of a tree. -- @@ -40,6 +67,22 @@ everythingWithState s k f x = everywhere :: (forall a. Data a => a -> a) -> (forall a. Data a => a -> a) everywhere f = f . gmapT (everywhere f) +-- | Variation on everywhere with an extra stop condition +-- Just like 'everything', this is stolen from SYB package. +everywhereBut :: (forall a. Data a => a -> Bool) + -> (forall a. Data a => a -> a) + -> (forall a. Data a => a -> a) +everywhereBut q f x + | q x = x + | otherwise = f (gmapT (everywhereBut q f) x) + +-- | Variation of "everywhere" that does not recurse into children of type t +-- requires AllowAmbiguousTypes +everywhereButType :: forall t . (Typeable t) + => (forall a. Data a => a -> a) + -> (forall a. Data a => a -> a) +everywhereButType = everywhereBut (isType @t) + -- | Create generic transformation. -- -- Another function stolen from SYB package. diff --git a/haddock-api/src/Haddock/Types.hs b/haddock-api/src/Haddock/Types.hs index cb4a4bcc..3ad90912 100644 --- a/haddock-api/src/Haddock/Types.hs +++ b/haddock-api/src/Haddock/Types.hs @@ -1,8 +1,8 @@ {-# LANGUAGE CPP, DeriveDataTypeable, DeriveFunctor, DeriveFoldable, DeriveTraversable, StandaloneDeriving, TypeFamilies, RecordWildCards #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE UndecidableInstances #-} -- Note [Pass sensitive types] - -- in module GHC.PlaceHolder {-# OPTIONS_GHC -fno-warn-orphans #-} + ----------------------------------------------------------------------------- -- | -- Module : Haddock.Types @@ -101,6 +101,9 @@ data Interface = Interface -- names of subordinate declarations mapped to their parent declarations. , ifaceDeclMap :: !(Map Name [LHsDecl GhcRn]) + -- | Bundled pattern synonym declarations for specific types. + , ifaceBundledPatSynMap :: !(Map Name [Name]) + -- | Documentation of declarations originating from the module (including -- subordinates). , ifaceDocMap :: !(DocMap Name) @@ -156,49 +159,53 @@ type WarningMap = Map Name (Doc Name) data InstalledInterface = InstalledInterface { -- | The module represented by this interface. - instMod :: Module + instMod :: Module -- | Is this a signature? - , instIsSig :: Bool + , instIsSig :: Bool -- | Textual information about the module. - , instInfo :: HaddockModInfo Name + , instInfo :: HaddockModInfo Name -- | Documentation of declarations originating from the module (including -- subordinates). - , instDocMap :: DocMap Name + , instDocMap :: DocMap Name - , instArgMap :: ArgMap Name + , instArgMap :: ArgMap Name -- | All names exported by this module. - , instExports :: [Name] + , instExports :: [Name] -- | All \"visible\" names exported by the module. -- A visible name is a name that will show up in the documentation of the -- module. - , instVisibleExports :: [Name] + , instVisibleExports :: [Name] -- | Haddock options for this module (prune, ignore-exports, etc). - , instOptions :: [DocOption] + , instOptions :: [DocOption] + + , instSubMap :: Map Name [Name] - , instSubMap :: Map Name [Name] - , instFixMap :: Map Name Fixity + , instBundledPatSynMap :: Map Name [Name] + + , instFixMap :: Map Name Fixity } -- | Convert an 'Interface' to an 'InstalledInterface' toInstalledIface :: Interface -> InstalledInterface toInstalledIface interface = InstalledInterface - { instMod = ifaceMod interface - , instIsSig = ifaceIsSig interface - , instInfo = ifaceInfo interface - , instDocMap = ifaceDocMap interface - , instArgMap = ifaceArgMap interface - , instExports = ifaceExports interface - , instVisibleExports = ifaceVisibleExports interface - , instOptions = ifaceOptions interface - , instSubMap = ifaceSubMap interface - , instFixMap = ifaceFixMap interface + { instMod = ifaceMod interface + , instIsSig = ifaceIsSig interface + , instInfo = ifaceInfo interface + , instDocMap = ifaceDocMap interface + , instArgMap = ifaceArgMap interface + , instExports = ifaceExports interface + , instVisibleExports = ifaceVisibleExports interface + , instOptions = ifaceOptions interface + , instSubMap = ifaceSubMap interface + , instBundledPatSynMap = ifaceBundledPatSynMap interface + , instFixMap = ifaceFixMap interface } @@ -215,6 +222,9 @@ data ExportItem name -- | A declaration. expItemDecl :: !(LHsDecl name) + -- | Bundled patterns for a data type declaration + , expItemPats :: ![(HsDecl name, DocForDecl (IdP name))] + -- | Maybe a doc comment, and possibly docs for arguments (if this -- decl is a function or type-synonym). , expItemMbDoc :: !(DocForDecl (IdP name)) @@ -427,6 +437,8 @@ type LDoc id = Located (Doc id) type Doc id = DocH (ModuleName, OccName) id type MDoc id = MetaDoc (ModuleName, OccName) id +type DocMarkup id a = DocMarkupH (ModuleName, OccName) id a + instance (NFData a, NFData mod) => NFData (DocH mod a) where rnf doc = case doc of @@ -454,7 +466,7 @@ instance (NFData a, NFData mod) DocExamples a -> a `deepseq` () DocHeader a -> a `deepseq` () -#if !MIN_VERSION_GLASGOW_HASKELL(8,0,1,1) +#if !MIN_VERSION_ghc(8,0,2) -- These were added to GHC itself in 8.0.2 instance NFData Name where rnf x = seq x () instance NFData OccName where rnf x = seq x () @@ -478,34 +490,6 @@ exampleToString :: Example -> String exampleToString (Example expression result) = ">>> " ++ expression ++ "\n" ++ unlines result - -data DocMarkup id a = Markup - { markupEmpty :: a - , markupString :: String -> a - , markupParagraph :: a -> a - , markupAppend :: a -> a -> a - , markupIdentifier :: id -> a - , markupIdentifierUnchecked :: (ModuleName, OccName) -> a - , markupModule :: String -> a - , markupWarning :: a -> a - , markupEmphasis :: a -> a - , markupBold :: a -> a - , markupMonospaced :: a -> a - , markupUnorderedList :: [a] -> a - , markupOrderedList :: [a] -> a - , markupDefList :: [(a,a)] -> a - , markupCodeBlock :: a -> a - , markupHyperlink :: Hyperlink -> a - , markupAName :: String -> a - , markupPic :: Picture -> a - , markupMathInline :: String -> a - , markupMathDisplay :: String -> a - , markupProperty :: String -> a - , markupExample :: [Example] -> a - , markupHeader :: Header a -> a - } - - data HaddockModInfo name = HaddockModInfo { hmi_description :: Maybe (Doc name) , hmi_copyright :: Maybe String @@ -589,6 +573,12 @@ makeModuleQual qual aliases mdl = OptFullQual -> FullQual OptNoQual -> NoQual +-- | Whether to hide empty contexts +-- Since pattern synonyms have two contexts with different semantics, it is +-- important to all of them, even if one of them is empty. +data HideEmptyContexts + = HideEmptyContexts + | ShowEmptyToplevelContexts ----------------------------------------------------------------------------- -- * Error handling diff --git a/haddock-api/src/Haddock/Utils.hs b/haddock-api/src/Haddock/Utils.hs index f5c5b743..540774dc 100644 --- a/haddock-api/src/Haddock/Utils.hs +++ b/haddock-api/src/Haddock/Utils.hs @@ -37,8 +37,6 @@ module Haddock.Utils ( html_xrefs_ref, html_xrefs_ref', -- * Doc markup - markup, - idMarkup, mkMeta, -- * List utilities @@ -448,71 +446,6 @@ spanWith p xs@(a:as) | Just b <- p a = let (bs,cs) = spanWith p as in (b:bs,cs) | otherwise = ([],xs) - ------------------------------------------------------------------------------ --- * Put here temporarily ------------------------------------------------------------------------------ - - -markup :: DocMarkup id a -> Doc id -> a -markup m DocEmpty = markupEmpty m -markup m (DocAppend d1 d2) = markupAppend m (markup m d1) (markup m d2) -markup m (DocString s) = markupString m s -markup m (DocParagraph d) = markupParagraph m (markup m d) -markup m (DocIdentifier x) = markupIdentifier m x -markup m (DocIdentifierUnchecked x) = markupIdentifierUnchecked m x -markup m (DocModule mod0) = markupModule m mod0 -markup m (DocWarning d) = markupWarning m (markup m d) -markup m (DocEmphasis d) = markupEmphasis m (markup m d) -markup m (DocBold d) = markupBold m (markup m d) -markup m (DocMonospaced d) = markupMonospaced m (markup m d) -markup m (DocUnorderedList ds) = markupUnorderedList m (map (markup m) ds) -markup m (DocOrderedList ds) = markupOrderedList m (map (markup m) ds) -markup m (DocDefList ds) = markupDefList m (map (markupPair m) ds) -markup m (DocCodeBlock d) = markupCodeBlock m (markup m d) -markup m (DocHyperlink l) = markupHyperlink m l -markup m (DocAName ref) = markupAName m ref -markup m (DocPic img) = markupPic m img -markup m (DocMathInline mathjax) = markupMathInline m mathjax -markup m (DocMathDisplay mathjax) = markupMathDisplay m mathjax -markup m (DocProperty p) = markupProperty m p -markup m (DocExamples e) = markupExample m e -markup m (DocHeader (Header l t)) = markupHeader m (Header l (markup m t)) - - -markupPair :: DocMarkup id a -> (Doc id, Doc id) -> (a, a) -markupPair m (a,b) = (markup m a, markup m b) - - --- | The identity markup -idMarkup :: DocMarkup a (Doc a) -idMarkup = Markup { - markupEmpty = DocEmpty, - markupString = DocString, - markupParagraph = DocParagraph, - markupAppend = DocAppend, - markupIdentifier = DocIdentifier, - markupIdentifierUnchecked = DocIdentifierUnchecked, - markupModule = DocModule, - markupWarning = DocWarning, - markupEmphasis = DocEmphasis, - markupBold = DocBold, - markupMonospaced = DocMonospaced, - markupUnorderedList = DocUnorderedList, - markupOrderedList = DocOrderedList, - markupDefList = DocDefList, - markupCodeBlock = DocCodeBlock, - markupHyperlink = DocHyperlink, - markupAName = DocAName, - markupPic = DocPic, - markupMathInline = DocMathInline, - markupMathDisplay = DocMathDisplay, - markupProperty = DocProperty, - markupExample = DocExamples, - markupHeader = DocHeader - } - - ----------------------------------------------------------------------------- -- * System tools ----------------------------------------------------------------------------- diff --git a/haddock-library/CHANGES.md b/haddock-library/CHANGES.md new file mode 100644 index 00000000..53d17f5e --- /dev/null +++ b/haddock-library/CHANGES.md @@ -0,0 +1,9 @@ +## Changes in version 1.4.6 + + * to be released + + * Bifunctor, Bifoldable and Bitraversable instances for DocH and MetaDoc + +## Changes in version 1.4.5 + + * Move markup related data types to haddock-library diff --git a/haddock-library/haddock-library.cabal b/haddock-library/haddock-library.cabal index cabfbc67..120af729 100644 --- a/haddock-library/haddock-library.cabal +++ b/haddock-library/haddock-library.cabal @@ -1,5 +1,5 @@ name: haddock-library -version: 1.4.2 +version: 1.4.6 synopsis: Library exposing some functionality of Haddock. description: Haddock is a documentation-generation tool for Haskell libraries. These modules expose some functionality of it @@ -9,37 +9,62 @@ description: Haddock is a documentation-generation tool for Haskell itself, see the ‘haddock’ package. license: BSD3 license-file: LICENSE -maintainer: Simon Hengel <sol@typeful.net>, Mateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk> +maintainer: Alex Biehl <alexbiehl@gmail.com>, Simon Hengel <sol@typeful.net>, Mateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk> homepage: http://www.haskell.org/haddock/ bug-reports: https://github.com/haskell/haddock/issues category: Documentation build-type: Simple -cabal-version: >= 1.10 -stability: experimental - +cabal-version: >= 2.0 +extra-source-files: + CHANGES.md library default-language: Haskell2010 build-depends: - base >= 4.5 && < 4.11 - , bytestring - , transformers - , deepseq + base >= 4.5 && < 4.11 + , bytestring >= 0.9.2.1 && < 0.11 + , transformers >= 0.3.0 && < 0.6 - hs-source-dirs: src, vendor/attoparsec-0.12.1.1 + -- internal sub-lib + build-depends: attoparsec + + hs-source-dirs: src ghc-options: -funbox-strict-fields -Wall -fwarn-tabs -O2 exposed-modules: + Documentation.Haddock.Doc + Documentation.Haddock.Markup Documentation.Haddock.Parser Documentation.Haddock.Parser.Monad Documentation.Haddock.Types - Documentation.Haddock.Doc + Documentation.Haddock.Utf8 other-modules: - Data.Attoparsec + Documentation.Haddock.Parser.Util + + ghc-options: -Wall + if impl(ghc >= 8.0) + ghc-options: -Wcompat -Wnoncanonical-monad-instances -Wnoncanonical-monadfail-instances + +library attoparsec + default-language: Haskell2010 + + build-depends: + base >= 4.5 && < 4.11 + , bytestring >= 0.9.2.1 && < 0.11 + , deepseq >= 1.3 && < 1.5 + + hs-source-dirs: vendor/attoparsec-0.13.1.0 + + -- NB: haddock-library needs only small part of lib:attoparsec + -- internally, so we only bundle that subset here + exposed-modules: Data.Attoparsec.ByteString - Data.Attoparsec.ByteString.Buffer Data.Attoparsec.ByteString.Char8 + + other-modules: + Data.Attoparsec + Data.Attoparsec.ByteString.Buffer Data.Attoparsec.ByteString.FastSet Data.Attoparsec.ByteString.Internal Data.Attoparsec.Combinator @@ -47,8 +72,15 @@ library Data.Attoparsec.Internal.Fhthagn Data.Attoparsec.Internal.Types Data.Attoparsec.Number - Documentation.Haddock.Parser.Util - Documentation.Haddock.Utf8 + + ghc-options: -funbox-strict-fields -Wall -fwarn-tabs -O2 + + ghc-options: -Wall + if impl(ghc >= 8.0) + ghc-options: -Wcompat -Wnoncanonical-monad-instances -Wnoncanonical-monadfail-instances + else + build-depends: semigroups ^>= 0.18.3, fail ^>= 4.9.0.0 + test-suite spec type: exitcode-stdio-1.0 @@ -57,26 +89,40 @@ test-suite spec hs-source-dirs: test , src - , vendor/attoparsec-0.12.1.1 ghc-options: -Wall cpp-options: -DTEST other-modules: + Documentation.Haddock.Doc + Documentation.Haddock.Parser + Documentation.Haddock.Parser.Monad + Documentation.Haddock.Parser.Util + Documentation.Haddock.Parser.UtilSpec Documentation.Haddock.ParserSpec + Documentation.Haddock.Types + Documentation.Haddock.Utf8 Documentation.Haddock.Utf8Spec - Documentation.Haddock.Parser.UtilSpec build-depends: + base-compat ^>= 0.9.3 + , transformers >= 0.3.0 && < 0.6 + , hspec ^>= 2.4.4 + , QuickCheck ^>= 2.10 + + -- internal sub-lib + build-depends: attoparsec + + -- Versions for the dependencies below are transitively pinned by + -- dependency on haddock-library:lib:attoparsec + build-depends: base , bytestring - , transformers , deepseq - , base-compat - , hspec - , QuickCheck == 2.* + build-tool-depends: + hspec-discover:hspec-discover ^>= 2.4.4 source-repository head type: git diff --git a/haddock-library/src/Documentation/Haddock/Markup.hs b/haddock-library/src/Documentation/Haddock/Markup.hs new file mode 100644 index 00000000..1bf6c084 --- /dev/null +++ b/haddock-library/src/Documentation/Haddock/Markup.hs @@ -0,0 +1,63 @@ +-- | @since 1.4.5 +module Documentation.Haddock.Markup ( + markup + , idMarkup + ) where + +import Documentation.Haddock.Types + +markup :: DocMarkupH mod id a -> DocH mod id -> a +markup m DocEmpty = markupEmpty m +markup m (DocAppend d1 d2) = markupAppend m (markup m d1) (markup m d2) +markup m (DocString s) = markupString m s +markup m (DocParagraph d) = markupParagraph m (markup m d) +markup m (DocIdentifier x) = markupIdentifier m x +markup m (DocIdentifierUnchecked x) = markupIdentifierUnchecked m x +markup m (DocModule mod0) = markupModule m mod0 +markup m (DocWarning d) = markupWarning m (markup m d) +markup m (DocEmphasis d) = markupEmphasis m (markup m d) +markup m (DocBold d) = markupBold m (markup m d) +markup m (DocMonospaced d) = markupMonospaced m (markup m d) +markup m (DocUnorderedList ds) = markupUnorderedList m (map (markup m) ds) +markup m (DocOrderedList ds) = markupOrderedList m (map (markup m) ds) +markup m (DocDefList ds) = markupDefList m (map (markupPair m) ds) +markup m (DocCodeBlock d) = markupCodeBlock m (markup m d) +markup m (DocHyperlink l) = markupHyperlink m l +markup m (DocAName ref) = markupAName m ref +markup m (DocPic img) = markupPic m img +markup m (DocMathInline mathjax) = markupMathInline m mathjax +markup m (DocMathDisplay mathjax) = markupMathDisplay m mathjax +markup m (DocProperty p) = markupProperty m p +markup m (DocExamples e) = markupExample m e +markup m (DocHeader (Header l t)) = markupHeader m (Header l (markup m t)) + +markupPair :: DocMarkupH mod id a -> (DocH mod id, DocH mod id) -> (a, a) +markupPair m (a,b) = (markup m a, markup m b) + +-- | The identity markup +idMarkup :: DocMarkupH mod id (DocH mod id) +idMarkup = Markup { + markupEmpty = DocEmpty, + markupString = DocString, + markupParagraph = DocParagraph, + markupAppend = DocAppend, + markupIdentifier = DocIdentifier, + markupIdentifierUnchecked = DocIdentifierUnchecked, + markupModule = DocModule, + markupWarning = DocWarning, + markupEmphasis = DocEmphasis, + markupBold = DocBold, + markupMonospaced = DocMonospaced, + markupUnorderedList = DocUnorderedList, + markupOrderedList = DocOrderedList, + markupDefList = DocDefList, + markupCodeBlock = DocCodeBlock, + markupHyperlink = DocHyperlink, + markupAName = DocAName, + markupPic = DocPic, + markupMathInline = DocMathInline, + markupMathDisplay = DocMathDisplay, + markupProperty = DocProperty, + markupExample = DocExamples, + markupHeader = DocHeader + } diff --git a/haddock-library/src/Documentation/Haddock/Parser.hs b/haddock-library/src/Documentation/Haddock/Parser.hs index 123f5612..8dc2a801 100644 --- a/haddock-library/src/Documentation/Haddock/Parser.hs +++ b/haddock-library/src/Documentation/Haddock/Parser.hs @@ -14,7 +14,7 @@ -- library, the most commonly used combination of functions is going -- to be -- --- @'toRegular' . 'parseParas'@ +-- @'toRegular' . '_doc' . 'parseParas'@ module Documentation.Haddock.Parser ( parseString, parseParas , overIdentifier, toRegular, Identifier ) where @@ -143,7 +143,7 @@ specialChar = "_/<@\"&'`# " -- to ensure that we have already given a chance to more meaningful parsers -- before capturing their characers. string' :: Parser (DocH mod a) -string' = DocString . unescape . decodeUtf8 <$> takeWhile1_ (`notElem` specialChar) +string' = DocString . unescape . decodeUtf8 <$> takeWhile1_ (notInClass specialChar) where unescape "" = "" unescape ('\\':x:xs) = x : unescape xs @@ -153,7 +153,7 @@ string' = DocString . unescape . decodeUtf8 <$> takeWhile1_ (`notElem` specialCh -- This is done to skip over any special characters belonging to other -- elements but which were not deemed meaningful at their positions. skipSpecialChar :: Parser (DocH mod a) -skipSpecialChar = DocString . return <$> satisfy (`elem` specialChar) +skipSpecialChar = DocString . return <$> satisfy (inClass specialChar) -- | Emphasis parser. -- @@ -215,7 +215,7 @@ moduleName = DocModule <$> (char '"' *> modid <* char '"') -- accept {small | large | digit | ' } here. But as we can't -- match on unicode characters, this is currently not possible. -- Note that we allow ‘#’ to suport anchors. - <*> (decodeUtf8 <$> takeWhile (`notElem` (" .&[{}(=*)+]!|@/;,^?\"\n"::String))) + <*> (decodeUtf8 <$> takeWhile (notInClass " .&[{}(=*)+]!|@/;,^?\"\n")) -- | Picture parser, surrounded by \<\< and \>\>. It's possible to specify -- a title for the picture. @@ -338,7 +338,7 @@ definitionList :: BS.ByteString -> Parser (DocH mod Identifier) definitionList indent = DocDefList <$> p where p = do - label <- "[" *> (parseStringBS <$> takeWhile1 (`notElem` ("]\n" :: String))) <* ("]" <* optional ":") + label <- "[" *> (parseStringBS <$> takeWhile1 (notInClass "]\n")) <* ("]" <* optional ":") c <- takeLine (cs, items) <- more indent p let contents = parseString . dropNLs . unlines $ c : cs @@ -561,7 +561,7 @@ autoUrl = mkLink <$> url url = mappend <$> ("http://" <|> "https://" <|> "ftp://") <*> takeWhile1 (not . isSpace) mkLink :: BS.ByteString -> DocH mod a mkLink s = case unsnoc s of - Just (xs, x) | x `elem` (",.!?" :: String) -> DocHyperlink (Hyperlink (decodeUtf8 xs) Nothing) `docAppend` DocString [x] + Just (xs, x) | inClass ",.!?" x -> DocHyperlink (Hyperlink (decodeUtf8 xs) Nothing) `docAppend` DocString [x] _ -> DocHyperlink (Hyperlink (decodeUtf8 s) Nothing) -- | Parses strings between identifier delimiters. Consumes all input that it @@ -570,8 +570,13 @@ autoUrl = mkLink <$> url parseValid :: Parser String parseValid = p some where - idChar = satisfy (`elem` ("_.!#$%&*+/<=>?@\\|-~:^"::String)) - <|> digit <|> letter_ascii + idChar = + satisfy (\c -> isAlpha_ascii c + || isDigit c + -- N.B. '-' is placed first otherwise attoparsec thinks + -- it belongs to a character class + || inClass "-_.!#$%&*+/<=>?@\\|~:^" c) + p p' = do vs' <- p' $ utf8String "⋆" <|> return <$> idChar let vs = concat vs' @@ -594,4 +599,4 @@ identifier = do e <- idDelim return $ DocIdentifier (o, vid, e) where - idDelim = char '\'' <|> char '`' + idDelim = satisfy (\c -> c == '\'' || c == '`') diff --git a/haddock-library/src/Documentation/Haddock/Parser/Util.hs b/haddock-library/src/Documentation/Haddock/Parser/Util.hs index d908ce18..ab5e5e9e 100644 --- a/haddock-library/src/Documentation/Haddock/Parser/Util.hs +++ b/haddock-library/src/Documentation/Haddock/Parser/Util.hs @@ -22,7 +22,7 @@ module Documentation.Haddock.Parser.Util ( import Control.Applicative import Control.Monad (mfilter) -import Documentation.Haddock.Parser.Monad +import Documentation.Haddock.Parser.Monad hiding (isHorizontalSpace) import Data.ByteString.Char8 (ByteString) import qualified Data.ByteString.Char8 as BS import Prelude hiding (takeWhile) @@ -40,11 +40,14 @@ unsnoc bs strip :: String -> String strip = (\f -> f . f) $ dropWhile isSpace . reverse +isHorizontalSpace :: Char -> Bool +isHorizontalSpace = inClass " \t\f\v\r" + skipHorizontalSpace :: Parser () -skipHorizontalSpace = skipWhile (`elem` " \t\f\v\r") +skipHorizontalSpace = skipWhile isHorizontalSpace takeHorizontalSpace :: Parser BS.ByteString -takeHorizontalSpace = takeWhile (`elem` " \t\f\v\r") +takeHorizontalSpace = takeWhile isHorizontalSpace makeLabeled :: (String -> Maybe String -> a) -> String -> a makeLabeled f input = case break isSpace $ removeEscapes $ strip input of diff --git a/haddock-library/src/Documentation/Haddock/Types.hs b/haddock-library/src/Documentation/Haddock/Types.hs index 4d5bb68a..1e76c631 100644 --- a/haddock-library/src/Documentation/Haddock/Types.hs +++ b/haddock-library/src/Documentation/Haddock/Types.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE DeriveFunctor, DeriveFoldable, DeriveTraversable #-} +{-# LANGUAGE CPP, DeriveFunctor, DeriveFoldable, DeriveTraversable #-} -- | -- Module : Documentation.Haddock.Types @@ -14,8 +14,20 @@ -- Exposes documentation data types used for (some) of Haddock. module Documentation.Haddock.Types where +#if !MIN_VERSION_base(4,8,0) import Data.Foldable import Data.Traversable +#endif + +#if MIN_VERSION_base(4,8,0) +import Control.Arrow ((***)) +import Data.Bifunctor +#endif + +#if MIN_VERSION_base(4,10,0) +import Data.Bifoldable +import Data.Bitraversable +#endif -- | With the advent of 'Version', we may want to start attaching more -- meta-data to comments. We make a structure for this ahead of time @@ -28,9 +40,25 @@ data MetaDoc mod id = , _doc :: DocH mod id } deriving (Eq, Show, Functor, Foldable, Traversable) +#if MIN_VERSION_base(4,8,0) +instance Bifunctor MetaDoc where + bimap f g (MetaDoc m d) = MetaDoc m (bimap f g d) +#endif + +#if MIN_VERSION_base(4,10,0) +instance Bifoldable MetaDoc where + bifoldr f g z d = bifoldr f g z (_doc d) + +instance Bitraversable MetaDoc where + bitraverse f g (MetaDoc m d) = MetaDoc m <$> bitraverse f g d +#endif + overDoc :: (DocH a b -> DocH c d) -> MetaDoc a b -> MetaDoc c d overDoc f d = d { _doc = f $ _doc d } +overDocF :: Functor f => (DocH a b -> f (DocH c d)) -> MetaDoc a b -> f (MetaDoc c d) +overDocF f d = (\x -> d { _doc = x }) <$> f (_doc d) + type Version = [Int] data Hyperlink = Hyperlink @@ -78,3 +106,107 @@ data DocH mod id | DocExamples [Example] | DocHeader (Header (DocH mod id)) deriving (Eq, Show, Functor, Foldable, Traversable) + +#if MIN_VERSION_base(4,8,0) +instance Bifunctor DocH where + bimap _ _ DocEmpty = DocEmpty + bimap f g (DocAppend docA docB) = DocAppend (bimap f g docA) (bimap f g docB) + bimap _ _ (DocString s) = DocString s + bimap f g (DocParagraph doc) = DocParagraph (bimap f g doc) + bimap _ g (DocIdentifier i) = DocIdentifier (g i) + bimap f _ (DocIdentifierUnchecked m) = DocIdentifierUnchecked (f m) + bimap _ _ (DocModule s) = DocModule s + bimap f g (DocWarning doc) = DocWarning (bimap f g doc) + bimap f g (DocEmphasis doc) = DocEmphasis (bimap f g doc) + bimap f g (DocMonospaced doc) = DocMonospaced (bimap f g doc) + bimap f g (DocBold doc) = DocBold (bimap f g doc) + bimap f g (DocUnorderedList docs) = DocUnorderedList (map (bimap f g) docs) + bimap f g (DocOrderedList docs) = DocOrderedList (map (bimap f g) docs) + bimap f g (DocDefList docs) = DocDefList (map (bimap f g *** bimap f g) docs) + bimap f g (DocCodeBlock doc) = DocCodeBlock (bimap f g doc) + bimap _ _ (DocHyperlink hyperlink) = DocHyperlink hyperlink + bimap _ _ (DocPic picture) = DocPic picture + bimap _ _ (DocMathInline s) = DocMathInline s + bimap _ _ (DocMathDisplay s) = DocMathDisplay s + bimap _ _ (DocAName s) = DocAName s + bimap _ _ (DocProperty s) = DocProperty s + bimap _ _ (DocExamples examples) = DocExamples examples + bimap f g (DocHeader (Header level title)) = DocHeader (Header level (bimap f g title)) +#endif + +#if MIN_VERSION_base(4,10,0) +instance Bifoldable DocH where + bifoldr f g z (DocAppend docA docB) = bifoldr f g (bifoldr f g z docA) docB + bifoldr f g z (DocParagraph doc) = bifoldr f g z doc + bifoldr _ g z (DocIdentifier i) = g i z + bifoldr f _ z (DocIdentifierUnchecked m) = f m z + bifoldr f g z (DocWarning doc) = bifoldr f g z doc + bifoldr f g z (DocEmphasis doc) = bifoldr f g z doc + bifoldr f g z (DocMonospaced doc) = bifoldr f g z doc + bifoldr f g z (DocBold doc) = bifoldr f g z doc + bifoldr f g z (DocUnorderedList docs) = foldr (flip (bifoldr f g)) z docs + bifoldr f g z (DocOrderedList docs) = foldr (flip (bifoldr f g)) z docs + bifoldr f g z (DocDefList docs) = foldr (\(l, r) acc -> bifoldr f g (bifoldr f g acc l) r) z docs + bifoldr f g z (DocCodeBlock doc) = bifoldr f g z doc + bifoldr f g z (DocHeader (Header _ title)) = bifoldr f g z title + bifoldr _ _ z _ = z + +instance Bitraversable DocH where + bitraverse _ _ DocEmpty = pure DocEmpty + bitraverse f g (DocAppend docA docB) = DocAppend <$> bitraverse f g docA <*> bitraverse f g docB + bitraverse _ _ (DocString s) = pure (DocString s) + bitraverse f g (DocParagraph doc) = DocParagraph <$> bitraverse f g doc + bitraverse _ g (DocIdentifier i) = DocIdentifier <$> g i + bitraverse f _ (DocIdentifierUnchecked m) = DocIdentifierUnchecked <$> f m + bitraverse _ _ (DocModule s) = pure (DocModule s) + bitraverse f g (DocWarning doc) = DocWarning <$> bitraverse f g doc + bitraverse f g (DocEmphasis doc) = DocEmphasis <$> bitraverse f g doc + bitraverse f g (DocMonospaced doc) = DocMonospaced <$> bitraverse f g doc + bitraverse f g (DocBold doc) = DocBold <$> bitraverse f g doc + bitraverse f g (DocUnorderedList docs) = DocUnorderedList <$> traverse (bitraverse f g) docs + bitraverse f g (DocOrderedList docs) = DocOrderedList <$> traverse (bitraverse f g) docs + bitraverse f g (DocDefList docs) = DocDefList <$> traverse (bitraverse (bitraverse f g) (bitraverse f g)) docs + bitraverse f g (DocCodeBlock doc) = DocCodeBlock <$> bitraverse f g doc + bitraverse _ _ (DocHyperlink hyperlink) = pure (DocHyperlink hyperlink) + bitraverse _ _ (DocPic picture) = pure (DocPic picture) + bitraverse _ _ (DocMathInline s) = pure (DocMathInline s) + bitraverse _ _ (DocMathDisplay s) = pure (DocMathDisplay s) + bitraverse _ _ (DocAName s) = pure (DocAName s) + bitraverse _ _ (DocProperty s) = pure (DocProperty s) + bitraverse _ _ (DocExamples examples) = pure (DocExamples examples) + bitraverse f g (DocHeader (Header level title)) = (DocHeader . Header level) <$> bitraverse f g title +#endif + +-- | 'DocMarkupH' is a set of instructions for marking up documentation. +-- In fact, it's really just a mapping from 'Doc' to some other +-- type [a], where [a] is usually the type of the output (HTML, say). +-- Use 'Documentation.Haddock.Markup.markup' to apply a 'DocMarkupH' to +-- a 'DocH'. +-- +-- @since 1.4.5 +-- +data DocMarkupH mod id a = Markup + { markupEmpty :: a + , markupString :: String -> a + , markupParagraph :: a -> a + , markupAppend :: a -> a -> a + , markupIdentifier :: id -> a + , markupIdentifierUnchecked :: mod -> a + , markupModule :: String -> a + , markupWarning :: a -> a + , markupEmphasis :: a -> a + , markupBold :: a -> a + , markupMonospaced :: a -> a + , markupUnorderedList :: [a] -> a + , markupOrderedList :: [a] -> a + , markupDefList :: [(a,a)] -> a + , markupCodeBlock :: a -> a + , markupHyperlink :: Hyperlink -> a + , markupAName :: String -> a + , markupPic :: Picture -> a + , markupMathInline :: String -> a + , markupMathDisplay :: String -> a + , markupProperty :: String -> a + , markupExample :: [Example] -> a + , markupHeader :: Header a -> a + } diff --git a/haddock-library/test/Documentation/Haddock/ParserSpec.hs b/haddock-library/test/Documentation/Haddock/ParserSpec.hs index 1169eb49..b63ece92 100644 --- a/haddock-library/test/Documentation/Haddock/ParserSpec.hs +++ b/haddock-library/test/Documentation/Haddock/ParserSpec.hs @@ -1,5 +1,4 @@ {-# LANGUAGE OverloadedStrings, FlexibleInstances #-} -{-# LANGUAGE LambdaCase #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Documentation.Haddock.ParserSpec (main, spec) where @@ -57,7 +56,7 @@ spec = do "e" `shouldParseTo` "e" it "allows to backslash-escape characters except \\r" $ do - property $ \case + property $ \y -> case y of '\r' -> "\\\r" `shouldParseTo` DocString "\\" x -> ['\\', x] `shouldParseTo` DocString [x] diff --git a/haddock-library/vendor/attoparsec-0.12.1.1/Data/Attoparsec.hs b/haddock-library/vendor/attoparsec-0.13.1.0/Data/Attoparsec.hs index 53d91190..bd3c5592 100644 --- a/haddock-library/vendor/attoparsec-0.12.1.1/Data/Attoparsec.hs +++ b/haddock-library/vendor/attoparsec-0.13.1.0/Data/Attoparsec.hs @@ -1,6 +1,6 @@ -- | -- Module : Data.Attoparsec --- Copyright : Bryan O'Sullivan 2007-2014 +-- Copyright : Bryan O'Sullivan 2007-2015 -- License : BSD3 -- -- Maintainer : bos@serpentine.com diff --git a/haddock-library/vendor/attoparsec-0.12.1.1/Data/Attoparsec/ByteString.hs b/haddock-library/vendor/attoparsec-0.13.1.0/Data/Attoparsec/ByteString.hs index da28b723..84e567d9 100644 --- a/haddock-library/vendor/attoparsec-0.12.1.1/Data/Attoparsec/ByteString.hs +++ b/haddock-library/vendor/attoparsec-0.13.1.0/Data/Attoparsec/ByteString.hs @@ -1,6 +1,10 @@ +{-# LANGUAGE CPP #-} +#if __GLASGOW_HASKELL__ >= 702 +{-# LANGUAGE Trustworthy #-} +#endif -- | -- Module : Data.Attoparsec.ByteString --- Copyright : Bryan O'Sullivan 2007-2014 +-- Copyright : Bryan O'Sullivan 2007-2015 -- License : BSD3 -- -- Maintainer : bos@serpentine.com @@ -59,6 +63,7 @@ module Data.Attoparsec.ByteString , I.skipWhile , I.take , I.scan + , I.runScanner , I.takeWhile , I.takeWhile1 , I.takeTill @@ -92,6 +97,7 @@ module Data.Attoparsec.ByteString ) where import Data.Attoparsec.Combinator +import Data.List (intercalate) import qualified Data.Attoparsec.ByteString.Internal as I import qualified Data.Attoparsec.Internal as I import qualified Data.ByteString as B @@ -218,6 +224,7 @@ maybeResult _ = Nothing -- | Convert a 'Result' value to an 'Either' value. A 'T.Partial' -- result is treated as failure. eitherResult :: Result r -> Either String r -eitherResult (T.Done _ r) = Right r -eitherResult (T.Fail _ _ msg) = Left msg -eitherResult _ = Left "Result: incomplete input" +eitherResult (T.Done _ r) = Right r +eitherResult (T.Fail _ [] msg) = Left msg +eitherResult (T.Fail _ ctxs msg) = Left (intercalate " > " ctxs ++ ": " ++ msg) +eitherResult _ = Left "Result: incomplete input" diff --git a/haddock-library/vendor/attoparsec-0.12.1.1/Data/Attoparsec/ByteString/Buffer.hs b/haddock-library/vendor/attoparsec-0.13.1.0/Data/Attoparsec/ByteString/Buffer.hs index 5e32d022..ac94dfcc 100644 --- a/haddock-library/vendor/attoparsec-0.12.1.1/Data/Attoparsec/ByteString/Buffer.hs +++ b/haddock-library/vendor/attoparsec-0.13.1.0/Data/Attoparsec/ByteString/Buffer.hs @@ -1,7 +1,7 @@ {-# LANGUAGE BangPatterns #-} -- | -- Module : Data.Attoparsec.ByteString.Buffer --- Copyright : Bryan O'Sullivan 2007-2014 +-- Copyright : Bryan O'Sullivan 2007-2015 -- License : BSD3 -- -- Maintainer : bos@serpentine.com @@ -57,7 +57,8 @@ import Control.Exception (assert) import Data.ByteString.Internal (ByteString(..), memcpy, nullForeignPtr) import Data.Attoparsec.Internal.Fhthagn (inlinePerformIO) import Data.List (foldl1') -import Data.Monoid (Monoid(..)) +import Data.Monoid as Mon (Monoid(..)) +import Data.Semigroup (Semigroup(..)) import Data.Word (Word8) import Foreign.ForeignPtr (ForeignPtr, withForeignPtr) import Foreign.Ptr (castPtr, plusPtr) @@ -65,6 +66,7 @@ import Foreign.Storable (peek, peekByteOff, poke, sizeOf) import GHC.ForeignPtr (mallocPlainForeignPtrBytes) import Prelude hiding (length) +-- If _cap is zero, this buffer is empty. data Buffer = Buf { _fp :: {-# UNPACK #-} !(ForeignPtr Word8) , _off :: {-# UNPACK #-} !Int @@ -85,18 +87,21 @@ buffer (PS fp off len) = Buf fp off len len 0 unbuffer :: Buffer -> ByteString unbuffer (Buf fp off len _ _) = PS fp off len +instance Semigroup Buffer where + (Buf _ _ _ 0 _) <> b = b + a <> (Buf _ _ _ 0 _) = a + buf <> (Buf fp off len _ _) = append buf fp off len + instance Monoid Buffer where mempty = Buf nullForeignPtr 0 0 0 0 - mappend (Buf _ _ _ 0 _) b = b - mappend a (Buf _ _ _ 0 _) = a - mappend buf (Buf fp off len _ _) = append buf fp off len + mappend = (<>) - mconcat [] = mempty + mconcat [] = Mon.mempty mconcat xs = foldl1' mappend xs pappend :: Buffer -> ByteString -> Buffer -pappend (Buf _ _ _ 0 _) (PS fp off len) = Buf fp off len 0 0 +pappend (Buf _ _ _ 0 _) bs = buffer bs pappend buf (PS fp off len) = append buf fp off len append :: Buffer -> ForeignPtr a -> Int -> Int -> Buffer diff --git a/haddock-library/vendor/attoparsec-0.12.1.1/Data/Attoparsec/ByteString/Char8.hs b/haddock-library/vendor/attoparsec-0.13.1.0/Data/Attoparsec/ByteString/Char8.hs index 576dded9..7fafba40 100644 --- a/haddock-library/vendor/attoparsec-0.12.1.1/Data/Attoparsec/ByteString/Char8.hs +++ b/haddock-library/vendor/attoparsec-0.13.1.0/Data/Attoparsec/ByteString/Char8.hs @@ -1,10 +1,13 @@ -{-# LANGUAGE BangPatterns, FlexibleInstances, TypeFamilies, +{-# LANGUAGE BangPatterns, CPP, FlexibleInstances, TypeFamilies, TypeSynonymInstances, GADTs #-} +#if __GLASGOW_HASKELL__ >= 702 +{-# LANGUAGE Trustworthy #-} -- Imports internal modules +#endif {-# OPTIONS_GHC -fno-warn-orphans -fno-warn-warnings-deprecations #-} -- | -- Module : Data.Attoparsec.ByteString.Char8 --- Copyright : Bryan O'Sullivan 2007-2014 +-- Copyright : Bryan O'Sullivan 2007-2015 -- License : BSD3 -- -- Maintainer : bos@serpentine.com @@ -67,7 +70,7 @@ module Data.Attoparsec.ByteString.Char8 -- * Efficient string handling , I.string - , stringCI + , I.stringCI , skipSpace , skipWhile , I.take @@ -94,7 +97,6 @@ module Data.Attoparsec.ByteString.Char8 , decimal , hexadecimal , signed - , Number(..) -- * Combinators , try @@ -120,16 +122,19 @@ module Data.Attoparsec.ByteString.Char8 , I.atEnd ) where -import Control.Applicative ((*>), (<*), (<$>), (<|>)) +#if !MIN_VERSION_base(4,8,0) +import Control.Applicative (pure, (*>), (<*), (<$>)) +import Data.Word (Word) +#endif +import Control.Applicative ((<|>)) import Data.Attoparsec.ByteString.FastSet (charClass, memberChar) import Data.Attoparsec.ByteString.Internal (Parser) import Data.Attoparsec.Combinator -import Data.Attoparsec.Number (Number(..)) import Data.Bits (Bits, (.|.), shiftL) import Data.ByteString.Internal (c2w, w2c) import Data.Int (Int8, Int16, Int32, Int64) import Data.String (IsString(..)) -import Data.Word +import Data.Word (Word8, Word16, Word32, Word64) import Prelude hiding (takeWhile) import qualified Data.Attoparsec.ByteString as A import qualified Data.Attoparsec.ByteString.Internal as I @@ -155,16 +160,6 @@ instance (a ~ B.ByteString) => IsString (Parser a) where -- currency sign in ISO-8859-1). Haskell 'Char' values above U+00FF -- are truncated, so e.g. U+1D6B7 is truncated to the byte @0xB7@. --- ASCII-specific but fast, oh yes. -toLower :: Word8 -> Word8 -toLower w | w >= 65 && w <= 90 = w + 32 - | otherwise = w - --- | Satisfy a literal string, ignoring case. -stringCI :: B.ByteString -> Parser B.ByteString -stringCI = I.stringTransform (B8.map toLower) -{-# INLINE stringCI #-} - -- | Consume input as long as the predicate returns 'True', and return -- the consumed input. -- @@ -228,7 +223,7 @@ isDigit c = c >= '0' && c <= '9' -- | A fast digit predicate. isDigit_w8 :: Word8 -> Bool -isDigit_w8 w = w >= 48 && w <= 57 +isDigit_w8 w = w - 48 <= 9 {-# INLINE isDigit_w8 #-} -- | Match any character. @@ -265,7 +260,7 @@ isSpace c = (c == ' ') || ('\t' <= c && c <= '\r') -- | Fast 'Word8' predicate for matching ASCII space characters. isSpace_w8 :: Word8 -> Bool -isSpace_w8 w = (w == 32) || (9 <= w && w <= 13) +isSpace_w8 w = w == 32 || w - 9 <= 4 {-# INLINE isSpace_w8 #-} @@ -440,9 +435,8 @@ hexadecimal = B8.foldl' step 0 `fmap` I.takeWhile1 isHexDigit -- | Parse and decode an unsigned decimal number. decimal :: Integral a => Parser a -decimal = B8.foldl' step 0 `fmap` I.takeWhile1 isDig - where isDig w = w >= 48 && w <= 57 - step a w = a * 10 + fromIntegral (w - 48) +decimal = B8.foldl' step 0 `fmap` I.takeWhile1 isDigit_w8 + where step a w = a * 10 + fromIntegral (w - 48) {-# SPECIALISE decimal :: Parser Int #-} {-# SPECIALISE decimal :: Parser Int8 #-} {-# SPECIALISE decimal :: Parser Int16 #-} @@ -467,3 +461,4 @@ signed :: Num a => Parser a -> Parser a signed p = (negate <$> (char8 '-' *> p)) <|> (char8 '+' *> p) <|> p + diff --git a/haddock-library/vendor/attoparsec-0.12.1.1/Data/Attoparsec/ByteString/FastSet.hs b/haddock-library/vendor/attoparsec-0.13.1.0/Data/Attoparsec/ByteString/FastSet.hs index cb615167..d15854c4 100644 --- a/haddock-library/vendor/attoparsec-0.12.1.1/Data/Attoparsec/ByteString/FastSet.hs +++ b/haddock-library/vendor/attoparsec-0.13.1.0/Data/Attoparsec/ByteString/FastSet.hs @@ -3,7 +3,7 @@ ----------------------------------------------------------------------------- -- | -- Module : Data.Attoparsec.ByteString.FastSet --- Copyright : Bryan O'Sullivan 2007-2014 +-- Copyright : Bryan O'Sullivan 2007-2015 -- License : BSD3 -- -- Maintainer : bos@serpentine.com diff --git a/haddock-library/vendor/attoparsec-0.12.1.1/Data/Attoparsec/ByteString/Internal.hs b/haddock-library/vendor/attoparsec-0.13.1.0/Data/Attoparsec/ByteString/Internal.hs index f6ec3b32..4938ea87 100644 --- a/haddock-library/vendor/attoparsec-0.12.1.1/Data/Attoparsec/ByteString/Internal.hs +++ b/haddock-library/vendor/attoparsec-0.13.1.0/Data/Attoparsec/ByteString/Internal.hs @@ -1,7 +1,8 @@ -{-# LANGUAGE BangPatterns, GADTs, OverloadedStrings, RecordWildCards #-} +{-# LANGUAGE BangPatterns, CPP, GADTs, OverloadedStrings, RankNTypes, + RecordWildCards #-} -- | -- Module : Data.Attoparsec.ByteString.Internal --- Copyright : Bryan O'Sullivan 2007-2014 +-- Copyright : Bryan O'Sullivan 2007-2015 -- License : BSD3 -- -- Maintainer : bos@serpentine.com @@ -46,7 +47,7 @@ module Data.Attoparsec.ByteString.Internal -- * Efficient string handling , skipWhile , string - , stringTransform + , stringCI , take , scan , runScanner @@ -65,7 +66,10 @@ module Data.Attoparsec.ByteString.Internal , atEnd ) where -import Control.Applicative ((<|>), (<$>)) +#if !MIN_VERSION_base(4,8,0) +import Control.Applicative ((<$>)) +#endif +import Control.Applicative ((<|>)) import Control.Monad (when) import Data.Attoparsec.ByteString.Buffer (Buffer, buffer) import Data.Attoparsec.ByteString.FastSet (charClass, memberWord8) @@ -74,6 +78,7 @@ import Data.Attoparsec.Internal import Data.Attoparsec.Internal.Fhthagn (inlinePerformIO) import Data.Attoparsec.Internal.Types hiding (Parser, Failure, Success) import Data.ByteString (ByteString) +import Data.List (intercalate) import Data.Word (Word8) import Foreign.ForeignPtr (withForeignPtr) import Foreign.Ptr (castPtr, minusPtr, plusPtr) @@ -136,22 +141,15 @@ storable = hack undefined hack :: Storable b => b -> Parser b hack dummy = do (fp,o,_) <- B.toForeignPtr `fmap` take (sizeOf dummy) - return . B.inlinePerformIO . withForeignPtr fp $ \p -> + return . inlinePerformIO . withForeignPtr fp $ \p -> peek (castPtr $ p `plusPtr` o) --- | Consume @n@ bytes of input, but succeed only if the predicate --- returns 'True'. -takeWith :: Int -> (ByteString -> Bool) -> Parser ByteString -takeWith n0 p = do - let n = max n0 0 - s <- ensure n - if p s - then advance n >> return s - else fail "takeWith" - -- | Consume exactly @n@ bytes of input. take :: Int -> Parser ByteString -take n = takeWith n (const True) +take n0 = do + let n = max n0 0 + s <- ensure n + advance n >> return s {-# INLINE take #-} -- | @string s@ parses a sequence of bytes that identically match @@ -170,13 +168,59 @@ take n = takeWith n (const True) -- before failing. In attoparsec, the above parser will /succeed/ on -- that input, because the failed first branch will consume nothing. string :: ByteString -> Parser ByteString -string s = takeWith (B.length s) (==s) +string s = string_ (stringSuspended id) id s {-# INLINE string #-} -stringTransform :: (ByteString -> ByteString) -> ByteString - -> Parser ByteString -stringTransform f s = takeWith (B.length s) ((==f s) . f) -{-# INLINE stringTransform #-} +-- ASCII-specific but fast, oh yes. +toLower :: Word8 -> Word8 +toLower w | w >= 65 && w <= 90 = w + 32 + | otherwise = w + +-- | Satisfy a literal string, ignoring case. +stringCI :: ByteString -> Parser ByteString +stringCI s = string_ (stringSuspended lower) lower s + where lower = B8.map toLower +{-# INLINE stringCI #-} + +string_ :: (forall r. ByteString -> ByteString -> Buffer -> Pos -> More + -> Failure r -> Success ByteString r -> Result r) + -> (ByteString -> ByteString) + -> ByteString -> Parser ByteString +string_ suspended f s0 = T.Parser $ \t pos more lose succ -> + let n = B.length s + s = f s0 + in if lengthAtLeast pos n t + then let t' = substring pos (Pos n) t + in if s == f t' + then succ t (pos + Pos n) more t' + else lose t pos more [] "string" + else let t' = Buf.unsafeDrop (fromPos pos) t + in if f t' `B.isPrefixOf` s + then suspended s (B.drop (B.length t') s) t pos more lose succ + else lose t pos more [] "string" +{-# INLINE string_ #-} + +stringSuspended :: (ByteString -> ByteString) + -> ByteString -> ByteString -> Buffer -> Pos -> More + -> Failure r + -> Success ByteString r + -> Result r +stringSuspended f s0 s t pos more lose succ = + runParser (demandInput_ >>= go) t pos more lose succ + where go s'0 = T.Parser $ \t' pos' more' lose' succ' -> + let m = B.length s + s' = f s'0 + n = B.length s' + in if n >= m + then if B.unsafeTake m s' == s + then let o = Pos (B.length s0) + in succ' t' (pos' + o) more' + (substring pos' o t') + else lose' t' pos' more' [] "string" + else if s' == B.unsafeTake n s + then stringSuspended f s0 (B.unsafeDrop n s) + t' pos' more' lose' succ' + else lose' t' pos' more' [] "string" -- | Skip past input for as long as the predicate returns 'True'. skipWhile :: (Word8 -> Bool) -> Parser () @@ -213,15 +257,24 @@ takeTill p = takeWhile (not . p) -- parsers loop until a failure occurs. Careless use will thus result -- in an infinite loop. takeWhile :: (Word8 -> Bool) -> Parser ByteString -takeWhile p = (B.concat . reverse) `fmap` go [] +takeWhile p = do + s <- B8.takeWhile p <$> get + continue <- inputSpansChunks (B.length s) + if continue + then takeWhileAcc p [s] + else return s +{-# INLINE takeWhile #-} + +takeWhileAcc :: (Word8 -> Bool) -> [ByteString] -> Parser ByteString +takeWhileAcc p = go where go acc = do s <- B8.takeWhile p <$> get continue <- inputSpansChunks (B.length s) if continue then go (s:acc) - else return (s:acc) -{-# INLINE takeWhile #-} + else return $ concatReverse (s:acc) +{-# INLINE takeWhileAcc #-} takeRest :: Parser [ByteString] takeRest = go [] @@ -285,16 +338,13 @@ scan_ f s0 p = go [] s0 -- parsers loop until a failure occurs. Careless use will thus result -- in an infinite loop. scan :: s -> (s -> Word8 -> Maybe s) -> Parser ByteString -scan = scan_ $ \_ chunks -> - case chunks of - [x] -> return x - xs -> return $! B.concat $ reverse xs +scan = scan_ $ \_ chunks -> return $! concatReverse chunks {-# INLINE scan #-} -- | Like 'scan', but generalized to return the final state of the -- scanner. runScanner :: s -> (s -> Word8 -> Maybe s) -> Parser (ByteString, s) -runScanner = scan_ $ \s xs -> return (B.concat (reverse xs), s) +runScanner = scan_ $ \s xs -> let !sx = concatReverse xs in return (sx, s) {-# INLINE runScanner #-} -- | Consume input as long as the predicate returns 'True', and return @@ -314,8 +364,9 @@ takeWhile1 p = do advance len eoc <- endOfChunk if eoc - then (s<>) `fmap` takeWhile p + then takeWhileAcc p [s] else return s +{-# INLINE takeWhile1 #-} -- | Match any byte in a set. -- @@ -416,9 +467,10 @@ parse m s = T.runParser m (buffer s) (Pos 0) Incomplete failK successK -- @ parseOnly :: Parser a -> ByteString -> Either String a parseOnly m s = case T.runParser m (buffer s) (Pos 0) Complete failK successK of - Fail _ _ err -> Left err - Done _ a -> Right a - _ -> error "parseOnly: impossible error!" + Fail _ [] err -> Left err + Fail _ ctxs err -> Left (intercalate " > " ctxs ++ ": " ++ err) + Done _ a -> Right a + _ -> error "parseOnly: impossible error!" {-# INLINE parseOnly #-} get :: Parser ByteString @@ -465,7 +517,6 @@ ensure n = T.Parser $ \t pos more lose succ -> then succ t pos more (substring pos (Pos n) t) -- The uncommon case is kept out-of-line to reduce code size: else ensureSuspended n t pos more lose succ --- Non-recursive so the bounds check can be inlined: {-# INLINE ensure #-} -- | Return both the result of a parse and the portion of the input diff --git a/haddock-library/vendor/attoparsec-0.12.1.1/Data/Attoparsec/Combinator.hs b/haddock-library/vendor/attoparsec-0.13.1.0/Data/Attoparsec/Combinator.hs index 65788ce9..dde0c27a 100644 --- a/haddock-library/vendor/attoparsec-0.12.1.1/Data/Attoparsec/Combinator.hs +++ b/haddock-library/vendor/attoparsec-0.13.1.0/Data/Attoparsec/Combinator.hs @@ -1,7 +1,10 @@ -{-# LANGUAGE BangPatterns #-} +{-# LANGUAGE BangPatterns, CPP #-} +#if __GLASGOW_HASKELL__ >= 702 +{-# LANGUAGE Trustworthy #-} -- Imports internal modules +#endif -- | -- Module : Data.Attoparsec.Combinator --- Copyright : Daan Leijen 1999-2001, Bryan O'Sullivan 2007-2014 +-- Copyright : Daan Leijen 1999-2001, Bryan O'Sullivan 2007-2015 -- License : BSD3 -- -- Maintainer : bos@serpentine.com @@ -33,15 +36,18 @@ module Data.Attoparsec.Combinator , satisfyElem , endOfInput , atEnd + , lookAhead ) where -import Control.Applicative (Alternative(..), Applicative(..), empty, liftA2, - many, (<|>), (*>), (<$>)) +#if !MIN_VERSION_base(4,8,0) +import Control.Applicative (Applicative(..), (<$>)) +import Data.Monoid (Monoid(mappend)) +#endif +import Control.Applicative (Alternative(..), empty, liftA2, many, (<|>)) import Control.Monad (MonadPlus(..)) import Data.Attoparsec.Internal.Types (Parser(..), IResult(..)) import Data.Attoparsec.Internal (endOfInput, atEnd, satisfyElem) import Data.ByteString (ByteString) -import Data.Monoid (Monoid(mappend)) import Prelude hiding (succ) -- | Attempt a parse, and if it fails, rewind the input so that no @@ -120,7 +126,7 @@ many1' p = liftM2' (:) p (many' p) -- | @sepBy p sep@ applies /zero/ or more occurrences of @p@, separated -- by @sep@. Returns a list of the values returned by @p@. -- --- > commaSep p = p `sepBy` (symbol ",") +-- > commaSep p = p `sepBy` (char ',') sepBy :: Alternative f => f a -> f s -> f [a] sepBy p s = liftA2 (:) p ((s *> sepBy1 p s) <|> pure []) <|> pure [] {-# SPECIALIZE sepBy :: Parser ByteString a -> Parser ByteString s @@ -130,7 +136,7 @@ sepBy p s = liftA2 (:) p ((s *> sepBy1 p s) <|> pure []) <|> pure [] -- by @sep@. Returns a list of the values returned by @p@. The value -- returned by @p@ is forced to WHNF. -- --- > commaSep p = p `sepBy'` (symbol ",") +-- > commaSep p = p `sepBy'` (char ',') sepBy' :: (MonadPlus m) => m a -> m s -> m [a] sepBy' p s = scan `mplus` return [] where scan = liftM2' (:) p ((s >> sepBy1' p s) `mplus` return []) @@ -140,7 +146,7 @@ sepBy' p s = scan `mplus` return [] -- | @sepBy1 p sep@ applies /one/ or more occurrences of @p@, separated -- by @sep@. Returns a list of the values returned by @p@. -- --- > commaSep p = p `sepBy1` (symbol ",") +-- > commaSep p = p `sepBy1` (char ',') sepBy1 :: Alternative f => f a -> f s -> f [a] sepBy1 p s = scan where scan = liftA2 (:) p ((s *> scan) <|> pure []) @@ -151,7 +157,7 @@ sepBy1 p s = scan -- by @sep@. Returns a list of the values returned by @p@. The value -- returned by @p@ is forced to WHNF. -- --- > commaSep p = p `sepBy1'` (symbol ",") +-- > commaSep p = p `sepBy1'` (char ',') sepBy1' :: (MonadPlus m) => m a -> m s -> m [a] sepBy1' p s = scan where scan = liftM2' (:) p ((s >> scan) `mplus` return []) @@ -214,7 +220,14 @@ eitherP a b = (Left <$> a) <|> (Right <$> b) -- | If a parser has returned a 'T.Partial' result, supply it with more -- input. feed :: Monoid i => IResult i r -> i -> IResult i r -feed f@(Fail _ _ _) _ = f +feed (Fail t ctxs msg) d = Fail (mappend t d) ctxs msg feed (Partial k) d = k d feed (Done t r) d = Done (mappend t d) r {-# INLINE feed #-} + +-- | Apply a parser without consuming any input. +lookAhead :: Parser i a -> Parser i a +lookAhead p = Parser $ \t pos more lose succ -> + let succ' t' _pos' more' = succ t' pos more' + in runParser p t pos more lose succ' +{-# INLINE lookAhead #-} diff --git a/haddock-library/vendor/attoparsec-0.12.1.1/Data/Attoparsec/Internal.hs b/haddock-library/vendor/attoparsec-0.13.1.0/Data/Attoparsec/Internal.hs index 371770a9..ee758b26 100644 --- a/haddock-library/vendor/attoparsec-0.12.1.1/Data/Attoparsec/Internal.hs +++ b/haddock-library/vendor/attoparsec-0.13.1.0/Data/Attoparsec/Internal.hs @@ -1,7 +1,7 @@ -{-# LANGUAGE CPP, BangPatterns, ScopedTypeVariables #-} +{-# LANGUAGE BangPatterns, CPP, ScopedTypeVariables #-} -- | -- Module : Data.Attoparsec.Internal --- Copyright : Bryan O'Sullivan 2007-2014 +-- Copyright : Bryan O'Sullivan 2007-2015 -- License : BSD3 -- -- Maintainer : bos@serpentine.com @@ -15,17 +15,20 @@ module Data.Attoparsec.Internal ( compareResults , prompt , demandInput + , demandInput_ , wantInput , endOfInput , atEnd , satisfyElem + , concatReverse ) where +#if !MIN_VERSION_base(4,8,0) import Control.Applicative ((<$>)) -#if __GLASGOW_HASKELL__ >= 700 -import Data.ByteString (ByteString) +import Data.Monoid (Monoid, mconcat) #endif import Data.Attoparsec.Internal.Types +import Data.ByteString (ByteString) import Prelude hiding (succ) -- | Compare two 'IResult' values for equality. @@ -41,8 +44,8 @@ compareResults (Done t0 r0) (Done t1 r1) = compareResults (Partial _) (Partial _) = Nothing compareResults _ _ = Just False --- | Ask for input. If we receive any, pass it to a success --- continuation, otherwise to a failure continuation. +-- | Ask for input. If we receive any, pass the augmented input to a +-- success continuation, otherwise to a failure continuation. prompt :: Chunk t => State t -> Pos -> More -> (State t -> Pos -> More -> IResult t r) @@ -52,14 +55,12 @@ prompt t pos _more lose succ = Partial $ \s -> if nullChunk s then lose t pos Complete else succ (pappendChunk t s) pos Incomplete -#if __GLASGOW_HASKELL__ >= 700 {-# SPECIALIZE prompt :: State ByteString -> Pos -> More -> (State ByteString -> Pos -> More -> IResult ByteString r) -> (State ByteString -> Pos -> More -> IResult ByteString r) -> IResult ByteString r #-} -#endif -- | Immediately demand more input via a 'Partial' continuation -- result. @@ -67,12 +68,22 @@ demandInput :: Chunk t => Parser t () demandInput = Parser $ \t pos more lose succ -> case more of Complete -> lose t pos more [] "not enough input" - _ -> let lose' t' pos' more' = lose t' pos' more' [] "not enough input" + _ -> let lose' _ pos' more' = lose t pos' more' [] "not enough input" succ' t' pos' more' = succ t' pos' more' () in prompt t pos more lose' succ' -#if __GLASGOW_HASKELL__ >= 700 {-# SPECIALIZE demandInput :: Parser ByteString () #-} -#endif + +-- | Immediately demand more input via a 'Partial' continuation +-- result. Return the new input. +demandInput_ :: Chunk t => Parser t t +demandInput_ = Parser $ \t pos more lose succ -> + case more of + Complete -> lose t pos more [] "not enough input" + _ -> Partial $ \s -> + if nullChunk s + then lose t pos Complete [] "not enough input" + else succ (pappendChunk t s) pos more s +{-# SPECIALIZE demandInput_ :: Parser ByteString ByteString #-} -- | This parser always succeeds. It returns 'True' if any input is -- available either immediately or on demand, and 'False' if the end @@ -97,9 +108,7 @@ endOfInput = Parser $ \t pos more lose succ -> let lose' t' pos' more' _ctx _msg = succ t' pos' more' () succ' t' pos' more' _a = lose t' pos' more' [] "endOfInput" in runParser demandInput t pos more lose' succ' -#if __GLASGOW_HASKELL__ >= 700 {-# SPECIALIZE endOfInput :: Parser ByteString () #-} -#endif -- | Return an indication of whether the end of input has been -- reached. @@ -120,14 +129,12 @@ satisfySuspended p t pos more lose succ = Just (e, l) | p e -> succ' t' (pos' + Pos l) more' e | otherwise -> lose' t' pos' more' [] "satisfyElem" Nothing -> runParser (demandInput >> go) t' pos' more' lose' succ' -#if __GLASGOW_HASKELL__ >= 700 {-# SPECIALIZE satisfySuspended :: (ChunkElem ByteString -> Bool) -> State ByteString -> Pos -> More -> Failure ByteString (State ByteString) r -> Success ByteString (State ByteString) (ChunkElem ByteString) r -> IResult ByteString r #-} -#endif -- | The parser @satisfyElem p@ succeeds for any chunk element for which the -- predicate @p@ returns 'True'. Returns the element that is @@ -140,3 +147,11 @@ satisfyElem p = Parser $ \t pos more lose succ -> | otherwise -> lose t pos more [] "satisfyElem" Nothing -> satisfySuspended p t pos more lose succ {-# INLINE satisfyElem #-} + +-- | Concatenate a monoid after reversing its elements. Used to +-- glue together a series of textual chunks that have been accumulated +-- \"backwards\". +concatReverse :: Monoid m => [m] -> m +concatReverse [x] = x +concatReverse xs = mconcat (reverse xs) +{-# INLINE concatReverse #-} diff --git a/haddock-library/vendor/attoparsec-0.12.1.1/Data/Attoparsec/Internal/Fhthagn.hs b/haddock-library/vendor/attoparsec-0.13.1.0/Data/Attoparsec/Internal/Fhthagn.hs index 0e00ed2c..0e00ed2c 100644 --- a/haddock-library/vendor/attoparsec-0.12.1.1/Data/Attoparsec/Internal/Fhthagn.hs +++ b/haddock-library/vendor/attoparsec-0.13.1.0/Data/Attoparsec/Internal/Fhthagn.hs diff --git a/haddock-library/vendor/attoparsec-0.12.1.1/Data/Attoparsec/Internal/Types.hs b/haddock-library/vendor/attoparsec-0.13.1.0/Data/Attoparsec/Internal/Types.hs index 9c7994e9..96bc319e 100644 --- a/haddock-library/vendor/attoparsec-0.12.1.1/Data/Attoparsec/Internal/Types.hs +++ b/haddock-library/vendor/attoparsec-0.13.1.0/Data/Attoparsec/Internal/Types.hs @@ -2,7 +2,7 @@ Rank2Types, RecordWildCards, TypeFamilies #-} -- | -- Module : Data.Attoparsec.Internal.Types --- Copyright : Bryan O'Sullivan 2007-2014 +-- Copyright : Bryan O'Sullivan 2007-2015 -- License : BSD3 -- -- Maintainer : bos@serpentine.com @@ -25,14 +25,17 @@ module Data.Attoparsec.Internal.Types , Chunk(..) ) where -import Control.Applicative (Alternative(..), Applicative(..), (<$>)) +import Control.Applicative as App (Applicative(..), (<$>)) +import Control.Applicative (Alternative(..)) import Control.DeepSeq (NFData(rnf)) import Control.Monad (MonadPlus(..)) +import qualified Control.Monad.Fail as Fail (MonadFail(..)) +import Data.Monoid as Mon (Monoid(..)) +import Data.Semigroup (Semigroup(..)) import Data.Word (Word8) import Data.ByteString (ByteString) import qualified Data.ByteString as BS import Data.ByteString.Internal (w2c) -import Data.Monoid (Monoid(..)) import Prelude hiding (getChar, succ) import qualified Data.Attoparsec.ByteString.Buffer as B @@ -63,10 +66,13 @@ data IResult i r = -- not yet been consumed (if any) when the parse succeeded. instance (Show i, Show r) => Show (IResult i r) where - show (Fail t stk msg) = - unwords [ "Fail", show t, show stk, show msg] - show (Partial _) = "Partial _" - show (Done t r) = unwords ["Done", show t, show r] + showsPrec d ir = showParen (d > 10) $ + case ir of + (Fail t stk msg) -> showString "Fail" . f t . f stk . f msg + (Partial _) -> showString "Partial _" + (Done t r) -> showString "Done" . f t . f r + where f :: Show a => a -> ShowS + f x = showChar ' ' . showsPrec 11 x instance (NFData i, NFData r) => NFData (IResult i r) where rnf (Fail t stk msg) = rnf t `seq` rnf stk `seq` rnf msg @@ -79,8 +85,8 @@ instance Functor (IResult i) where fmap f (Partial k) = Partial (fmap f . k) fmap f (Done t r) = Done t (f r) --- | The core parser type. This is parameterised over the types @i@ --- of string being processed and @t@ of internal state representation. +-- | The core parser type. This is parameterised over the type @i@ +-- of string being processed. -- -- This type is an instance of the following classes: -- @@ -116,17 +122,19 @@ type Success i t a r = t -> Pos -> More -> a -> IResult i r data More = Complete | Incomplete deriving (Eq, Show) -instance Monoid More where - mappend c@Complete _ = c - mappend _ m = m - mempty = Incomplete +instance Semigroup More where + c@Complete <> _ = c + _ <> m = m + +instance Mon.Monoid More where + mappend = (<>) + mempty = Incomplete instance Monad (Parser i) where - fail err = Parser $ \t pos more lose _succ -> lose t pos more [] msg - where msg = "Failed reading: " ++ err + fail = Fail.fail {-# INLINE fail #-} - return = pure + return = App.pure {-# INLINE return #-} m >>= k = Parser $ \t !pos more lose succ -> @@ -134,6 +142,15 @@ instance Monad (Parser i) where in runParser m t pos more lose succ' {-# INLINE (>>=) #-} + (>>) = (*>) + {-# INLINE (>>) #-} + + +instance Fail.MonadFail (Parser i) where + fail err = Parser $ \t pos more lose _succ -> lose t pos more [] msg + where msg = "Failed reading: " ++ err + {-# INLINE fail #-} + plus :: Parser i a -> Parser i a -> Parser i a plus f g = Parser $ \t pos more lose succ -> let lose' t' _pos' more' _ctx _msg = runParser g t' pos more' lose succ @@ -162,19 +179,19 @@ instance Applicative (Parser i) where {-# INLINE pure #-} (<*>) = apP {-# INLINE (<*>) #-} - - -- 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 + x <* y = x >>= \a -> y >> pure a {-# INLINE (<*) #-} +instance Semigroup (Parser i a) where + (<>) = plus + {-# INLINE (<>) #-} + instance Monoid (Parser i a) where mempty = fail "mempty" {-# INLINE mempty #-} - mappend = plus + mappend = (<>) {-# INLINE mappend #-} instance Alternative (Parser i) where @@ -186,7 +203,7 @@ instance Alternative (Parser i) where many v = many_v where many_v = some_v <|> pure [] - some_v = (:) <$> v <*> many_v + some_v = (:) App.<$> v <*> many_v {-# INLINE many #-} some v = some_v @@ -195,10 +212,6 @@ instance Alternative (Parser i) where some_v = (:) <$> v <*> many_v {-# INLINE some #-} -(<>) :: (Monoid m) => m -> m -> m -(<>) = mappend -{-# INLINE (<>) #-} - -- | A common interface for input chunks. class Monoid c => Chunk c where type ChunkElem c diff --git a/haddock-library/vendor/attoparsec-0.12.1.1/Data/Attoparsec/Number.hs b/haddock-library/vendor/attoparsec-0.13.1.0/Data/Attoparsec/Number.hs index 7438a912..d0970d90 100644 --- a/haddock-library/vendor/attoparsec-0.12.1.1/Data/Attoparsec/Number.hs +++ b/haddock-library/vendor/attoparsec-0.13.1.0/Data/Attoparsec/Number.hs @@ -1,7 +1,7 @@ {-# LANGUAGE DeriveDataTypeable #-} -- | -- Module : Data.Attoparsec.Number --- Copyright : Bryan O'Sullivan 2007-2014 +-- Copyright : Bryan O'Sullivan 2007-2015 -- License : BSD3 -- -- Maintainer : bos@serpentine.com diff --git a/haddock-library/vendor/attoparsec-0.12.1.1/LICENSE b/haddock-library/vendor/attoparsec-0.13.1.0/LICENSE index 97392a62..97392a62 100644 --- a/haddock-library/vendor/attoparsec-0.12.1.1/LICENSE +++ b/haddock-library/vendor/attoparsec-0.13.1.0/LICENSE diff --git a/haddock-test/haddock-test.cabal b/haddock-test/haddock-test.cabal index 7cb15d7d..56dd1845 100644 --- a/haddock-test/haddock-test.cabal +++ b/haddock-test/haddock-test.cabal @@ -16,13 +16,13 @@ library default-language: Haskell2010 ghc-options: -Wall hs-source-dirs: src - build-depends: base >= 4.3 && < 4.10, bytestring, directory, process, filepath, Cabal, xml, xhtml, syb + build-depends: base >= 4.3 && < 4.11, bytestring, directory, process, filepath, Cabal, xml, xhtml, syb exposed-modules: Test.Haddock Test.Haddock.Config + Test.Haddock.Utils Test.Haddock.Xhtml other-modules: Test.Haddock.Process - Test.Haddock.Utils diff --git a/haddock-test/src/Test/Haddock/Config.hs b/haddock-test/src/Test/Haddock/Config.hs index e1e920f2..988636e4 100644 --- a/haddock-test/src/Test/Haddock/Config.hs +++ b/haddock-test/src/Test/Haddock/Config.hs @@ -165,11 +165,18 @@ loadConfig ccfg dcfg flags files = do cfgEnv <- (:) ("haddock_datadir", dcfgResDir dcfg) <$> getEnvironment systemHaddockPath <- List.lookup "HADDOCK_PATH" <$> getEnvironment - cfgHaddockPath <- case flagsHaddockPath flags <|> systemHaddockPath of + haddockOnPath <- findExecutable "haddock" + + let haddock_path = msum [ flagsHaddockPath flags + , systemHaddockPath + , haddockOnPath + ] + + cfgHaddockPath <- case haddock_path of Just path -> pure path - Nothing -> do - hPutStrLn stderr $ "Haddock executable not specified" - exitFailure + Nothing -> do + hPutStrLn stderr "Haddock executable not found" + exitFailure ghcPath <- init <$> rawSystemStdout normal cfgHaddockPath ["--print-ghc-path"] @@ -186,7 +193,7 @@ loadConfig ccfg dcfg flags files = do , baseDependencies ghcPath ] - let cfgHaddockStdOut = fromMaybe "/dev/null" (flagsHaddockStdOut flags) + let cfgHaddockStdOut = fromMaybe defaultStdOut (flagsHaddockStdOut flags) cfgDiffTool <- if FlagNoDiff `elem` flags then pure Nothing @@ -195,7 +202,7 @@ loadConfig ccfg dcfg flags files = do let cfgAccept = FlagAccept `elem` flags let cfgCheckConfig = ccfg - let cfgDirConfig = dcfg + let cfgDirConfig = dcfg return $ Config { .. } @@ -249,6 +256,14 @@ defaultDiffTool = isAvailable = liftM isJust . findProgramLocation silent +defaultStdOut :: FilePath +#ifdef mingw32_HOST_OS +defaultStdOut = "nul" +#else +defaultStdOut = "/dev/null" +#endif + + processFileArgs :: DirConfig -> [String] -> IO [TestPackage] processFileArgs dcfg [] = processFileArgs' dcfg . filter isValidEntry =<< getDirectoryContents srcDir diff --git a/haddock-test/src/Test/Haddock/Utils.hs b/haddock-test/src/Test/Haddock/Utils.hs index a947fea1..58408aaf 100644 --- a/haddock-test/src/Test/Haddock/Utils.hs +++ b/haddock-test/src/Test/Haddock/Utils.hs @@ -48,3 +48,10 @@ copyFile' :: FilePath -> FilePath -> IO () copyFile' old new = do createDirectoryIfMissing True $ takeDirectory new copyFile old new + + +crlfToLf :: String -> String +crlfToLf "" = "" +crlfToLf ('\r' : '\n' : rest) = '\n' : crlfToLf rest +crlfToLf ('\r' : rest) = '\n' : crlfToLf rest +crlfToLf (other : rest) = other : crlfToLf rest diff --git a/haddock.cabal b/haddock.cabal index fa07ec6b..27869f1d 100644 --- a/haddock.cabal +++ b/haddock.cabal @@ -1,27 +1,48 @@ name: haddock -version: 2.17.3 +version: 2.18.2 synopsis: A documentation-generation tool for Haskell libraries -description: Haddock is a documentation-generation tool for Haskell - libraries +description: + This is Haddock, a tool for automatically generating documentation + from annotated Haskell source code. It is primary intended for documenting + library interfaces, but it should be useful for any kind of Haskell code. + . + Haddock lets you write documentation annotations next to the definitions of + functions and types in the source code, in a syntax that is easy on the eye + when writing the source code (no heavyweight mark-up). + . + Haddock understands Haskell's module system, so you can structure your code + however you like without worrying that internal structure will be exposed in + the generated documentation. For example, it is common to implement a library + in several modules, but define the external API by having a single module + which re-exports parts of these implementation modules. Using Haddock, you can + still write documentation annotations next to the actual definitions of the + functions and types in the library, but the documentation annotations from the + implementation will be propagated to the external API when the documentation is + generated. Abstract types and classes are handled correctly. In fact, even + without any documentation annotations, Haddock can generate useful documentation + from your source code. + . + <<https://cdn.rawgit.com/haskell/haddock/master/doc/cheatsheet/haddocks.svg>> license: BSD3 license-file: LICENSE author: Simon Marlow, David Waern -maintainer: Simon Hengel <sol@typeful.net>, Mateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk> +maintainer: Alex Biehl <alexbiehl@gmail.com>, Simon Hengel <sol@typeful.net>, Mateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk> homepage: http://www.haskell.org/haddock/ bug-reports: https://github.com/haskell/haddock/issues copyright: (c) Simon Marlow, David Waern category: Documentation build-type: Simple -cabal-version: >= 1.10 -stability: experimental +cabal-version: >= 2.0 +tested-with: GHC==8.2.* extra-source-files: - CHANGES + CHANGES.md README.md doc/Makefile doc/README.md doc/*.rst doc/conf.py + driver-test/*.hs haddock-api/src/haddock.sh html-test/src/*.hs html-test/ref/*.html @@ -42,10 +63,11 @@ executable haddock hs-source-dirs: driver ghc-options: -funbox-strict-fields -Wall -fwarn-tabs -O2 -threaded + -- haddock typically only supports a single GHC major version build-depends: - base >= 4.3 && < 4.11 + base >= 4.3 && < 4.12 if flag(in-ghc-tree) - hs-source-dirs: haddock-api/src, haddock-library/vendor/attoparsec-0.12.1.1, haddock-library/src + hs-source-dirs: haddock-api/src, haddock-library/vendor/attoparsec-0.13.1.0, haddock-library/src cpp-options: -DIN_GHC_TREE build-depends: filepath, @@ -55,8 +77,8 @@ executable haddock array, xhtml >= 3000.2 && < 3000.3, Cabal >= 1.10, - ghc-boot == 8.3, - ghc == 8.3, + ghc-boot, + ghc == 8.3.*, bytestring, transformers @@ -84,6 +106,7 @@ executable haddock Documentation.Haddock Haddock Haddock.Interface + Haddock.Interface.Json Haddock.Interface.Rename Haddock.Interface.Create Haddock.Interface.AttachInstances @@ -119,43 +142,60 @@ executable haddock Haddock.Syb Haddock.Convert else - build-depends: haddock-api == 2.17.* + -- in order for haddock's advertised version number to have proper meaning, + -- we pin down to a single haddock-api version. + build-depends: haddock-api == 2.18.2 + + other-modules: + ResponseFile test-suite driver-test type: exitcode-stdio-1.0 default-language: Haskell2010 main-is: Main.hs hs-source-dirs: driver-test, driver + other-modules: + ResponseFile + ResponseFileSpec + build-depends: base, hspec test-suite html-test type: exitcode-stdio-1.0 - default-language: Haskell2010 - main-is: Main.hs - hs-source-dirs: html-test - build-depends: base, filepath, haddock-test == 0.0.1 + -- This tells cabal that this test depends on the executable + -- component 'haddock' from this very same package, as well + -- as adding the build-folder where the `haddock` + -- executable can be found in front of $PATH + build-tool-depends: haddock:haddock + default-language: Haskell2010 + main-is: Main.hs + hs-source-dirs: html-test + build-depends: base, filepath, haddock-test == 0.0.1 test-suite hypsrc-test - type: exitcode-stdio-1.0 - default-language: Haskell2010 - main-is: Main.hs - hs-source-dirs: hypsrc-test - build-depends: base, filepath, haddock-test == 0.0.1 - ghc-options: -Wall -fwarn-tabs + type: exitcode-stdio-1.0 + build-tool-depends: haddock:haddock + default-language: Haskell2010 + main-is: Main.hs + hs-source-dirs: hypsrc-test + build-depends: base, filepath, haddock-test == 0.0.1 + ghc-options: -Wall -fwarn-tabs test-suite latex-test - type: exitcode-stdio-1.0 - default-language: Haskell2010 - main-is: Main.hs - hs-source-dirs: latex-test - build-depends: base, filepath, haddock-test == 0.0.1 + type: exitcode-stdio-1.0 + build-tool-depends: haddock:haddock + default-language: Haskell2010 + main-is: Main.hs + hs-source-dirs: latex-test + build-depends: base, filepath, haddock-test == 0.0.1 test-suite hoogle-test - type: exitcode-stdio-1.0 - default-language: Haskell2010 - main-is: Main.hs - hs-source-dirs: hoogle-test - build-depends: base, filepath, haddock-test == 0.0.1 + type: exitcode-stdio-1.0 + build-tool-depends: haddock:haddock + default-language: Haskell2010 + main-is: Main.hs + hs-source-dirs: hoogle-test + build-depends: base, filepath, haddock-test == 0.0.1 source-repository head type: git diff --git a/hoogle-test/Main.hs b/hoogle-test/Main.hs index 59a98fd0..d19ae585 100644 --- a/hoogle-test/Main.hs +++ b/hoogle-test/Main.hs @@ -1,10 +1,12 @@ {-# LANGUAGE CPP #-} +import Data.Function import System.Environment import System.FilePath import Test.Haddock +import Test.Haddock.Utils checkConfig :: CheckConfig String @@ -12,7 +14,7 @@ checkConfig = CheckConfig { ccfgRead = Just , ccfgClean = \_ -> id , ccfgDump = id - , ccfgEqual = (==) + , ccfgEqual = (==) `on` crlfToLf } diff --git a/html-test/ref/A.html b/html-test/ref/A.html index b58845e5..edd95fe8 100644 --- a/html-test/ref/A.html +++ b/html-test/ref/A.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_A.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/B.html b/html-test/ref/B.html index d82cf2cc..f4ce89d4 100644 --- a/html-test/ref/B.html +++ b/html-test/ref/B.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_B.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/Bold.html b/html-test/ref/Bold.html index 8325419c..a7cb4e7f 100644 --- a/html-test/ref/Bold.html +++ b/html-test/ref/Bold.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_Bold.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/Bug1.html b/html-test/ref/Bug1.html index 4bedbb86..37a37527 100644 --- a/html-test/ref/Bug1.html +++ b/html-test/ref/Bug1.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_Bug1.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/Bug195.html b/html-test/ref/Bug195.html index c6af235a..ca5c2cc0 100644 --- a/html-test/ref/Bug195.html +++ b/html-test/ref/Bug195.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_Bug195.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/Bug2.html b/html-test/ref/Bug2.html index 9ae26bcd..5b88feae 100644 --- a/html-test/ref/Bug2.html +++ b/html-test/ref/Bug2.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_Bug2.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/Bug201.html b/html-test/ref/Bug201.html index c84b55b1..04cb0991 100644 --- a/html-test/ref/Bug201.html +++ b/html-test/ref/Bug201.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_Bug201.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/Bug253.html b/html-test/ref/Bug253.html index 36640332..28482b24 100644 --- a/html-test/ref/Bug253.html +++ b/html-test/ref/Bug253.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_Bug253.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/Bug26.html b/html-test/ref/Bug26.html index 16251c0b..8b0644aa 100644 --- a/html-test/ref/Bug26.html +++ b/html-test/ref/Bug26.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_Bug26.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/Bug280.html b/html-test/ref/Bug280.html index 92eb61b0..6c533a28 100644 --- a/html-test/ref/Bug280.html +++ b/html-test/ref/Bug280.html @@ -1,4 +1,3 @@ -<!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" @@ -7,12 +6,12 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" - >//<![CDATA[ -window.onload = function () {pageLoad();setSynopsis("mini_Bug280.html");}; -//]]> + >// +window.onload = function () {pageLoad();}; +// </script ></head ><body @@ -28,7 +27,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug280.html");}; ></li ></ul ><p class="caption empty" - > </p + ></p ></div ><div id="content" ><div id="module-header" @@ -38,8 +37,8 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug280.html");}; >Copyright</th ><td >Foo<br - />Bar<br - />Baz</td + />Bar<br + />Baz</td ></tr ><tr ><th @@ -55,9 +54,9 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug280.html");}; ><p class="caption" >Description</p ><div class="doc" - ><p - >The module description</p - ></div + ><p + >The module description</p + ></div ></div ><div id="interface" ><h1 @@ -78,4 +77,4 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug280.html");}; ></div ></body ></html -> +>
\ No newline at end of file diff --git a/html-test/ref/Bug294.html b/html-test/ref/Bug294.html index 1d7e0b32..3a82af80 100644 --- a/html-test/ref/Bug294.html +++ b/html-test/ref/Bug294.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_Bug294.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/Bug298.html b/html-test/ref/Bug298.html index 6204819e..cba626b6 100644 --- a/html-test/ref/Bug298.html +++ b/html-test/ref/Bug298.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_Bug298.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/Bug3.html b/html-test/ref/Bug3.html index eaa16f97..4a9cf8bc 100644 --- a/html-test/ref/Bug3.html +++ b/html-test/ref/Bug3.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_Bug3.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/Bug308.html b/html-test/ref/Bug308.html index 915aec4c..d816fef5 100644 --- a/html-test/ref/Bug308.html +++ b/html-test/ref/Bug308.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_Bug308.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/Bug308CrossModule.html b/html-test/ref/Bug308CrossModule.html index b2ae2adf..60f371af 100644 --- a/html-test/ref/Bug308CrossModule.html +++ b/html-test/ref/Bug308CrossModule.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_Bug308CrossModule.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/Bug310.html b/html-test/ref/Bug310.html index 8c5b45b8..468e64eb 100644 --- a/html-test/ref/Bug310.html +++ b/html-test/ref/Bug310.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_Bug310.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/Bug313.html b/html-test/ref/Bug313.html index 131b3382..4fc1682c 100644 --- a/html-test/ref/Bug313.html +++ b/html-test/ref/Bug313.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_Bug313.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/Bug335.html b/html-test/ref/Bug335.html index ea760d41..d1602c7b 100644 --- a/html-test/ref/Bug335.html +++ b/html-test/ref/Bug335.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_Bug335.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/Bug387.html b/html-test/ref/Bug387.html index 25d6d989..27d47e75 100644 --- a/html-test/ref/Bug387.html +++ b/html-test/ref/Bug387.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_Bug387.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/Bug4.html b/html-test/ref/Bug4.html index 22792fc1..fe6f47d1 100644 --- a/html-test/ref/Bug4.html +++ b/html-test/ref/Bug4.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_Bug4.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/Bug6.html b/html-test/ref/Bug6.html index 27e5251d..678f4070 100644 --- a/html-test/ref/Bug6.html +++ b/html-test/ref/Bug6.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_Bug6.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/Bug613.html b/html-test/ref/Bug613.html new file mode 100644 index 00000000..924f37d4 --- /dev/null +++ b/html-test/ref/Bug613.html @@ -0,0 +1,260 @@ +<html xmlns="http://www.w3.org/1999/xhtml" +><head + ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" + /><title + >Bug613</title + ><link href="#" rel="stylesheet" type="text/css" title="Ocean" + /><script src="haddock-util.js" type="text/javascript" + ></script + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script + ><script type="text/javascript" + >// +window.onload = function () {pageLoad();}; +// +</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" + >Bug613</p + ></div + ><div id="synopsis" + ><p id="control.syn" class="caption expander" onclick="toggleSection('syn')" + >Synopsis</p + ><ul id="section.syn" class="hide" onclick="toggleSection('syn')" + ><li class="src short" + ><span class="keyword" + >class</span + > <a href="#" + >Functor</a + > f <span class="keyword" + >where</span + ><ul class="subs" + ></ul + ></li + ><li class="src short" + ><span class="keyword" + >data</span + > <a href="#" + >ThreeVars</a + > a0 a b = <a href="#" + >ThreeVars</a + > a b</li + ></ul + ></div + ><div id="interface" + ><h1 + >Documentation</h1 + ><div class="top" + ><p class="src" + ><span class="keyword" + >class</span + > <a id="t:Functor" class="def" + >Functor</a + > f <span class="keyword" + >where</span + > <a href="#" class="selflink" + >#</a + ></p + ><div class="subs minimal" + ><p class="caption" + >Minimal complete definition</p + ><p class="src" + ><a href="#" + >fmap</a + ></p + ></div + ><div class="subs methods" + ><p class="caption" + >Methods</p + ><p class="src" + ><a id="v:fmap" class="def" + >fmap</a + > :: (a -> b) -> f a -> f b <a href="#" class="selflink" + >#</a + ></p + ></div + ><div class="subs instances" + ><p id="control.i:Functor" class="caption collapser" onclick="toggleSection('i:Functor')" + >Instances</p + ><div id="section.i:Functor" class="show" + ><table + ><tr + ><td class="src clearfix" + ><span class="inst-left" + ><span id="control.i:ic:Functor:Functor:1" class="instance expander" onclick="toggleSection('i:ic:Functor:Functor:1')" + ></span + > <a href="#" + >Functor</a + > (<a href="#" + >Either</a + > a)</span + > <a href="#" class="selflink" + >#</a + ></td + ><td class="doc empty" + ></td + ></tr + ><tr + ><td colspan="2" + ><div id="section.i:ic:Functor:Functor:1" class="inst-details hide" + ><div class="subs methods" + ><p class="caption" + >Methods</p + ><p class="src" + ><a href="#" + >fmap</a + > :: (a0 -> b) -> <a href="#" + >Either</a + > a a0 -> <a href="#" + >Either</a + > a b <a href="#" class="selflink" + >#</a + ></p + ></div + ></div + ></td + ></tr + ><tr + ><td class="src clearfix" + ><span class="inst-left" + ><span id="control.i:ic:Functor:Functor:2" class="instance expander" onclick="toggleSection('i:ic:Functor:Functor:2')" + ></span + > <a href="#" + >Functor</a + > (<a href="#" + >ThreeVars</a + > a0 a)</span + > <a href="#" class="selflink" + >#</a + ></td + ><td class="doc empty" + ></td + ></tr + ><tr + ><td colspan="2" + ><div id="section.i:ic:Functor:Functor:2" class="inst-details hide" + ><div class="subs methods" + ><p class="caption" + >Methods</p + ><p class="src" + ><a href="#" + >fmap</a + > :: (a1 -> b) -> <a href="#" + >ThreeVars</a + > a0 a a1 -> <a href="#" + >ThreeVars</a + > a0 a b <a href="#" class="selflink" + >#</a + ></p + ></div + ></div + ></td + ></tr + ></table + ></div + ></div + ></div + ><div class="top" + ><p class="src" + ><span class="keyword" + >data</span + > <a id="t:ThreeVars" class="def" + >ThreeVars</a + > a0 a b <a href="#" class="selflink" + >#</a + ></p + ><div class="doc" + ><p + >Phantom type a0 is added to block the first renaming from a to a0. This ensures that the renamer doesn't create a new conflict</p + ></div + ><div class="subs constructors" + ><p class="caption" + >Constructors</p + ><table + ><tr + ><td class="src" + ><a id="v:ThreeVars" class="def" + >ThreeVars</a + > a b</td + ><td class="doc empty" + ></td + ></tr + ></table + ></div + ><div class="subs instances" + ><p id="control.i:ThreeVars" class="caption collapser" onclick="toggleSection('i:ThreeVars')" + >Instances</p + ><div id="section.i:ThreeVars" class="show" + ><table + ><tr + ><td class="src clearfix" + ><span class="inst-left" + ><span id="control.i:id:ThreeVars:Functor:1" class="instance expander" onclick="toggleSection('i:id:ThreeVars:Functor:1')" + ></span + > <a href="#" + >Functor</a + > (<a href="#" + >ThreeVars</a + > a0 a)</span + > <a href="#" class="selflink" + >#</a + ></td + ><td class="doc empty" + ></td + ></tr + ><tr + ><td colspan="2" + ><div id="section.i:id:ThreeVars:Functor:1" class="inst-details hide" + ><div class="subs methods" + ><p class="caption" + >Methods</p + ><p class="src" + ><a href="#" + >fmap</a + > :: (a1 -> b) -> <a href="#" + >ThreeVars</a + > a0 a a1 -> <a href="#" + >ThreeVars</a + > a0 a b <a href="#" class="selflink" + >#</a + ></p + ></div + ></div + ></td + ></tr + ></table + ></div + ></div + ></div + ></div + ></div + ><div id="footer" + ></div + ></body + ></html +>
\ No newline at end of file diff --git a/html-test/ref/Bug647.html b/html-test/ref/Bug647.html new file mode 100644 index 00000000..086840ab --- /dev/null +++ b/html-test/ref/Bug647.html @@ -0,0 +1,114 @@ +<html xmlns="http://www.w3.org/1999/xhtml" +><head + ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" + /><title + >Bug647</title + ><link href="#" rel="stylesheet" type="text/css" title="Ocean" + /><script src="haddock-util.js" type="text/javascript" + ></script + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script + ><script type="text/javascript" + >// +window.onload = function () {pageLoad();}; +// +</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" + >Bug647</p + ></div + ><div id="interface" + ><h1 + >Documentation</h1 + ><div class="top" + ><p class="src" + ><span class="keyword" + >class</span + > <a id="t:Bug647" class="def" + >Bug647</a + > a <span class="keyword" + >where</span + > <a href="#" class="selflink" + >#</a + ></p + ><div class="subs minimal" + ><p class="caption" + >Minimal complete definition</p + ><p class="src" + ><a href="#" + >f</a + ></p + ></div + ><div class="subs methods" + ><p class="caption" + >Methods</p + ><p class="src" + ><a id="v:f" class="def" + >f</a + > <a href="#" class="selflink" + >#</a + ></p + ><div class="subs arguments" + ><p class="caption" + >Arguments</p + ><table + ><tr + ><td class="src" + >:: a</td + ><td class="doc" + ><p + >doc for arg1</p + ></td + ></tr + ><tr + ><td class="src" + >-> a</td + ><td class="doc" + ><p + >doc for arg2</p + ></td + ></tr + ><tr + ><td class="src" + >-> a</td + ><td class="doc" + ><p + >doc for arg3</p + ></td + ></tr + ></table + ></div + ></div + ></div + ></div + ></div + ><div id="footer" + ></div + ></body + ></html +>
\ No newline at end of file diff --git a/html-test/ref/Bug7.html b/html-test/ref/Bug7.html index fe9e4569..ef26d62f 100644 --- a/html-test/ref/Bug7.html +++ b/html-test/ref/Bug7.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_Bug7.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/Bug8.html b/html-test/ref/Bug8.html index d32e0dbb..1b6c1525 100644 --- a/html-test/ref/Bug8.html +++ b/html-test/ref/Bug8.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_Bug8.html");}; +window.onload = function () {pageLoad();}; // </script ></head @@ -89,7 +89,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Bug8.html"); ><p class="src" ><a id="v:-45--45--62-" class="def" >(-->)</a - > :: t -> t1 -> <a href="#" + > :: p1 -> p2 -> <a href="#" >Typ</a > <span class="fixity" >infix 9</span diff --git a/html-test/ref/Bug85.html b/html-test/ref/Bug85.html index 90042380..467dda0e 100644 --- a/html-test/ref/Bug85.html +++ b/html-test/ref/Bug85.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_Bug85.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/BugDeprecated.html b/html-test/ref/BugDeprecated.html index a6da413e..96fdab34 100644 --- a/html-test/ref/BugDeprecated.html +++ b/html-test/ref/BugDeprecated.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_BugDeprecated.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/BugExportHeadings.html b/html-test/ref/BugExportHeadings.html index e8fd6fa6..2a05bed9 100644 --- a/html-test/ref/BugExportHeadings.html +++ b/html-test/ref/BugExportHeadings.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_BugExportHeadings.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/Bugs.html b/html-test/ref/Bugs.html index cf87d82f..c29004f3 100644 --- a/html-test/ref/Bugs.html +++ b/html-test/ref/Bugs.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_Bugs.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/BundledPatterns.html b/html-test/ref/BundledPatterns.html new file mode 100644 index 00000000..bf6c073c --- /dev/null +++ b/html-test/ref/BundledPatterns.html @@ -0,0 +1,474 @@ +<html xmlns="http://www.w3.org/1999/xhtml" +><head + ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" + /><title + >BundledPatterns</title + ><link href="#" rel="stylesheet" type="text/css" title="Ocean" + /><script src="haddock-util.js" type="text/javascript" + ></script + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script + ><script type="text/javascript" + >// +window.onload = function () {pageLoad();}; +// +</script + ></head + ><body + ><div id="package-header" + ><ul class="links" id="page-menu" + ><li + ><a href="#" + >Contents</a + ></li + ><li + ><a href="#" + >Index</a + ></li + ></ul + ><p class="caption empty" + ></p + ></div + ><div id="content" + ><div id="module-header" + ><table class="info" + ><tr + ><th + >Safe Haskell</th + ><td + >None</td + ></tr + ></table + ><p class="caption" + >BundledPatterns</p + ></div + ><div id="synopsis" + ><p id="control.syn" class="caption expander" onclick="toggleSection('syn')" + >Synopsis</p + ><ul id="section.syn" class="hide" onclick="toggleSection('syn')" + ><li class="src short" + ><span class="keyword" + >data</span + > <a href="#" + >Vec</a + > :: <a href="#" + >Nat</a + > -> <a href="#" + >*</a + > -> <a href="#" + >*</a + > <span class="keyword" + >where</span + ><ul class="subs" + ><li + ><a href="#" + >Nil</a + > :: <a href="#" + >Vec</a + > 0 a</li + ><li + ><span class="keyword" + >pattern</span + > <a href="#" + >(:>)</a + > :: a -> <a href="#" + >Vec</a + > n a -> <a href="#" + >Vec</a + > (n <a href="#" + >+</a + > 1) a</li + ></ul + ></li + ><li class="src short" + ><span class="keyword" + >data</span + > <a href="#" + >RTree</a + > :: <a href="#" + >Nat</a + > -> <a href="#" + >*</a + > -> <a href="#" + >*</a + > <span class="keyword" + >where</span + ><ul class="subs" + ><li + ><span class="keyword" + >pattern</span + > <a href="#" + >LR</a + > :: a -> <a href="#" + >RTree</a + > 0 a</li + ><li + ><span class="keyword" + >pattern</span + > <a href="#" + >BR</a + > :: <a href="#" + >RTree</a + > d a -> <a href="#" + >RTree</a + > d a -> <a href="#" + >RTree</a + > (d <a href="#" + >+</a + > 1) a</li + ></ul + ></li + ></ul + ></div + ><div id="interface" + ><h1 + >Documentation</h1 + ><div class="top" + ><p class="src" + ><span class="keyword" + >data</span + > <a id="t:Vec" class="def" + >Vec</a + > :: <a href="#" + >Nat</a + > -> <a href="#" + >*</a + > -> <a href="#" + >*</a + > <span class="keyword" + >where</span + > <a href="#" class="selflink" + >#</a + ></p + ><div class="doc" + ><p + >Fixed size vectors.</p + ><ul + ><li + >Lists with their length encoded in their type</li + ><li + ><code + ><a href="#" + >Vec</a + ></code + >tor elements have an <strong + >ASCENDING</strong + > subscript starting from 0 and + ending at <code + ><code + ><a href="#" + >length</a + ></code + > - 1</code + >.</li + ></ul + ></div + ><div class="subs constructors" + ><p class="caption" + >Constructors</p + ><table + ><tr + ><td class="src" + ><a id="v:Nil" class="def" + >Nil</a + > :: <a href="#" + >Vec</a + > 0 a</td + ><td class="doc empty" + ></td + ></tr + ></table + ></div + ><div class="subs bundled-patterns" + ><p class="caption" + >Bundled Patterns</p + ><table + ><tr + ><td class="src" + ><span class="keyword" + >pattern</span + > <a id="v::-62-" class="def" + >(:>)</a + > :: a -> <a href="#" + >Vec</a + > n a -> <a href="#" + >Vec</a + > (n <a href="#" + >+</a + > 1) a <span class="fixity" + >infixr 5</span + ><span class="rightedge" + ></span + ></td + ><td class="doc" + ><p + >Add an element to the head of a vector.</p + ><pre class="screen" + ><code class="prompt" + >>>> </code + ><strong class="userinput" + ><code + >3:>4:>5:>Nil +</code + ></strong + ><3,4,5> +<code class="prompt" + >>>> </code + ><strong class="userinput" + ><code + >let x = 3:>4:>5:>Nil +</code + ></strong + ><code class="prompt" + >>>> </code + ><strong class="userinput" + ><code + >:t x +</code + ></strong + >x :: Num a => Vec 3 a +</pre + ><p + >Can be used as a pattern:</p + ><pre class="screen" + ><code class="prompt" + >>>> </code + ><strong class="userinput" + ><code + >let f (x :> y :> _) = x + y +</code + ></strong + ><code class="prompt" + >>>> </code + ><strong class="userinput" + ><code + >:t f +</code + ></strong + >f :: Num a => Vec ((n + 1) + 1) a -> a +<code class="prompt" + >>>> </code + ><strong class="userinput" + ><code + >f (3:>4:>5:>6:>7:>Nil) +</code + ></strong + >7 +</pre + ><p + >Also in conjunctions with (<code + >:<</code + >):</p + ><pre class="screen" + ><code class="prompt" + >>>> </code + ><strong class="userinput" + ><code + >let g (a :> b :> (_ :< y :< x)) = a + b + x + y +</code + ></strong + ><code class="prompt" + >>>> </code + ><strong class="userinput" + ><code + >:t g +</code + ></strong + >g :: Num a => Vec ((((n + 1) + 1) + 1) + 1) a -> a +<code class="prompt" + >>>> </code + ><strong class="userinput" + ><code + >g (1:>2:>3:>4:>5:>Nil) +</code + ></strong + >12 +</pre + ></td + ></tr + ></table + ></div + ></div + ><div class="top" + ><p class="src" + ><span class="keyword" + >data</span + > <a id="t:RTree" class="def" + >RTree</a + > :: <a href="#" + >Nat</a + > -> <a href="#" + >*</a + > -> <a href="#" + >*</a + > <span class="keyword" + >where</span + > <a href="#" class="selflink" + >#</a + ></p + ><div class="doc" + ><p + >Perfect depth binary tree.</p + ><ul + ><li + >Only has elements at the leaf of the tree</li + ><li + >A tree of depth <em + >d</em + > has <em + >2^d</em + > elements.</li + ></ul + ></div + ><div class="subs bundled-patterns" + ><p class="caption" + >Bundled Patterns</p + ><table + ><tr + ><td class="src" + ><span class="keyword" + >pattern</span + > <a id="v:LR" class="def" + >LR</a + > :: a -> <a href="#" + >RTree</a + > 0 a</td + ><td class="doc" + ><p + >Leaf of a perfect depth tree</p + ><pre class="screen" + ><code class="prompt" + >>>> </code + ><strong class="userinput" + ><code + >LR 1 +</code + ></strong + >1 +<code class="prompt" + >>>> </code + ><strong class="userinput" + ><code + >let x = LR 1 +</code + ></strong + ><code class="prompt" + >>>> </code + ><strong class="userinput" + ><code + >:t x +</code + ></strong + >x :: Num a => RTree 0 a +</pre + ><p + >Can be used as a pattern:</p + ><pre class="screen" + ><code class="prompt" + >>>> </code + ><strong class="userinput" + ><code + >let f (LR a) (LR b) = a + b +</code + ></strong + ><code class="prompt" + >>>> </code + ><strong class="userinput" + ><code + >:t f +</code + ></strong + >f :: Num a => RTree 0 a -> RTree 0 a -> a +<code class="prompt" + >>>> </code + ><strong class="userinput" + ><code + >f (LR 1) (LR 2) +</code + ></strong + >3 +</pre + ></td + ></tr + ><tr + ><td class="src" + ><span class="keyword" + >pattern</span + > <a id="v:BR" class="def" + >BR</a + > :: <a href="#" + >RTree</a + > d a -> <a href="#" + >RTree</a + > d a -> <a href="#" + >RTree</a + > (d <a href="#" + >+</a + > 1) a</td + ><td class="doc" + ><p + >Branch of a perfect depth tree</p + ><pre class="screen" + ><code class="prompt" + >>>> </code + ><strong class="userinput" + ><code + >BR (LR 1) (LR 2) +</code + ></strong + ><1,2> +<code class="prompt" + >>>> </code + ><strong class="userinput" + ><code + >let x = BR (LR 1) (LR 2) +</code + ></strong + ><code class="prompt" + >>>> </code + ><strong class="userinput" + ><code + >:t x +</code + ></strong + >x :: Num a => RTree 1 a +</pre + ><p + >Case be used a pattern:</p + ><pre class="screen" + ><code class="prompt" + >>>> </code + ><strong class="userinput" + ><code + >let f (BR (LR a) (LR b)) = LR (a + b) +</code + ></strong + ><code class="prompt" + >>>> </code + ><strong class="userinput" + ><code + >:t f +</code + ></strong + >f :: Num a => RTree 1 a -> RTree 0 a +<code class="prompt" + >>>> </code + ><strong class="userinput" + ><code + >f (BR (LR 1) (LR 2)) +</code + ></strong + >3 +</pre + ></td + ></tr + ></table + ></div + ></div + ></div + ></div + ><div id="footer" + ></div + ></body + ></html +>
\ No newline at end of file diff --git a/html-test/ref/BundledPatterns2.html b/html-test/ref/BundledPatterns2.html new file mode 100644 index 00000000..3d1d4da0 --- /dev/null +++ b/html-test/ref/BundledPatterns2.html @@ -0,0 +1,472 @@ +<html xmlns="http://www.w3.org/1999/xhtml" +><head + ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" + /><title + >BundledPatterns2</title + ><link href="#" rel="stylesheet" type="text/css" title="Ocean" + /><script src="haddock-util.js" type="text/javascript" + ></script + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script + ><script type="text/javascript" + >// +window.onload = function () {pageLoad();}; +// +</script + ></head + ><body + ><div id="package-header" + ><ul class="links" id="page-menu" + ><li + ><a href="#" + >Contents</a + ></li + ><li + ><a href="#" + >Index</a + ></li + ></ul + ><p class="caption empty" + ></p + ></div + ><div id="content" + ><div id="module-header" + ><table class="info" + ><tr + ><th + >Safe Haskell</th + ><td + >None</td + ></tr + ></table + ><p class="caption" + >BundledPatterns2</p + ></div + ><div id="synopsis" + ><p id="control.syn" class="caption expander" onclick="toggleSection('syn')" + >Synopsis</p + ><ul id="section.syn" class="hide" onclick="toggleSection('syn')" + ><li class="src short" + ><span class="keyword" + >data</span + > <a href="#" + >Vec</a + > :: <a href="#" + >Nat</a + > -> <a href="#" + >*</a + > -> <a href="#" + >*</a + > <span class="keyword" + >where</span + ><ul class="subs" + ><li + ><span class="keyword" + >pattern</span + > <a href="#" + >Empty</a + > :: <a href="#" + >Vec</a + > 0 a</li + ><li + ><span class="keyword" + >pattern</span + > <a href="#" + >(:>)</a + > :: a -> <a href="#" + >Vec</a + > n a -> <a href="#" + >Vec</a + > (n <a href="#" + >+</a + > 1) a</li + ></ul + ></li + ><li class="src short" + ><span class="keyword" + >data</span + > <a href="#" + >RTree</a + > :: <a href="#" + >Nat</a + > -> <a href="#" + >*</a + > -> <a href="#" + >*</a + > <span class="keyword" + >where</span + ><ul class="subs" + ><li + ><span class="keyword" + >pattern</span + > <a href="#" + >LR</a + > :: a -> <a href="#" + >RTree</a + > 0 a</li + ><li + ><span class="keyword" + >pattern</span + > <a href="#" + >BR</a + > :: <a href="#" + >RTree</a + > d a -> <a href="#" + >RTree</a + > d a -> <a href="#" + >RTree</a + > (d <a href="#" + >+</a + > 1) a</li + ></ul + ></li + ></ul + ></div + ><div id="interface" + ><h1 + >Documentation</h1 + ><div class="top" + ><p class="src" + ><span class="keyword" + >data</span + > <a id="t:Vec" class="def" + >Vec</a + > :: <a href="#" + >Nat</a + > -> <a href="#" + >*</a + > -> <a href="#" + >*</a + > <span class="keyword" + >where</span + > <a href="#" class="selflink" + >#</a + ></p + ><div class="doc" + ><p + >Fixed size vectors.</p + ><ul + ><li + >Lists with their length encoded in their type</li + ><li + ><code + ><a href="#" + >Vec</a + ></code + >tor elements have an <strong + >ASCENDING</strong + > subscript starting from 0 and + ending at <code + ><code + ><a href="#" + >length</a + ></code + > - 1</code + >.</li + ></ul + ></div + ><div class="subs bundled-patterns" + ><p class="caption" + >Bundled Patterns</p + ><table + ><tr + ><td class="src" + ><span class="keyword" + >pattern</span + > <a id="v:Empty" class="def" + >Empty</a + > :: <a href="#" + >Vec</a + > 0 a</td + ><td class="doc empty" + ></td + ></tr + ><tr + ><td class="src" + ><span class="keyword" + >pattern</span + > <a id="v::-62-" class="def" + >(:>)</a + > :: a -> <a href="#" + >Vec</a + > n a -> <a href="#" + >Vec</a + > (n <a href="#" + >+</a + > 1) a <span class="fixity" + >infixr 5</span + ><span class="rightedge" + ></span + ></td + ><td class="doc" + ><p + >Add an element to the head of a vector.</p + ><pre class="screen" + ><code class="prompt" + >>>> </code + ><strong class="userinput" + ><code + >3:>4:>5:>Nil +</code + ></strong + ><3,4,5> +<code class="prompt" + >>>> </code + ><strong class="userinput" + ><code + >let x = 3:>4:>5:>Nil +</code + ></strong + ><code class="prompt" + >>>> </code + ><strong class="userinput" + ><code + >:t x +</code + ></strong + >x :: Num a => Vec 3 a +</pre + ><p + >Can be used as a pattern:</p + ><pre class="screen" + ><code class="prompt" + >>>> </code + ><strong class="userinput" + ><code + >let f (x :> y :> _) = x + y +</code + ></strong + ><code class="prompt" + >>>> </code + ><strong class="userinput" + ><code + >:t f +</code + ></strong + >f :: Num a => Vec ((n + 1) + 1) a -> a +<code class="prompt" + >>>> </code + ><strong class="userinput" + ><code + >f (3:>4:>5:>6:>7:>Nil) +</code + ></strong + >7 +</pre + ><p + >Also in conjunctions with (<code + >:<</code + >):</p + ><pre class="screen" + ><code class="prompt" + >>>> </code + ><strong class="userinput" + ><code + >let g (a :> b :> (_ :< y :< x)) = a + b + x + y +</code + ></strong + ><code class="prompt" + >>>> </code + ><strong class="userinput" + ><code + >:t g +</code + ></strong + >g :: Num a => Vec ((((n + 1) + 1) + 1) + 1) a -> a +<code class="prompt" + >>>> </code + ><strong class="userinput" + ><code + >g (1:>2:>3:>4:>5:>Nil) +</code + ></strong + >12 +</pre + ></td + ></tr + ></table + ></div + ></div + ><div class="top" + ><p class="src" + ><span class="keyword" + >data</span + > <a id="t:RTree" class="def" + >RTree</a + > :: <a href="#" + >Nat</a + > -> <a href="#" + >*</a + > -> <a href="#" + >*</a + > <span class="keyword" + >where</span + > <a href="#" class="selflink" + >#</a + ></p + ><div class="doc" + ><p + >Perfect depth binary tree.</p + ><ul + ><li + >Only has elements at the leaf of the tree</li + ><li + >A tree of depth <em + >d</em + > has <em + >2^d</em + > elements.</li + ></ul + ></div + ><div class="subs bundled-patterns" + ><p class="caption" + >Bundled Patterns</p + ><table + ><tr + ><td class="src" + ><span class="keyword" + >pattern</span + > <a id="v:LR" class="def" + >LR</a + > :: a -> <a href="#" + >RTree</a + > 0 a</td + ><td class="doc" + ><p + >Leaf of a perfect depth tree</p + ><pre class="screen" + ><code class="prompt" + >>>> </code + ><strong class="userinput" + ><code + >LR 1 +</code + ></strong + >1 +<code class="prompt" + >>>> </code + ><strong class="userinput" + ><code + >let x = LR 1 +</code + ></strong + ><code class="prompt" + >>>> </code + ><strong class="userinput" + ><code + >:t x +</code + ></strong + >x :: Num a => RTree 0 a +</pre + ><p + >Can be used as a pattern:</p + ><pre class="screen" + ><code class="prompt" + >>>> </code + ><strong class="userinput" + ><code + >let f (LR a) (LR b) = a + b +</code + ></strong + ><code class="prompt" + >>>> </code + ><strong class="userinput" + ><code + >:t f +</code + ></strong + >f :: Num a => RTree 0 a -> RTree 0 a -> a +<code class="prompt" + >>>> </code + ><strong class="userinput" + ><code + >f (LR 1) (LR 2) +</code + ></strong + >3 +</pre + ></td + ></tr + ><tr + ><td class="src" + ><span class="keyword" + >pattern</span + > <a id="v:BR" class="def" + >BR</a + > :: <a href="#" + >RTree</a + > d a -> <a href="#" + >RTree</a + > d a -> <a href="#" + >RTree</a + > (d <a href="#" + >+</a + > 1) a</td + ><td class="doc" + ><p + >Branch of a perfect depth tree</p + ><pre class="screen" + ><code class="prompt" + >>>> </code + ><strong class="userinput" + ><code + >BR (LR 1) (LR 2) +</code + ></strong + ><1,2> +<code class="prompt" + >>>> </code + ><strong class="userinput" + ><code + >let x = BR (LR 1) (LR 2) +</code + ></strong + ><code class="prompt" + >>>> </code + ><strong class="userinput" + ><code + >:t x +</code + ></strong + >x :: Num a => RTree 1 a +</pre + ><p + >Case be used a pattern:</p + ><pre class="screen" + ><code class="prompt" + >>>> </code + ><strong class="userinput" + ><code + >let f (BR (LR a) (LR b)) = LR (a + b) +</code + ></strong + ><code class="prompt" + >>>> </code + ><strong class="userinput" + ><code + >:t f +</code + ></strong + >f :: Num a => RTree 1 a -> RTree 0 a +<code class="prompt" + >>>> </code + ><strong class="userinput" + ><code + >f (BR (LR 1) (LR 2)) +</code + ></strong + >3 +</pre + ></td + ></tr + ></table + ></div + ></div + ></div + ></div + ><div id="footer" + ></div + ></body + ></html +>
\ No newline at end of file diff --git a/html-test/ref/ConstructorPatternExport.html b/html-test/ref/ConstructorPatternExport.html new file mode 100644 index 00000000..20f00d0f --- /dev/null +++ b/html-test/ref/ConstructorPatternExport.html @@ -0,0 +1,124 @@ +<html xmlns="http://www.w3.org/1999/xhtml" +><head + ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" + /><title + >ConstructorPatternExport</title + ><link href="#" rel="stylesheet" type="text/css" title="Ocean" + /><script src="haddock-util.js" type="text/javascript" + ></script + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script + ><script type="text/javascript" + >// +window.onload = function () {pageLoad();}; +// +</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" + >ConstructorPatternExport</p + ></div + ><div id="interface" + ><h1 + >Documentation</h1 + ><div class="top" + ><p class="src" + ><span class="keyword" + >pattern</span + > <a id="v:FooCons" class="def" + >FooCons</a + > :: <a href="#" + >String</a + > -> a -> Foo a <a href="#" class="selflink" + >#</a + ></p + ></div + ><div class="top" + ><p class="src" + ><span class="keyword" + >pattern</span + > <a id="v:MyRecCons" class="def" + >MyRecCons</a + > :: <a href="#" + >Bool</a + > -> <a href="#" + >Int</a + > -> MyRec <a href="#" class="selflink" + >#</a + ></p + ></div + ><div class="top" + ><p class="src" + ><span class="keyword" + >pattern</span + > <a id="v::-43-" class="def" + >(:+)</a + > :: <a href="#" + >String</a + > -> a -> MyInfix a <a href="#" class="selflink" + >#</a + ></p + ></div + ><div class="top" + ><p class="src" + ><span class="keyword" + >pattern</span + > <a id="v:BlubCons" class="def" + >BlubCons</a + > :: () => <a href="#" + >Show</a + > b => b -> Blub <a href="#" class="selflink" + >#</a + ></p + ></div + ><div class="top" + ><p class="src" + ><span class="keyword" + >pattern</span + > <a id="v:MyGADTCons" class="def" + >MyGADTCons</a + > :: () => <span class="keyword" + >forall</span + > a. <a href="#" + >Eq</a + > a => a -> <a href="#" + >Int</a + > -> MyGADT (<a href="#" + >Maybe</a + > <a href="#" + >String</a + >) <a href="#" class="selflink" + >#</a + ></p + ></div + ></div + ></div + ><div id="footer" + ></div + ></body + ></html +>
\ No newline at end of file diff --git a/html-test/ref/DeprecatedClass.html b/html-test/ref/DeprecatedClass.html index 43e1a255..f055f36f 100644 --- a/html-test/ref/DeprecatedClass.html +++ b/html-test/ref/DeprecatedClass.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedClass.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/DeprecatedData.html b/html-test/ref/DeprecatedData.html index 2e53f3ea..aeb2a7c8 100644 --- a/html-test/ref/DeprecatedData.html +++ b/html-test/ref/DeprecatedData.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedData.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/DeprecatedFunction.html b/html-test/ref/DeprecatedFunction.html index 8ac2218a..f4381d96 100644 --- a/html-test/ref/DeprecatedFunction.html +++ b/html-test/ref/DeprecatedFunction.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedFunction.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/DeprecatedFunction2.html b/html-test/ref/DeprecatedFunction2.html index 545e3d72..b8985bcd 100644 --- a/html-test/ref/DeprecatedFunction2.html +++ b/html-test/ref/DeprecatedFunction2.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedFunction2.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/DeprecatedFunction3.html b/html-test/ref/DeprecatedFunction3.html index fc20977e..b62e1ee3 100644 --- a/html-test/ref/DeprecatedFunction3.html +++ b/html-test/ref/DeprecatedFunction3.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedFunction3.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/DeprecatedModule.html b/html-test/ref/DeprecatedModule.html index 0811319d..84c7a885 100644 --- a/html-test/ref/DeprecatedModule.html +++ b/html-test/ref/DeprecatedModule.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedModule.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/DeprecatedModule2.html b/html-test/ref/DeprecatedModule2.html index db453568..862f79ee 100644 --- a/html-test/ref/DeprecatedModule2.html +++ b/html-test/ref/DeprecatedModule2.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedModule2.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/DeprecatedNewtype.html b/html-test/ref/DeprecatedNewtype.html index 3af56b1b..a03d63fb 100644 --- a/html-test/ref/DeprecatedNewtype.html +++ b/html-test/ref/DeprecatedNewtype.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedNewtype.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/DeprecatedReExport.html b/html-test/ref/DeprecatedReExport.html index 595ae4ca..52f2b8e9 100644 --- a/html-test/ref/DeprecatedReExport.html +++ b/html-test/ref/DeprecatedReExport.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedReExport.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/DeprecatedRecord.html b/html-test/ref/DeprecatedRecord.html index 82da6d30..79b7b7f9 100644 --- a/html-test/ref/DeprecatedRecord.html +++ b/html-test/ref/DeprecatedRecord.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedRecord.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/DeprecatedTypeFamily.html b/html-test/ref/DeprecatedTypeFamily.html index c31eae53..1d94e99b 100644 --- a/html-test/ref/DeprecatedTypeFamily.html +++ b/html-test/ref/DeprecatedTypeFamily.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedTypeFamily.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/DeprecatedTypeSynonym.html b/html-test/ref/DeprecatedTypeSynonym.html index df0050ed..cb7a3afe 100644 --- a/html-test/ref/DeprecatedTypeSynonym.html +++ b/html-test/ref/DeprecatedTypeSynonym.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_DeprecatedTypeSynonym.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/DuplicateRecordFields.html b/html-test/ref/DuplicateRecordFields.html new file mode 100644 index 00000000..4430b50a --- /dev/null +++ b/html-test/ref/DuplicateRecordFields.html @@ -0,0 +1,160 @@ +<html xmlns="http://www.w3.org/1999/xhtml" +><head + ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" + /><title + >DuplicateRecordFields</title + ><link href="#" rel="stylesheet" type="text/css" title="Ocean" + /><script src="haddock-util.js" type="text/javascript" + ></script + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script + ><script type="text/javascript" + >// +window.onload = function () {pageLoad();}; +// +</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" + >DuplicateRecordFields</p + ></div + ><div id="interface" + ><h1 + >Documentation</h1 + ><div class="top" + ><p class="src" + ><span class="keyword" + >data</span + > <a id="t:RawReplay" class="def" + >RawReplay</a + > <a href="#" class="selflink" + >#</a + ></p + ><div class="subs constructors" + ><p class="caption" + >Constructors</p + ><table + ><tr + ><td class="src" + ><a id="v:RawReplay" class="def" + >RawReplay</a + ></td + ><td class="doc empty" + ></td + ></tr + ><tr + ><td colspan="2" + ><div class="subs fields" + ><p class="caption" + >Fields</p + ><ul + ><li + ><dfn class="src" + ><a id="v:headerSize" class="def" + >headerSize</a + > :: Int</dfn + ><div class="doc" + ><p + >The byte size of the first section.</p + ></div + ></li + ><li + ><dfn class="src" + ><a id="v:headerCRC" class="def" + >headerCRC</a + > :: Int</dfn + ><div class="doc" + ><p + >The CRC of the first section.</p + ></div + ></li + ><li + ><dfn class="src" + ><a id="v:header" class="def" + >header</a + > :: Int</dfn + ><div class="doc" + ><p + >The first section.</p + ></div + ></li + ><li + ><dfn class="src" + ><a id="v:contentSize" class="def" + >contentSize</a + > :: Int</dfn + ><div class="doc" + ><p + >The byte size of the second section.</p + ></div + ></li + ><li + ><dfn class="src" + ><a id="v:contentCRC" class="def" + >contentCRC</a + > :: Int</dfn + ><div class="doc" + ><p + >The CRC of the second section.</p + ></div + ></li + ><li + ><dfn class="src" + ><a id="v:content" class="def" + >content</a + > :: Int</dfn + ><div class="doc" + ><p + >The second section.</p + ></div + ></li + ><li + ><dfn class="src" + ><a id="v:footer" class="def" + >footer</a + > :: Int</dfn + ><div class="doc" + ><p + >Arbitrary data after the second section. In replays generated by + Rocket League, this is always empty. However it is not technically + invalid to put something here.</p + ></div + ></li + ></ul + ></div + ></td + ></tr + ></table + ></div + ></div + ></div + ></div + ><div id="footer" + ></div + ></body + ></html +>
\ No newline at end of file diff --git a/html-test/ref/Examples.html b/html-test/ref/Examples.html index e885928b..f706eef1 100644 --- a/html-test/ref/Examples.html +++ b/html-test/ref/Examples.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_Examples.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/Extensions.html b/html-test/ref/Extensions.html index 554bab12..e21785c0 100644 --- a/html-test/ref/Extensions.html +++ b/html-test/ref/Extensions.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_Extensions.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/FunArgs.html b/html-test/ref/FunArgs.html index d1ee154a..df597e12 100644 --- a/html-test/ref/FunArgs.html +++ b/html-test/ref/FunArgs.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_FunArgs.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/GADTRecords.html b/html-test/ref/GADTRecords.html index 7cec535c..3b036aae 100644 --- a/html-test/ref/GADTRecords.html +++ b/html-test/ref/GADTRecords.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_GADTRecords.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/Hash.html b/html-test/ref/Hash.html index 85c61f62..4ad1c27e 100644 --- a/html-test/ref/Hash.html +++ b/html-test/ref/Hash.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_Hash.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/HiddenInstances.html b/html-test/ref/HiddenInstances.html index 90cb1c3b..8c7312d7 100644 --- a/html-test/ref/HiddenInstances.html +++ b/html-test/ref/HiddenInstances.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_HiddenInstances.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/HiddenInstancesB.html b/html-test/ref/HiddenInstancesB.html index fc8824fa..77af69d0 100644 --- a/html-test/ref/HiddenInstancesB.html +++ b/html-test/ref/HiddenInstancesB.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_HiddenInstancesB.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/Hyperlinks.html b/html-test/ref/Hyperlinks.html index bb19f4bc..db1953e3 100644 --- a/html-test/ref/Hyperlinks.html +++ b/html-test/ref/Hyperlinks.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_Hyperlinks.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/IgnoreExports.html b/html-test/ref/IgnoreExports.html index 746a3aa5..262bb769 100644 --- a/html-test/ref/IgnoreExports.html +++ b/html-test/ref/IgnoreExports.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_IgnoreExports.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/ImplicitParams.html b/html-test/ref/ImplicitParams.html index 95128b9d..d22e7f4c 100644 --- a/html-test/ref/ImplicitParams.html +++ b/html-test/ref/ImplicitParams.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_ImplicitParams.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/Instances.html b/html-test/ref/Instances.html index 697bfa1b..c9ca6f82 100644 --- a/html-test/ref/Instances.html +++ b/html-test/ref/Instances.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_Instances.html");}; +window.onload = function () {pageLoad();}; // </script ></head @@ -102,9 +102,9 @@ window.onload = function () {pageLoad();setSynopsis("mini_Instances.html&qu ><~~</a > <a href="#" >Int</a - >) -> a -> a <a href="#" + >) -> a0 -> a <a href="#" ><~~</a - > a <a href="#" class="selflink" + > a0 <a href="#" class="selflink" >#</a ></p ><p class="src" @@ -114,7 +114,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Instances.html&qu ><~~</a > (a <a href="#" ><~~</a - > a)) -> <a href="#" + > a0)) -> <a href="#" >Int</a > -> a <a href="#" ><~~</a @@ -276,48 +276,6 @@ window.onload = function () {pageLoad();setSynopsis("mini_Instances.html&qu ></span > <a href="#" >Foo</a - > ((->) a)</span - > <a href="#" class="selflink" - >#</a - ></td - ><td class="doc empty" - ></td - ></tr - ><tr - ><td colspan="2" - ><div id="section.i:ic:Foo:Foo:3" class="inst-details hide" - ><div class="subs methods" - ><p class="caption" - >Methods</p - ><p class="src" - ><a href="#" - >foo</a - > :: (a -> <a href="#" - >Int</a - >) -> a -> a -> a <a href="#" class="selflink" - >#</a - ></p - ><p class="src" - ><a href="#" - >foo'</a - > :: (a -> a -> a) -> <a href="#" - >Int</a - > -> a -> a -> <a href="#" - >Int</a - > <a href="#" class="selflink" - >#</a - ></p - ></div - ></div - ></td - ></tr - ><tr - ><td class="src clearfix" - ><span class="inst-left" - ><span id="control.i:ic:Foo:Foo:4" class="instance expander" onclick="toggleSection('i:ic:Foo:Foo:4')" - ></span - > <a href="#" - >Foo</a > (<a href="#" >Either</a > a)</span @@ -329,7 +287,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Instances.html&qu ></tr ><tr ><td colspan="2" - ><div id="section.i:ic:Foo:Foo:4" class="inst-details hide" + ><div id="section.i:ic:Foo:Foo:3" class="inst-details hide" ><div class="subs methods" ><p class="caption" >Methods</p @@ -340,9 +298,9 @@ window.onload = function () {pageLoad();setSynopsis("mini_Instances.html&qu >Either</a > a <a href="#" >Int</a - > -> a -> <a href="#" + > -> a0 -> <a href="#" >Either</a - > a a <a href="#" class="selflink" + > a a0 <a href="#" class="selflink" >#</a ></p ><p class="src" @@ -352,7 +310,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Instances.html&qu >Either</a > a (<a href="#" >Either</a - > a a) -> <a href="#" + > a a0) -> <a href="#" >Int</a > -> <a href="#" >Either</a @@ -370,7 +328,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Instances.html&qu ><tr ><td class="src clearfix" ><span class="inst-left" - ><span id="control.i:ic:Foo:Foo:5" class="instance expander" onclick="toggleSection('i:ic:Foo:Foo:5')" + ><span id="control.i:ic:Foo:Foo:4" class="instance expander" onclick="toggleSection('i:ic:Foo:Foo:4')" ></span > (<a href="#" >Eq</a @@ -389,7 +347,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Instances.html&qu ></tr ><tr ><td colspan="2" - ><div id="section.i:ic:Foo:Foo:5" class="inst-details hide" + ><div id="section.i:ic:Foo:Foo:4" class="inst-details hide" ><div class="subs methods" ><p class="caption" >Methods</p @@ -398,13 +356,13 @@ window.onload = function () {pageLoad();setSynopsis("mini_Instances.html&qu >foo</a > :: (f a, <a href="#" >Int</a - >) -> a -> (f a, a) <a href="#" class="selflink" + >) -> a0 -> (f a, a0) <a href="#" class="selflink" >#</a ></p ><p class="src" ><a href="#" >foo'</a - > :: (f a, (f a, a)) -> <a href="#" + > :: (f a, (f a, a0)) -> <a href="#" >Int</a > -> (f a, (f a, <a href="#" >Int</a @@ -418,7 +376,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Instances.html&qu ><tr ><td class="src clearfix" ><span class="inst-left" - ><span id="control.i:ic:Foo:Foo:6" class="instance expander" onclick="toggleSection('i:ic:Foo:Foo:6')" + ><span id="control.i:ic:Foo:Foo:5" class="instance expander" onclick="toggleSection('i:ic:Foo:Foo:5')" ></span > <a href="#" >Foo</a @@ -433,7 +391,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Instances.html&qu ></tr ><tr ><td colspan="2" - ><div id="section.i:ic:Foo:Foo:6" class="inst-details hide" + ><div id="section.i:ic:Foo:Foo:5" class="inst-details hide" ><div class="subs methods" ><p class="caption" >Methods</p @@ -444,9 +402,9 @@ window.onload = function () {pageLoad();setSynopsis("mini_Instances.html&qu ><~~</a > <a href="#" >Int</a - >) -> a -> a <a href="#" + >) -> a0 -> a <a href="#" ><~~</a - > a <a href="#" class="selflink" + > a0 <a href="#" class="selflink" >#</a ></p ><p class="src" @@ -456,7 +414,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Instances.html&qu ><~~</a > (a <a href="#" ><~~</a - > a)) -> <a href="#" + > a0)) -> <a href="#" >Int</a > -> a <a href="#" ><~~</a @@ -474,7 +432,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Instances.html&qu ><tr ><td class="src clearfix" ><span class="inst-left" - ><span id="control.i:ic:Foo:Foo:7" class="instance expander" onclick="toggleSection('i:ic:Foo:Foo:7')" + ><span id="control.i:ic:Foo:Foo:6" class="instance expander" onclick="toggleSection('i:ic:Foo:Foo:6')" ></span > <a href="#" >Foo</a @@ -489,7 +447,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Instances.html&qu ></tr ><tr ><td colspan="2" - ><div id="section.i:ic:Foo:Foo:7" class="inst-details hide" + ><div id="section.i:ic:Foo:Foo:6" class="inst-details hide" ><div class="subs methods" ><p class="caption" >Methods</p @@ -498,13 +456,13 @@ window.onload = function () {pageLoad();setSynopsis("mini_Instances.html&qu >foo</a > :: (a, a, <a href="#" >Int</a - >) -> a -> (a, a, a) <a href="#" class="selflink" + >) -> a0 -> (a, a, a0) <a href="#" class="selflink" >#</a ></p ><p class="src" ><a href="#" >foo'</a - > :: (a, a, (a, a, a)) -> <a href="#" + > :: (a, a, (a, a, a0)) -> <a href="#" >Int</a > -> (a, a, (a, a, <a href="#" >Int</a @@ -518,7 +476,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Instances.html&qu ><tr ><td class="src clearfix" ><span class="inst-left" - ><span id="control.i:ic:Foo:Foo:8" class="instance expander" onclick="toggleSection('i:ic:Foo:Foo:8')" + ><span id="control.i:ic:Foo:Foo:7" class="instance expander" onclick="toggleSection('i:ic:Foo:Foo:7')" ></span > <a href="#" >Foo</a @@ -533,7 +491,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Instances.html&qu ></tr ><tr ><td colspan="2" - ><div id="section.i:ic:Foo:Foo:8" class="inst-details hide" + ><div id="section.i:ic:Foo:Foo:7" class="inst-details hide" ><div class="subs methods" ><p class="caption" >Methods</p @@ -544,9 +502,9 @@ window.onload = function () {pageLoad();setSynopsis("mini_Instances.html&qu >Quux</a > a b <a href="#" >Int</a - > -> a -> <a href="#" + > -> a0 -> <a href="#" >Quux</a - > a b a <a href="#" class="selflink" + > a b a0 <a href="#" class="selflink" >#</a ></p ><p class="src" @@ -556,7 +514,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Instances.html&qu >Quux</a > a b (<a href="#" >Quux</a - > a b a) -> <a href="#" + > a b a0) -> <a href="#" >Int</a > -> <a href="#" >Quux</a @@ -571,6 +529,76 @@ window.onload = function () {pageLoad();setSynopsis("mini_Instances.html&qu ></div ></td ></tr + ><tr + ><td class="src clearfix" + ><span class="inst-left" + ><span id="control.i:ic:Foo:Foo:8" class="instance expander" onclick="toggleSection('i:ic:Foo:Foo:8')" + ></span + > <a href="#" + >Foo</a + > ((->) <a href="#" + >LiftedRep</a + > <a href="#" + >LiftedRep</a + > a)</span + > <a href="#" class="selflink" + >#</a + ></td + ><td class="doc empty" + ></td + ></tr + ><tr + ><td colspan="2" + ><div id="section.i:ic:Foo:Foo:8" class="inst-details hide" + ><div class="subs methods" + ><p class="caption" + >Methods</p + ><p class="src" + ><a href="#" + >foo</a + > :: (<a href="#" + >LiftedRep</a + > -> <a href="#" + >LiftedRep</a + >) a <a href="#" + >Int</a + > -> a0 -> (<a href="#" + >LiftedRep</a + > -> <a href="#" + >LiftedRep</a + >) a a0 <a href="#" class="selflink" + >#</a + ></p + ><p class="src" + ><a href="#" + >foo'</a + > :: (<a href="#" + >LiftedRep</a + > -> <a href="#" + >LiftedRep</a + >) a ((<a href="#" + >LiftedRep</a + > -> <a href="#" + >LiftedRep</a + >) a a0) -> <a href="#" + >Int</a + > -> (<a href="#" + >LiftedRep</a + > -> <a href="#" + >LiftedRep</a + >) a ((<a href="#" + >LiftedRep</a + > -> <a href="#" + >LiftedRep</a + >) a <a href="#" + >Int</a + >) <a href="#" class="selflink" + >#</a + ></p + ></div + ></div + ></td + ></tr ></table ></div ></div @@ -608,7 +636,11 @@ window.onload = function () {pageLoad();setSynopsis("mini_Instances.html&qu ><p class="src" ><a id="v:bar0" class="def" >bar0</a - >, <a id="v:bar1" class="def" + > :: (f a, f a) -> (f b, f c) <a href="#" class="selflink" + >#</a + ></p + ><p class="src" + ><a id="v:bar1" class="def" >bar1</a > :: (f a, f a) -> (f b, f c) <a href="#" class="selflink" >#</a @@ -970,19 +1002,19 @@ window.onload = function () {pageLoad();setSynopsis("mini_Instances.html&qu ><p class="src" ><a href="#" >bar'</a - > :: (a, b, (a, b, (a, b, a))) -> (a, b, (a, b, (a, b, b))) <a href="#" class="selflink" + > :: (a, b, (a, b, (a, b, a))) -> (a, b, (a, b, (a, b, b0))) <a href="#" class="selflink" >#</a ></p ><p class="src" ><a href="#" >bar0</a - > :: ((a, b, (a, b, a)), (a, b, (a, b, a))) -> ((a, b, b), (a, b, c)) <a href="#" class="selflink" + > :: ((a, b, (a, b, a)), (a, b, (a, b, a))) -> ((a, b, b0), (a, b, c)) <a href="#" class="selflink" >#</a ></p ><p class="src" ><a href="#" >bar1</a - > :: ((a, b, (a, b, a)), (a, b, (a, b, a))) -> ((a, b, b), (a, b, c)) <a href="#" class="selflink" + > :: ((a, b, (a, b, a)), (a, b, (a, b, a))) -> ((a, b, b0), (a, b, c)) <a href="#" class="selflink" >#</a ></p ></div @@ -1044,7 +1076,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Instances.html&qu >Quux</a > a c (<a href="#" >Quux</a - > a c b)) <a href="#" class="selflink" + > a c b0)) <a href="#" class="selflink" >#</a ></p ><p class="src" @@ -1060,9 +1092,9 @@ window.onload = function () {pageLoad();setSynopsis("mini_Instances.html&qu >Quux</a > a b c)) -> (<a href="#" >Quux</a - > a c b, <a href="#" + > a c b0, <a href="#" >Quux</a - > a c c) <a href="#" class="selflink" + > a c c0) <a href="#" class="selflink" >#</a ></p ><p class="src" @@ -1078,9 +1110,9 @@ window.onload = function () {pageLoad();setSynopsis("mini_Instances.html&qu >Quux</a > a b c)) -> (<a href="#" >Quux</a - > a c b, <a href="#" + > a c b0, <a href="#" >Quux</a - > a c c) <a href="#" class="selflink" + > a c c0) <a href="#" class="selflink" >#</a ></p ></div @@ -1170,7 +1202,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Instances.html&qu >forall</span > a. a -> a) -> (b, <span class="keyword" >forall</span - > a. a -> [c]) -> (b, c) <a href="#" class="selflink" + > c0. c0 -> [c]) -> (b, c1) <a href="#" class="selflink" >#</a ></p ><p class="src" @@ -1190,9 +1222,9 @@ window.onload = function () {pageLoad();setSynopsis("mini_Instances.html&qu >forall</span > b. (<span class="keyword" >forall</span - > a. a -> [c]) -> c) -> <span class="keyword" + > b. b -> [c]) -> c0) -> <span class="keyword" >forall</span - > a. a -> b <a href="#" class="selflink" + > c1. c1 -> b <a href="#" class="selflink" >#</a ></p ></div @@ -1224,31 +1256,31 @@ window.onload = function () {pageLoad();setSynopsis("mini_Instances.html&qu >baz</a > :: (a -> b) -> (<span class="keyword" >forall</span - > c. c -> c) -> (b, <span class="keyword" + > a0. a0 -> a0) -> (b0, <span class="keyword" >forall</span - > c. c -> a -> b) -> (b, c) <a href="#" class="selflink" + > c. c -> a -> b) -> (b0, c) <a href="#" class="selflink" >#</a ></p ><p class="src" ><a href="#" >baz'</a - > :: b -> (<span class="keyword" + > :: b0 -> (<span class="keyword" >forall</span - > c. c -> a -> b) -> (<span class="keyword" + > b1. b1 -> a -> b) -> (<span class="keyword" >forall</span - > c. c -> a -> b) -> [(b, a -> b)] <a href="#" class="selflink" + > b2. b2 -> a -> b) -> [(b0, a -> b)] <a href="#" class="selflink" >#</a ></p ><p class="src" ><a href="#" >baz''</a - > :: b -> (<span class="keyword" + > :: b0 -> (<span class="keyword" >forall</span - > c. (<span class="keyword" + > b1. (<span class="keyword" >forall</span - > d. d -> a -> b) -> c) -> <span class="keyword" + > b2. b2 -> a -> b) -> c) -> <span class="keyword" >forall</span - > c. c -> b <a href="#" class="selflink" + > c. c -> b0 <a href="#" class="selflink" >#</a ></p ></div @@ -1280,31 +1312,31 @@ window.onload = function () {pageLoad();setSynopsis("mini_Instances.html&qu >baz</a > :: (a, b, c) -> (<span class="keyword" >forall</span - > d. d -> d) -> (b, <span class="keyword" + > a0. a0 -> a0) -> (b0, <span class="keyword" >forall</span - > d. d -> (a, b, c)) -> (b, c) <a href="#" class="selflink" + > c0. c0 -> (a, b, c)) -> (b0, c1) <a href="#" class="selflink" >#</a ></p ><p class="src" ><a href="#" >baz'</a - > :: b -> (<span class="keyword" + > :: b0 -> (<span class="keyword" >forall</span - > d. d -> (a, b, c)) -> (<span class="keyword" + > b1. b1 -> (a, b, c)) -> (<span class="keyword" >forall</span - > d. d -> (a, b, c)) -> [(b, (a, b, c))] <a href="#" class="selflink" + > b2. b2 -> (a, b, c)) -> [(b0, (a, b, c))] <a href="#" class="selflink" >#</a ></p ><p class="src" ><a href="#" >baz''</a - > :: b -> (<span class="keyword" + > :: b0 -> (<span class="keyword" >forall</span - > d. (<span class="keyword" + > b1. (<span class="keyword" >forall</span - > e. e -> (a, b, c)) -> c) -> <span class="keyword" + > b2. b2 -> (a, b, c)) -> c0) -> <span class="keyword" >forall</span - > d. d -> b <a href="#" class="selflink" + > c1. c1 -> b0 <a href="#" class="selflink" >#</a ></p ></div @@ -1340,25 +1372,25 @@ window.onload = function () {pageLoad();setSynopsis("mini_Instances.html&qu >Quux</a > a b c -> (<span class="keyword" >forall</span - > d. d -> d) -> (b, <span class="keyword" + > a0. a0 -> a0) -> (b0, <span class="keyword" >forall</span - > d. d -> <a href="#" + > c0. c0 -> <a href="#" >Quux</a - > a b c) -> (b, c) <a href="#" class="selflink" + > a b c) -> (b0, c1) <a href="#" class="selflink" >#</a ></p ><p class="src" ><a href="#" >baz'</a - > :: b -> (<span class="keyword" + > :: b0 -> (<span class="keyword" >forall</span - > d. d -> <a href="#" + > b1. b1 -> <a href="#" >Quux</a > a b c) -> (<span class="keyword" >forall</span - > d. d -> <a href="#" + > b2. b2 -> <a href="#" >Quux</a - > a b c) -> [(b, <a href="#" + > a b c) -> [(b0, <a href="#" >Quux</a > a b c)] <a href="#" class="selflink" >#</a @@ -1366,15 +1398,15 @@ window.onload = function () {pageLoad();setSynopsis("mini_Instances.html&qu ><p class="src" ><a href="#" >baz''</a - > :: b -> (<span class="keyword" + > :: b0 -> (<span class="keyword" >forall</span - > d. (<span class="keyword" + > b1. (<span class="keyword" >forall</span - > e. e -> <a href="#" + > b2. b2 -> <a href="#" >Quux</a - > a b c) -> c) -> <span class="keyword" + > a b c) -> c0) -> <span class="keyword" >forall</span - > d. d -> b <a href="#" class="selflink" + > c1. c1 -> b0 <a href="#" class="selflink" >#</a ></p ></div @@ -1406,31 +1438,31 @@ window.onload = function () {pageLoad();setSynopsis("mini_Instances.html&qu >baz</a > :: (a, [b], b, a) -> (<span class="keyword" >forall</span - > c. c -> c) -> (b, <span class="keyword" + > a0. a0 -> a0) -> (b0, <span class="keyword" >forall</span - > c. c -> (a, [b], b, a)) -> (b, c) <a href="#" class="selflink" + > c. c -> (a, [b], b, a)) -> (b0, c) <a href="#" class="selflink" >#</a ></p ><p class="src" ><a href="#" >baz'</a - > :: b -> (<span class="keyword" + > :: b0 -> (<span class="keyword" >forall</span - > c. c -> (a, [b], b, a)) -> (<span class="keyword" + > b1. b1 -> (a, [b], b, a)) -> (<span class="keyword" >forall</span - > c. c -> (a, [b], b, a)) -> [(b, (a, [b], b, a))] <a href="#" class="selflink" + > b2. b2 -> (a, [b], b, a)) -> [(b0, (a, [b], b, a))] <a href="#" class="selflink" >#</a ></p ><p class="src" ><a href="#" >baz''</a - > :: b -> (<span class="keyword" + > :: b0 -> (<span class="keyword" >forall</span - > c. (<span class="keyword" + > b1. (<span class="keyword" >forall</span - > d. d -> (a, [b], b, a)) -> c) -> <span class="keyword" + > b2. b2 -> (a, [b], b, a)) -> c) -> <span class="keyword" >forall</span - > c. c -> b <a href="#" class="selflink" + > c. c -> b0 <a href="#" class="selflink" >#</a ></p ></div @@ -1514,9 +1546,9 @@ window.onload = function () {pageLoad();setSynopsis("mini_Instances.html&qu >Quux</a > a b <a href="#" >Int</a - > -> a -> <a href="#" + > -> a0 -> <a href="#" >Quux</a - > a b a <a href="#" class="selflink" + > a b a0 <a href="#" class="selflink" >#</a ></p ><p class="src" @@ -1526,7 +1558,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Instances.html&qu >Quux</a > a b (<a href="#" >Quux</a - > a b a) -> <a href="#" + > a b a0) -> <a href="#" >Int</a > -> <a href="#" >Quux</a @@ -1596,7 +1628,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Instances.html&qu >Quux</a > a c (<a href="#" >Quux</a - > a c b)) <a href="#" class="selflink" + > a c b0)) <a href="#" class="selflink" >#</a ></p ><p class="src" @@ -1612,9 +1644,9 @@ window.onload = function () {pageLoad();setSynopsis("mini_Instances.html&qu >Quux</a > a b c)) -> (<a href="#" >Quux</a - > a c b, <a href="#" + > a c b0, <a href="#" >Quux</a - > a c c) <a href="#" class="selflink" + > a c c0) <a href="#" class="selflink" >#</a ></p ><p class="src" @@ -1630,9 +1662,9 @@ window.onload = function () {pageLoad();setSynopsis("mini_Instances.html&qu >Quux</a > a b c)) -> (<a href="#" >Quux</a - > a c b, <a href="#" + > a c b0, <a href="#" >Quux</a - > a c c) <a href="#" class="selflink" + > a c c0) <a href="#" class="selflink" >#</a ></p ></div @@ -1668,25 +1700,25 @@ window.onload = function () {pageLoad();setSynopsis("mini_Instances.html&qu >Quux</a > a b c -> (<span class="keyword" >forall</span - > d. d -> d) -> (b, <span class="keyword" + > a0. a0 -> a0) -> (b0, <span class="keyword" >forall</span - > d. d -> <a href="#" + > c0. c0 -> <a href="#" >Quux</a - > a b c) -> (b, c) <a href="#" class="selflink" + > a b c) -> (b0, c1) <a href="#" class="selflink" >#</a ></p ><p class="src" ><a href="#" >baz'</a - > :: b -> (<span class="keyword" + > :: b0 -> (<span class="keyword" >forall</span - > d. d -> <a href="#" + > b1. b1 -> <a href="#" >Quux</a > a b c) -> (<span class="keyword" >forall</span - > d. d -> <a href="#" + > b2. b2 -> <a href="#" >Quux</a - > a b c) -> [(b, <a href="#" + > a b c) -> [(b0, <a href="#" >Quux</a > a b c)] <a href="#" class="selflink" >#</a @@ -1694,15 +1726,15 @@ window.onload = function () {pageLoad();setSynopsis("mini_Instances.html&qu ><p class="src" ><a href="#" >baz''</a - > :: b -> (<span class="keyword" + > :: b0 -> (<span class="keyword" >forall</span - > d. (<span class="keyword" + > b1. (<span class="keyword" >forall</span - > e. e -> <a href="#" + > b2. b2 -> <a href="#" >Quux</a - > a b c) -> c) -> <span class="keyword" + > a b c) -> c0) -> <span class="keyword" >forall</span - > d. d -> b <a href="#" class="selflink" + > c1. c1 -> b0 <a href="#" class="selflink" >#</a ></p ></div diff --git a/html-test/ref/Math.html b/html-test/ref/Math.html index 9f054ccc..46f283e3 100644 --- a/html-test/ref/Math.html +++ b/html-test/ref/Math.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_Math.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/Minimal.html b/html-test/ref/Minimal.html index 721260c6..b7507bd7 100644 --- a/html-test/ref/Minimal.html +++ b/html-test/ref/Minimal.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_Minimal.html");}; +window.onload = function () {pageLoad();}; // </script ></head @@ -132,26 +132,6 @@ window.onload = function () {pageLoad();setSynopsis("mini_Minimal.html" > <a href="#" class="selflink" >#</a ></p - ><div class="subs minimal" - ><p class="caption" - >Minimal complete definition</p - ><p class="src" - ><a href="#" - >a</a - >, <a href="#" - >b</a - >, <a href="#" - >c</a - > | <a href="#" - >d</a - > | <a href="#" - >e</a - >, (<a href="#" - >f</a - > | <a href="#" - >g</a - >)</p - ></div ><div class="subs methods" ><p class="caption" >Methods</p diff --git a/html-test/ref/ModuleWithWarning.html b/html-test/ref/ModuleWithWarning.html index 776edd9b..ca7b2b3f 100644 --- a/html-test/ref/ModuleWithWarning.html +++ b/html-test/ref/ModuleWithWarning.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_ModuleWithWarning.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/NamedDoc.html b/html-test/ref/NamedDoc.html index 50590660..a10aa305 100644 --- a/html-test/ref/NamedDoc.html +++ b/html-test/ref/NamedDoc.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_NamedDoc.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/Nesting.html b/html-test/ref/Nesting.html index d98a75eb..7ce0c0d8 100644 --- a/html-test/ref/Nesting.html +++ b/html-test/ref/Nesting.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_Nesting.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/NoLayout.html b/html-test/ref/NoLayout.html index 061b5d42..43352864 100644 --- a/html-test/ref/NoLayout.html +++ b/html-test/ref/NoLayout.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_NoLayout.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/NonGreedy.html b/html-test/ref/NonGreedy.html index ea18c7c4..6ed1563f 100644 --- a/html-test/ref/NonGreedy.html +++ b/html-test/ref/NonGreedy.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_NonGreedy.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/Operators.html b/html-test/ref/Operators.html index 6c795d85..d498a906 100644 --- a/html-test/ref/Operators.html +++ b/html-test/ref/Operators.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_Operators.html");}; +window.onload = function () {pageLoad();}; // </script ></head @@ -97,7 +97,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Operators.html&qu >(:+)</a > :: <span class="keyword" >forall</span - > t. t -> t -> [t]</li + > a. a -> a -> [a]</li ><li class="src short" ><span class="keyword" >data</span @@ -271,7 +271,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Operators.html&qu >(:+)</a > :: <span class="keyword" >forall</span - > t. t -> t -> [t] <span class="fixity" + > a. a -> a -> [a] <span class="fixity" >infixr 3</span ><span class="rightedge" ></span @@ -432,12 +432,18 @@ window.onload = function () {pageLoad();setSynopsis("mini_Operators.html&qu ><p class="src" ><a id="v:-62--62--60-" class="def" >(>><)</a - >, <a id="v:-60--60--62-" class="def" + > :: a -> b -> () <span class="fixity" + >infixr 4</span + ><span class="rightedge" + ></span + > <a href="#" class="selflink" + >#</a + ></p + ><p class="src" + ><a id="v:-60--60--62-" class="def" >(<<>)</a > :: a -> b -> () <span class="fixity" - >infixl 5 <<></span - ><span class="fixity" - >infixr 4 >><</span + >infixl 5</span ><span class="rightedge" ></span > <a href="#" class="selflink" @@ -446,16 +452,50 @@ window.onload = function () {pageLoad();setSynopsis("mini_Operators.html&qu ><p class="src" ><a id="v:-42--42--62-" class="def" >(**>)</a - >, <a id="v:-42--42--60-" class="def" + > :: a -> a -> () <span class="fixity" + >infixr 8</span + ><span class="rightedge" + ></span + > <a href="#" class="selflink" + >#</a + ></p + ><div class="doc" + ><p + >Multiple fixities</p + ></div + ><p class="src" + ><a id="v:-42--42--60-" class="def" >(**<)</a - >, <a id="v:-62--42--42-" class="def" + > :: a -> a -> () <span class="fixity" + >infixl 8</span + ><span class="rightedge" + ></span + > <a href="#" class="selflink" + >#</a + ></p + ><div class="doc" + ><p + >Multiple fixities</p + ></div + ><p class="src" + ><a id="v:-62--42--42-" class="def" >(>**)</a - >, <a id="v:-60--42--42-" class="def" + > :: a -> a -> () <span class="fixity" + >infixr 8</span + ><span class="rightedge" + ></span + > <a href="#" class="selflink" + >#</a + ></p + ><div class="doc" + ><p + >Multiple fixities</p + ></div + ><p class="src" + ><a 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 > <a href="#" class="selflink" diff --git a/html-test/ref/OrphanInstances.html b/html-test/ref/OrphanInstances.html index a5accfdf..257e2e41 100644 --- a/html-test/ref/OrphanInstances.html +++ b/html-test/ref/OrphanInstances.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_OrphanInstances.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/OrphanInstancesClass.html b/html-test/ref/OrphanInstancesClass.html index 0f1b31c9..93594d90 100644 --- a/html-test/ref/OrphanInstancesClass.html +++ b/html-test/ref/OrphanInstancesClass.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_OrphanInstancesClass.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/OrphanInstancesType.html b/html-test/ref/OrphanInstancesType.html index ceabdaaa..5d7a76c9 100644 --- a/html-test/ref/OrphanInstancesType.html +++ b/html-test/ref/OrphanInstancesType.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_OrphanInstancesType.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/PR643.html b/html-test/ref/PR643.html new file mode 100644 index 00000000..46e1e7ed --- /dev/null +++ b/html-test/ref/PR643.html @@ -0,0 +1,80 @@ +<html xmlns="http://www.w3.org/1999/xhtml" +><head + ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" + /><title + >PR643</title + ><link href="#" rel="stylesheet" type="text/css" title="Ocean" + /><script src="haddock-util.js" type="text/javascript" + ></script + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ></script + ><script type="text/javascript" + >// +window.onload = function () {pageLoad();}; +// +</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" + >PR643</p + ></div + ><div id="synopsis" + ><p id="control.syn" class="caption expander" onclick="toggleSection('syn')" + >Synopsis</p + ><ul id="section.syn" class="hide" onclick="toggleSection('syn')" + ><li class="src short" + ><a href="#" + >test</a + > :: ()</li + ></ul + ></div + ><div id="interface" + ><h1 + >Documentation</h1 + ><div class="top" + ><p class="src" + ><a id="v:test" class="def" + >test</a + > :: () <span class="fixity" + >infixr 5</span + ><span class="rightedge" + ></span + > <a href="#" class="selflink" + >#</a + ></p + ><div class="doc" + ><p + >Some big documentation</p + ></div + ></div + ></div + ></div + ><div id="footer" + ></div + ></body + ></html +>
\ No newline at end of file diff --git a/html-test/ref/PatternSyns.html b/html-test/ref/PatternSyns.html index 70e9230b..37596645 100644 --- a/html-test/ref/PatternSyns.html +++ b/html-test/ref/PatternSyns.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_PatternSyns.html");}; +window.onload = function () {pageLoad();}; // </script ></head @@ -69,9 +69,9 @@ window.onload = function () {pageLoad();setSynopsis("mini_PatternSyns.html& >Foo</a > :: <span class="keyword" >forall</span - > t. t -> <a href="#" + > x. x -> <a href="#" >FooType</a - > t</li + > x</li ><li class="src short" ><span class="keyword" >pattern</span @@ -79,11 +79,11 @@ window.onload = function () {pageLoad();setSynopsis("mini_PatternSyns.html& >Bar</a > :: <span class="keyword" >forall</span - > t. t -> <a href="#" + > x. x -> <a href="#" >FooType</a > (<a href="#" >FooType</a - > t)</li + > x)</li ><li class="src short" ><span class="keyword" >pattern</span @@ -91,17 +91,41 @@ window.onload = function () {pageLoad();setSynopsis("mini_PatternSyns.html& >(:<->)</a > :: <span class="keyword" >forall</span - > t t1. t -> t1 -> (<a href="#" + > x x1. x -> x1 -> (<a href="#" >FooType</a - > t, <a href="#" + > x, <a href="#" >FooType</a > (<a href="#" >FooType</a - > t1))</li + > x1))</li ><li class="src short" ><span class="keyword" >data</span - > a <a href="#" + > <a href="#" + >BlubType</a + > = <a href="#" + >Show</a + > x => <a href="#" + >BlubCtor</a + > x</li + ><li class="src short" + ><span class="keyword" + >pattern</span + > <a href="#" + >Blub</a + > :: () => <span class="keyword" + >forall</span + > x. <a href="#" + >Show</a + > x => x -> <a href="#" + >BlubType</a + ></li + ><li class="src short" + ><span class="keyword" + >data</span + > (a :: <a href="#" + >*</a + >) <a href="#" >><</a > b = <a href="#" >Empty</a @@ -113,9 +137,19 @@ window.onload = function () {pageLoad();setSynopsis("mini_PatternSyns.html& >E</a > :: <span class="keyword" >forall</span - > k t t1. <a href="#" + > k a (b :: k). <a href="#" >(><)</a - > k t t1</li + > k a b</li + ><li class="src short" + ><span class="keyword" + >pattern</span + > <a href="#" + >PatWithExplicitSig</a + > :: <a href="#" + >Eq</a + > somex => somex -> <a href="#" + >FooType</a + > somex</li ></ul ></div ><div id="interface" @@ -157,9 +191,9 @@ window.onload = function () {pageLoad();setSynopsis("mini_PatternSyns.html& >Foo</a > :: <span class="keyword" >forall</span - > t. t -> <a href="#" + > x. x -> <a href="#" >FooType</a - > t <a href="#" class="selflink" + > x <a href="#" class="selflink" >#</a ></p ><div class="doc" @@ -179,11 +213,11 @@ window.onload = function () {pageLoad();setSynopsis("mini_PatternSyns.html& >Bar</a > :: <span class="keyword" >forall</span - > t. t -> <a href="#" + > x. x -> <a href="#" >FooType</a > (<a href="#" >FooType</a - > t) <a href="#" class="selflink" + > x) <a href="#" class="selflink" >#</a ></p ><div class="doc" @@ -203,13 +237,13 @@ window.onload = function () {pageLoad();setSynopsis("mini_PatternSyns.html& >(:<->)</a > :: <span class="keyword" >forall</span - > t t1. t -> t1 -> (<a href="#" + > x x1. x -> x1 -> (<a href="#" >FooType</a - > t, <a href="#" + > x, <a href="#" >FooType</a > (<a href="#" >FooType</a - > t1)) <a href="#" class="selflink" + > x1)) <a href="#" class="selflink" >#</a ></p ><div class="doc" @@ -225,7 +259,63 @@ window.onload = function () {pageLoad();setSynopsis("mini_PatternSyns.html& ><p class="src" ><span class="keyword" >data</span - > a <a id="t:-62--60-" class="def" + > <a id="t:BlubType" class="def" + >BlubType</a + > <a href="#" class="selflink" + >#</a + ></p + ><div class="doc" + ><p + >BlubType is existentially quantified</p + ></div + ><div class="subs constructors" + ><p class="caption" + >Constructors</p + ><table + ><tr + ><td class="src" + ><a href="#" + >Show</a + > x => <a id="v:BlubCtor" class="def" + >BlubCtor</a + > x</td + ><td class="doc empty" + ></td + ></tr + ></table + ></div + ></div + ><div class="top" + ><p class="src" + ><span class="keyword" + >pattern</span + > <a id="v:Blub" class="def" + >Blub</a + > :: () => <span class="keyword" + >forall</span + > x. <a href="#" + >Show</a + > x => x -> <a href="#" + >BlubType</a + > <a href="#" class="selflink" + >#</a + ></p + ><div class="doc" + ><p + >Pattern synonym for <code + ><a href="#" + >Blub</a + ></code + > x</p + ></div + ></div + ><div class="top" + ><p class="src" + ><span class="keyword" + >data</span + > (a :: <a href="#" + >*</a + >) <a id="t:-62--60-" class="def" >><</a > b <a href="#" class="selflink" >#</a @@ -261,9 +351,9 @@ window.onload = function () {pageLoad();setSynopsis("mini_PatternSyns.html& >E</a > :: <span class="keyword" >forall</span - > k t t1. <a href="#" + > k a (b :: k). <a href="#" >(><)</a - > k t t1 <a href="#" class="selflink" + > k a b <a href="#" class="selflink" >#</a ></p ><div class="doc" @@ -275,6 +365,25 @@ window.onload = function () {pageLoad();setSynopsis("mini_PatternSyns.html& ></p ></div ></div + ><div class="top" + ><p class="src" + ><span class="keyword" + >pattern</span + > <a id="v:PatWithExplicitSig" class="def" + >PatWithExplicitSig</a + > :: <a href="#" + >Eq</a + > somex => somex -> <a href="#" + >FooType</a + > somex <a href="#" class="selflink" + >#</a + ></p + ><div class="doc" + ><p + >Earlier ghc versions didn't allow explicit signatures + on pattern synonyms.</p + ></div + ></div ></div ></div ><div id="footer" diff --git a/html-test/ref/PromotedTypes.html b/html-test/ref/PromotedTypes.html index 65aa0112..6d4c57be 100644 --- a/html-test/ref/PromotedTypes.html +++ b/html-test/ref/PromotedTypes.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_PromotedTypes.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/Properties.html b/html-test/ref/Properties.html index 4020bb45..4ce37acd 100644 --- a/html-test/ref/Properties.html +++ b/html-test/ref/Properties.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_Properties.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/PruneWithWarning.html b/html-test/ref/PruneWithWarning.html index 0ee2b104..e714ec21 100644 --- a/html-test/ref/PruneWithWarning.html +++ b/html-test/ref/PruneWithWarning.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_PruneWithWarning.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/QuasiExpr.html b/html-test/ref/QuasiExpr.html index 37face02..0b5b8054 100644 --- a/html-test/ref/QuasiExpr.html +++ b/html-test/ref/QuasiExpr.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_QuasiExpr.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/QuasiQuote.html b/html-test/ref/QuasiQuote.html index 5fa53bb0..4919e48d 100644 --- a/html-test/ref/QuasiQuote.html +++ b/html-test/ref/QuasiQuote.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_QuasiQuote.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/SpuriousSuperclassConstraints.html b/html-test/ref/SpuriousSuperclassConstraints.html index b5aa56b3..0f38d15c 100644 --- a/html-test/ref/SpuriousSuperclassConstraints.html +++ b/html-test/ref/SpuriousSuperclassConstraints.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_SpuriousSuperclassConstraints.html");}; +window.onload = function () {pageLoad();}; // </script ></head @@ -56,7 +56,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_SpuriousSuperclas >http://www.haskell.org/pipermail/haskell-cafe/2012-September/103600.html</a ></p ><p - >And here is the corresponding theard on glasgow-haskell-users:</p + >And here is the corresponding thread on glasgow-haskell-users:</p ><p ><a href="#" >http://www.haskell.org/pipermail/glasgow-haskell-users/2012-September/022914.html</a @@ -77,7 +77,11 @@ Fix spurious superclass constraints bug.</pre >data</span > <a id="t:SomeType" class="def" >SomeType</a - > f a <a href="#" class="selflink" + > (f :: <a href="#" + >*</a + > -> <a href="#" + >*</a + >) a <a href="#" class="selflink" >#</a ></p ><div class="subs instances" @@ -177,6 +181,18 @@ Fix spurious superclass constraints bug.</pre ></p ><p class="src" ><a href="#" + >liftA2</a + > :: (a -> b -> c) -> <a href="#" + >SomeType</a + > f a -> <a href="#" + >SomeType</a + > f b -> <a href="#" + >SomeType</a + > f c <a href="#" class="selflink" + >#</a + ></p + ><p class="src" + ><a href="#" >(*>)</a > :: <a href="#" >SomeType</a @@ -213,4 +229,4 @@ Fix spurious superclass constraints bug.</pre ></div ></body ></html ->
\ No newline at end of file +> diff --git a/html-test/ref/TH.html b/html-test/ref/TH.html index 74c2d60f..c3b71206 100644 --- a/html-test/ref/TH.html +++ b/html-test/ref/TH.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_TH.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/TH2.html b/html-test/ref/TH2.html index 024574a1..5562cb67 100644 --- a/html-test/ref/TH2.html +++ b/html-test/ref/TH2.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_TH2.html");}; +window.onload = function () {pageLoad();}; // </script ></head @@ -49,7 +49,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_TH2.html");} ><p class="src" ><a id="v:f" class="def" >f</a - > :: t -> t <a href="#" class="selflink" + > :: p -> p <a href="#" class="selflink" >#</a ></p ></div diff --git a/html-test/ref/Test.html b/html-test/ref/Test.html index a98b2228..e84ed0dd 100644 --- a/html-test/ref/Test.html +++ b/html-test/ref/Test.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_Test.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/Threaded.html b/html-test/ref/Threaded.html index 8c2261b1..ac6a66b9 100644 --- a/html-test/ref/Threaded.html +++ b/html-test/ref/Threaded.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_Threaded.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/Threaded_TH.html b/html-test/ref/Threaded_TH.html index 2140d5b7..89f276c9 100644 --- a/html-test/ref/Threaded_TH.html +++ b/html-test/ref/Threaded_TH.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_Threaded_TH.html");}; +window.onload = function () {pageLoad();}; // </script ></head @@ -36,7 +36,7 @@ window.onload = function () {pageLoad();setSynopsis("mini_Threaded_TH.html& ><th >Safe Haskell</th ><td - >None</td + >Safe</td ></tr ></table ><p class="caption" diff --git a/html-test/ref/Ticket112.html b/html-test/ref/Ticket112.html index 6f42cff6..74b65663 100644 --- a/html-test/ref/Ticket112.html +++ b/html-test/ref/Ticket112.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_Ticket112.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/Ticket61.html b/html-test/ref/Ticket61.html index e4ff49be..cfc2e7f7 100644 --- a/html-test/ref/Ticket61.html +++ b/html-test/ref/Ticket61.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_Ticket61.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/Ticket75.html b/html-test/ref/Ticket75.html index 79678466..616f5d47 100644 --- a/html-test/ref/Ticket75.html +++ b/html-test/ref/Ticket75.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_Ticket75.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/TitledPicture.html b/html-test/ref/TitledPicture.html index 61170750..927631f8 100644 --- a/html-test/ref/TitledPicture.html +++ b/html-test/ref/TitledPicture.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_TitledPicture.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/TypeFamilies.html b/html-test/ref/TypeFamilies.html index 6062db4f..c6301a56 100644 --- a/html-test/ref/TypeFamilies.html +++ b/html-test/ref/TypeFamilies.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies.html");}; +window.onload = function () {pageLoad();}; // </script ></head @@ -159,9 +159,9 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies.html ><li class="src short" ><span class="keyword" >class</span - > a <a href="#" + > (a :: k) <a href="#" >><</a - > b</li + > (b :: k)</li ></ul ></div ><div id="interface" @@ -1779,9 +1779,9 @@ window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies.html ><p class="src" ><span class="keyword" >class</span - > a <a id="t:-62--60-" class="def" + > (a :: k) <a id="t:-62--60-" class="def" >><</a - > b <a href="#" class="selflink" + > (b :: k) <a href="#" class="selflink" >#</a ></p ><div class="subs instances" diff --git a/html-test/ref/TypeFamilies2.html b/html-test/ref/TypeFamilies2.html index f7909bff..65ab0317 100644 --- a/html-test/ref/TypeFamilies2.html +++ b/html-test/ref/TypeFamilies2.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_TypeFamilies2.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/TypeOperators.html b/html-test/ref/TypeOperators.html index f6da47b1..b461ac71 100644 --- a/html-test/ref/TypeOperators.html +++ b/html-test/ref/TypeOperators.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_TypeOperators.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/Unicode.html b/html-test/ref/Unicode.html index 335761f2..ae1d4293 100644 --- a/html-test/ref/Unicode.html +++ b/html-test/ref/Unicode.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_Unicode.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/Visible.html b/html-test/ref/Visible.html index f1390568..d9b8cd11 100644 --- a/html-test/ref/Visible.html +++ b/html-test/ref/Visible.html @@ -6,11 +6,11 @@ ><link href="#" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >// -window.onload = function () {pageLoad();setSynopsis("mini_Visible.html");}; +window.onload = function () {pageLoad();}; // </script ></head diff --git a/html-test/ref/haddock-util.js b/html-test/ref/haddock-util.js index 92d07d2a..05bdaef5 100644 --- a/html-test/ref/haddock-util.js +++ b/html-test/ref/haddock-util.js @@ -1,7 +1,7 @@ // Haddock JavaScript utilities var rspace = /\s\s+/g, - rtrim = /^\s+|\s+$/g; + rtrim = /^\s+|\s+$/g; function spaced(s) { return (" " + s + " ").replace(rspace, " "); } function trim(s) { return s.replace(rtrim, ""); } @@ -109,136 +109,6 @@ function getCookie(name) { return null; } - - -var max_results = 75; // 50 is not enough to search for map in the base libraries -var shown_range = null; -var last_search = null; - -function quick_search() -{ - perform_search(false); -} - -function full_search() -{ - perform_search(true); -} - - -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)); - - if (first == -1) - { - table.className = ""; - status.innerHTML = "No results found, displaying all"; - } - else if (first == 0 && last == children.length - 1) - { - table.className = ""; - status.innerHTML = ""; - } - else if (last - first >= max_results && !full) - { - table.className = ""; - status.innerHTML = "More than " + max_results + ", press Search to display"; - } - else - { - // decide what you need to clear/show - if (shown_range) - setclass(shown_range[0], shown_range[1], "indexrow"); - setclass(first, last, "indexshow"); - shown_range = [first, last]; - table.className = "indexsearch"; - status.innerHTML = ""; - } - - - function setclass(first, last, status) - { - for (var i = first; i <= last; i++) - { - 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) - { - var first = 0, finish = children.length - 1; - var mid, success = false; - - while (finish - first > 3) - { - mid = Math.floor((finish + first) / 2); - - var i = checkitem(mid); - if (i == 0) i = dir; - if (i == -1) - finish = mid; - else - first = mid; - } - var a = (dir == 1 ? first : finish); - var b = (dir == 1 ? finish : first); - for (var i = b; i != a - dir; i -= dir) - { - 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) - { - var s = getitem(i).toLowerCase().substr(0, text.length); - if (s == text) return 0; - else return (s > text ? -1 : 1); - } - - - // from an index, get its string - // this abstracts over alternates - function getitem(i) - { - for ( ; i >= 0; i--) - { - var s = children[i].firstChild.firstChild.data; - if (s.indexOf(' ') == -1) - return s; - } - return ""; // should never be reached - } -} - -function setSynopsis(filename) { - 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); - } else { - parent.window.synopsis.location = filename; - } - } -} - function addMenuItem(html) { var menu = document.getElementById("page-menu"); if (menu) { diff --git a/html-test/ref/mini_A.html b/html-test/ref/mini_A.html index 6f914440..fa89131e 100644 --- a/html-test/ref/mini_A.html +++ b/html-test/ref/mini_A.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_AdvanceTypes.html b/html-test/ref/mini_AdvanceTypes.html index f72502dd..c7d21915 100644 --- a/html-test/ref/mini_AdvanceTypes.html +++ b/html-test/ref/mini_AdvanceTypes.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_B.html b/html-test/ref/mini_B.html index 557d5dfe..5ce5772c 100644 --- a/html-test/ref/mini_B.html +++ b/html-test/ref/mini_B.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_Bug1.html b/html-test/ref/mini_Bug1.html index 01a65c6f..d7aea0ed 100644 --- a/html-test/ref/mini_Bug1.html +++ b/html-test/ref/mini_Bug1.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_Bug2.html b/html-test/ref/mini_Bug2.html index 4cbea53d..58fc5ba3 100644 --- a/html-test/ref/mini_Bug2.html +++ b/html-test/ref/mini_Bug2.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_Bug3.html b/html-test/ref/mini_Bug3.html index 9f46a9e6..1b0d1b33 100644 --- a/html-test/ref/mini_Bug3.html +++ b/html-test/ref/mini_Bug3.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_Bug4.html b/html-test/ref/mini_Bug4.html index cfc489b4..d17d2f2b 100644 --- a/html-test/ref/mini_Bug4.html +++ b/html-test/ref/mini_Bug4.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_Bug6.html b/html-test/ref/mini_Bug6.html index cea7a09d..e60f4189 100644 --- a/html-test/ref/mini_Bug6.html +++ b/html-test/ref/mini_Bug6.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_Bug7.html b/html-test/ref/mini_Bug7.html index 3c32e012..77698489 100644 --- a/html-test/ref/mini_Bug7.html +++ b/html-test/ref/mini_Bug7.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_Bug8.html b/html-test/ref/mini_Bug8.html index 63770a6d..9d029307 100644 --- a/html-test/ref/mini_Bug8.html +++ b/html-test/ref/mini_Bug8.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_BugDeprecated.html b/html-test/ref/mini_BugDeprecated.html index 5a075ca8..8a35d4d6 100644 --- a/html-test/ref/mini_BugDeprecated.html +++ b/html-test/ref/mini_BugDeprecated.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_BugExportHeadings.html b/html-test/ref/mini_BugExportHeadings.html index 2a1223e6..50ac8cfc 100644 --- a/html-test/ref/mini_BugExportHeadings.html +++ b/html-test/ref/mini_BugExportHeadings.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_Bugs.html b/html-test/ref/mini_Bugs.html index 6c7eefe7..94992ddf 100644 --- a/html-test/ref/mini_Bugs.html +++ b/html-test/ref/mini_Bugs.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_DeprecatedClass.html b/html-test/ref/mini_DeprecatedClass.html index 05889033..234778f0 100644 --- a/html-test/ref/mini_DeprecatedClass.html +++ b/html-test/ref/mini_DeprecatedClass.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_DeprecatedData.html b/html-test/ref/mini_DeprecatedData.html index 6dad3417..b4042bb8 100644 --- a/html-test/ref/mini_DeprecatedData.html +++ b/html-test/ref/mini_DeprecatedData.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_DeprecatedFunction.html b/html-test/ref/mini_DeprecatedFunction.html index 1564c916..3739b392 100644 --- a/html-test/ref/mini_DeprecatedFunction.html +++ b/html-test/ref/mini_DeprecatedFunction.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_DeprecatedFunction2.html b/html-test/ref/mini_DeprecatedFunction2.html index 8af6fa90..a66fc19b 100644 --- a/html-test/ref/mini_DeprecatedFunction2.html +++ b/html-test/ref/mini_DeprecatedFunction2.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_DeprecatedFunction3.html b/html-test/ref/mini_DeprecatedFunction3.html index 61819fc8..770dfad5 100644 --- a/html-test/ref/mini_DeprecatedFunction3.html +++ b/html-test/ref/mini_DeprecatedFunction3.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_DeprecatedModule.html b/html-test/ref/mini_DeprecatedModule.html index 112d70df..d70284b1 100644 --- a/html-test/ref/mini_DeprecatedModule.html +++ b/html-test/ref/mini_DeprecatedModule.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_DeprecatedModule2.html b/html-test/ref/mini_DeprecatedModule2.html index 18dc9b2d..a0773dcc 100644 --- a/html-test/ref/mini_DeprecatedModule2.html +++ b/html-test/ref/mini_DeprecatedModule2.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_DeprecatedNewtype.html b/html-test/ref/mini_DeprecatedNewtype.html index 22b56d10..165bcd4c 100644 --- a/html-test/ref/mini_DeprecatedNewtype.html +++ b/html-test/ref/mini_DeprecatedNewtype.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_DeprecatedReExport.html b/html-test/ref/mini_DeprecatedReExport.html index b1600cb7..22dfddf4 100644 --- a/html-test/ref/mini_DeprecatedReExport.html +++ b/html-test/ref/mini_DeprecatedReExport.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_DeprecatedRecord.html b/html-test/ref/mini_DeprecatedRecord.html index 5da974e7..0f400512 100644 --- a/html-test/ref/mini_DeprecatedRecord.html +++ b/html-test/ref/mini_DeprecatedRecord.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_DeprecatedTypeFamily.html b/html-test/ref/mini_DeprecatedTypeFamily.html index eb90e152..b430034a 100644 --- a/html-test/ref/mini_DeprecatedTypeFamily.html +++ b/html-test/ref/mini_DeprecatedTypeFamily.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_DeprecatedTypeSynonym.html b/html-test/ref/mini_DeprecatedTypeSynonym.html index 4ea068d9..44cb232d 100644 --- a/html-test/ref/mini_DeprecatedTypeSynonym.html +++ b/html-test/ref/mini_DeprecatedTypeSynonym.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_Examples.html b/html-test/ref/mini_Examples.html index 16769ed2..9b3a5610 100644 --- a/html-test/ref/mini_Examples.html +++ b/html-test/ref/mini_Examples.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_FunArgs.html b/html-test/ref/mini_FunArgs.html index 952e6879..5f19fe0b 100644 --- a/html-test/ref/mini_FunArgs.html +++ b/html-test/ref/mini_FunArgs.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_GADTRecords.html b/html-test/ref/mini_GADTRecords.html index fe0c5753..b6b7ae6e 100644 --- a/html-test/ref/mini_GADTRecords.html +++ b/html-test/ref/mini_GADTRecords.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_Hash.html b/html-test/ref/mini_Hash.html index 6647caf7..0c7590bb 100644 --- a/html-test/ref/mini_Hash.html +++ b/html-test/ref/mini_Hash.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_HiddenInstances.html b/html-test/ref/mini_HiddenInstances.html index 5e709de7..1ffecbf8 100644 --- a/html-test/ref/mini_HiddenInstances.html +++ b/html-test/ref/mini_HiddenInstances.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_HiddenInstancesB.html b/html-test/ref/mini_HiddenInstancesB.html index 8c8b832c..8ca461b6 100644 --- a/html-test/ref/mini_HiddenInstancesB.html +++ b/html-test/ref/mini_HiddenInstancesB.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_Hyperlinks.html b/html-test/ref/mini_Hyperlinks.html index 5071b876..0e0c3e80 100644 --- a/html-test/ref/mini_Hyperlinks.html +++ b/html-test/ref/mini_Hyperlinks.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_IgnoreExports.html b/html-test/ref/mini_IgnoreExports.html index 498b8507..e97867f4 100644 --- a/html-test/ref/mini_IgnoreExports.html +++ b/html-test/ref/mini_IgnoreExports.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_Math.html b/html-test/ref/mini_Math.html index e7f0f14f..23e7a9ce 100644 --- a/html-test/ref/mini_Math.html +++ b/html-test/ref/mini_Math.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_ModuleWithWarning.html b/html-test/ref/mini_ModuleWithWarning.html index ebe78e11..988db471 100644 --- a/html-test/ref/mini_ModuleWithWarning.html +++ b/html-test/ref/mini_ModuleWithWarning.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_NamedDoc.html b/html-test/ref/mini_NamedDoc.html index 58ba3f53..5a8e4ad9 100644 --- a/html-test/ref/mini_NamedDoc.html +++ b/html-test/ref/mini_NamedDoc.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_NoLayout.html b/html-test/ref/mini_NoLayout.html index 74878965..9400ad54 100644 --- a/html-test/ref/mini_NoLayout.html +++ b/html-test/ref/mini_NoLayout.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_NonGreedy.html b/html-test/ref/mini_NonGreedy.html index 96c51c75..78f0e847 100644 --- a/html-test/ref/mini_NonGreedy.html +++ b/html-test/ref/mini_NonGreedy.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_Properties.html b/html-test/ref/mini_Properties.html index 8362d16e..86b2364c 100644 --- a/html-test/ref/mini_Properties.html +++ b/html-test/ref/mini_Properties.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_PruneWithWarning.html b/html-test/ref/mini_PruneWithWarning.html index e73dc510..379a701e 100644 --- a/html-test/ref/mini_PruneWithWarning.html +++ b/html-test/ref/mini_PruneWithWarning.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_QuasiExpr.html b/html-test/ref/mini_QuasiExpr.html index f9e8b7b5..6c2c97f7 100644 --- a/html-test/ref/mini_QuasiExpr.html +++ b/html-test/ref/mini_QuasiExpr.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_QuasiQuote.html b/html-test/ref/mini_QuasiQuote.html index e0d8e22e..fec1abb7 100644 --- a/html-test/ref/mini_QuasiQuote.html +++ b/html-test/ref/mini_QuasiQuote.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_SpuriousSuperclassConstraints.html b/html-test/ref/mini_SpuriousSuperclassConstraints.html index 38be01c4..c6b2d1aa 100644 --- a/html-test/ref/mini_SpuriousSuperclassConstraints.html +++ b/html-test/ref/mini_SpuriousSuperclassConstraints.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_TH.html b/html-test/ref/mini_TH.html index 51b35ee5..cbf260b4 100644 --- a/html-test/ref/mini_TH.html +++ b/html-test/ref/mini_TH.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_TH2.html b/html-test/ref/mini_TH2.html index 767e6e2c..6a29ad56 100644 --- a/html-test/ref/mini_TH2.html +++ b/html-test/ref/mini_TH2.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_Test.html b/html-test/ref/mini_Test.html index 3fd26035..571b4abd 100644 --- a/html-test/ref/mini_Test.html +++ b/html-test/ref/mini_Test.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_Ticket112.html b/html-test/ref/mini_Ticket112.html index d6f23ea2..3c6bf31f 100644 --- a/html-test/ref/mini_Ticket112.html +++ b/html-test/ref/mini_Ticket112.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_Ticket61.html b/html-test/ref/mini_Ticket61.html index 6c061b7e..78a0dfba 100644 --- a/html-test/ref/mini_Ticket61.html +++ b/html-test/ref/mini_Ticket61.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_Ticket75.html b/html-test/ref/mini_Ticket75.html index 351a4d16..08d934d9 100644 --- a/html-test/ref/mini_Ticket75.html +++ b/html-test/ref/mini_Ticket75.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_TitledPicture.html b/html-test/ref/mini_TitledPicture.html index 91f61ef3..c5a95bcd 100644 --- a/html-test/ref/mini_TitledPicture.html +++ b/html-test/ref/mini_TitledPicture.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_TypeFamilies.html b/html-test/ref/mini_TypeFamilies.html index 9c6e02ea..10e65e52 100644 --- a/html-test/ref/mini_TypeFamilies.html +++ b/html-test/ref/mini_TypeFamilies.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_TypeOperators.html b/html-test/ref/mini_TypeOperators.html index 61a01103..a5c321bf 100644 --- a/html-test/ref/mini_TypeOperators.html +++ b/html-test/ref/mini_TypeOperators.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_Unicode.html b/html-test/ref/mini_Unicode.html index 820cd80d..df06b1c6 100644 --- a/html-test/ref/mini_Unicode.html +++ b/html-test/ref/mini_Unicode.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/ref/mini_Visible.html b/html-test/ref/mini_Visible.html index d51d755a..8a92d3f5 100644 --- a/html-test/ref/mini_Visible.html +++ b/html-test/ref/mini_Visible.html @@ -7,7 +7,7 @@ ><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript" ></script - ><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" + ><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript" ></script ><script type="text/javascript" >//<![CDATA[ diff --git a/html-test/src/Bug613.hs b/html-test/src/Bug613.hs new file mode 100644 index 00000000..effef695 --- /dev/null +++ b/html-test/src/Bug613.hs @@ -0,0 +1,16 @@ +module Bug613 where + +import Prelude (Either(Left, Right)) + +class Functor f where + fmap :: (a -> b) -> f a -> f b + +instance Functor (Either a) where + fmap _ (Left x) = Left x + fmap f (Right y) = Right (f y) + +-- | Phantom type a0 is added to block the first renaming from a to a0. This ensures that the renamer doesn't create a new conflict +data ThreeVars a0 a b = ThreeVars a b + +instance Functor (ThreeVars a0 a) where + fmap f (ThreeVars a b) = ThreeVars a (f b) diff --git a/html-test/src/Bug647.hs b/html-test/src/Bug647.hs new file mode 100644 index 00000000..4143092a --- /dev/null +++ b/html-test/src/Bug647.hs @@ -0,0 +1,6 @@ +module Bug647 where + +class Bug647 a where + f :: a -- ^ doc for arg1 + -> a -- ^ doc for arg2 + -> a -- ^ doc for arg3
\ No newline at end of file diff --git a/html-test/src/BundledPatterns.hs b/html-test/src/BundledPatterns.hs new file mode 100644 index 00000000..443e64fa --- /dev/null +++ b/html-test/src/BundledPatterns.hs @@ -0,0 +1,110 @@ +{-# LANGUAGE DataKinds, GADTs, KindSignatures, PatternSynonyms, TypeOperators, + ViewPatterns #-} +module BundledPatterns (Vec(Nil,(:>)), RTree (LR,BR)) where + +import GHC.TypeLits +import Prelude hiding (head, tail) +import Unsafe.Coerce + +-- | Fixed size vectors. +-- +-- * Lists with their length encoded in their type +-- * 'Vec'tor elements have an __ASCENDING__ subscript starting from 0 and +-- ending at @'length' - 1@. +data Vec :: Nat -> * -> * where + Nil :: Vec 0 a + Cons :: a -> Vec n a -> Vec (n + 1) a + +infixr 5 `Cons` + +-- | Add an element to the head of a vector. +-- +-- >>> 3:>4:>5:>Nil +-- <3,4,5> +-- >>> let x = 3:>4:>5:>Nil +-- >>> :t x +-- x :: Num a => Vec 3 a +-- +-- Can be used as a pattern: +-- +-- >>> let f (x :> y :> _) = x + y +-- >>> :t f +-- f :: Num a => Vec ((n + 1) + 1) a -> a +-- >>> f (3:>4:>5:>6:>7:>Nil) +-- 7 +-- +-- Also in conjunctions with (':<'): +-- +-- >>> let g (a :> b :> (_ :< y :< x)) = a + b + x + y +-- >>> :t g +-- g :: Num a => Vec ((((n + 1) + 1) + 1) + 1) a -> a +-- >>> g (1:>2:>3:>4:>5:>Nil) +-- 12 +pattern (:>) :: a -> Vec n a -> Vec (n + 1) a +pattern (:>) x xs <- ((\ys -> (head ys,tail ys)) -> (x,xs)) + where + (:>) x xs = Cons x xs + +infixr 5 :> + +head :: Vec (n + 1) a -> a +head (x `Cons` _) = x + +tail :: Vec (n + 1) a -> Vec n a +tail (_ `Cons` xs) = unsafeCoerce xs + +-- | Perfect depth binary tree. +-- +-- * Only has elements at the leaf of the tree +-- * A tree of depth /d/ has /2^d/ elements. +data RTree :: Nat -> * -> * where + LR_ :: a -> RTree 0 a + BR_ :: RTree d a -> RTree d a -> RTree (d+1) a + +textract :: RTree 0 a -> a +textract (LR_ x) = x +{-# NOINLINE textract #-} + +tsplit :: RTree (d+1) a -> (RTree d a,RTree d a) +tsplit (BR_ l r) = (unsafeCoerce l, unsafeCoerce r) +{-# NOINLINE tsplit #-} + +-- | Leaf of a perfect depth tree +-- +-- >>> LR 1 +-- 1 +-- >>> let x = LR 1 +-- >>> :t x +-- x :: Num a => RTree 0 a +-- +-- Can be used as a pattern: +-- +-- >>> let f (LR a) (LR b) = a + b +-- >>> :t f +-- f :: Num a => RTree 0 a -> RTree 0 a -> a +-- >>> f (LR 1) (LR 2) +-- 3 +pattern LR :: a -> RTree 0 a +pattern LR x <- (textract -> x) + where + LR x = LR_ x + +-- | Branch of a perfect depth tree +-- +-- >>> BR (LR 1) (LR 2) +-- <1,2> +-- >>> let x = BR (LR 1) (LR 2) +-- >>> :t x +-- x :: Num a => RTree 1 a +-- +-- Case be used a pattern: +-- +-- >>> let f (BR (LR a) (LR b)) = LR (a + b) +-- >>> :t f +-- f :: Num a => RTree 1 a -> RTree 0 a +-- >>> f (BR (LR 1) (LR 2)) +-- 3 +pattern BR :: RTree d a -> RTree d a -> RTree (d+1) a +pattern BR l r <- ((\t -> (tsplit t)) -> (l,r)) + where + BR l r = BR_ l r diff --git a/html-test/src/BundledPatterns2.hs b/html-test/src/BundledPatterns2.hs new file mode 100644 index 00000000..5e9a83a7 --- /dev/null +++ b/html-test/src/BundledPatterns2.hs @@ -0,0 +1,10 @@ +{-# LANGUAGE DataKinds, GADTs, KindSignatures, PatternSynonyms, TypeOperators, + ViewPatterns #-} +module BundledPatterns2 (Vec((:>), Empty), RTree(..)) where + +import GHC.TypeLits + +import BundledPatterns + +pattern Empty :: Vec 0 a +pattern Empty <- Nil diff --git a/html-test/src/ConstructorPatternExport.hs b/html-test/src/ConstructorPatternExport.hs new file mode 100644 index 00000000..7897b4bc --- /dev/null +++ b/html-test/src/ConstructorPatternExport.hs @@ -0,0 +1,26 @@ +{-# LANGUAGE PatternSynonyms #-} +{-# LANGUAGE ExistentialQuantification #-} +{-# LANGUAGE GADTs #-} +{-# LANGUAGE KindSignatures #-} + +module ConstructorPatternExport ( + pattern FooCons + , pattern MyRecCons + , pattern (:+) + , pattern BlubCons + , pattern MyGADTCons + ) where + +data Foo a = FooCons String a + +data MyRec = MyRecCons { one :: Bool, two :: Int } + +data MyInfix a = String :+ a + +data Blub = forall b. Show b => BlubCons b + +data MyGADT :: * -> * where + MyGADTCons :: forall a. Eq a => a -> Int -> MyGADT (Maybe String) + +pattern MyGADTCons' :: () => forall a. Eq a => a -> Int -> MyGADT (Maybe String) +pattern MyGADTCons' x y = MyGADTCons x y
\ No newline at end of file diff --git a/html-test/src/DuplicateRecordFields.hs b/html-test/src/DuplicateRecordFields.hs new file mode 100644 index 00000000..2cf9ff43 --- /dev/null +++ b/html-test/src/DuplicateRecordFields.hs @@ -0,0 +1,25 @@ +{-# LANGUAGE DuplicateRecordFields #-} +module DuplicateRecordFields (RawReplay(..)) where + +import Prelude hiding (Int) + +data Int = Int + +data RawReplay = RawReplay + { headerSize :: Int + -- ^ The byte size of the first section. + , headerCRC :: Int + -- ^ The CRC of the first section. + , header :: Int + -- ^ The first section. + , contentSize :: Int + -- ^ The byte size of the second section. + , contentCRC :: Int + -- ^ The CRC of the second section. + , content :: Int + -- ^ The second section. + , footer :: Int + -- ^ Arbitrary data after the second section. In replays generated by + -- Rocket League, this is always empty. However it is not technically + -- invalid to put something here. + }
\ No newline at end of file diff --git a/html-test/src/PR643.hs b/html-test/src/PR643.hs new file mode 100644 index 00000000..565e5b57 --- /dev/null +++ b/html-test/src/PR643.hs @@ -0,0 +1,3 @@ +module PR643 (test) where + +import PR643_1 diff --git a/html-test/src/PR643_1.hs b/html-test/src/PR643_1.hs new file mode 100644 index 00000000..ecd0db94 --- /dev/null +++ b/html-test/src/PR643_1.hs @@ -0,0 +1,7 @@ +module PR643_1 where + +infixr 5 `test` + +-- | Some big documentation +test :: () +test = () diff --git a/html-test/src/PatternSyns.hs b/html-test/src/PatternSyns.hs index 8af5eb23..bf0f7848 100644 --- a/html-test/src/PatternSyns.hs +++ b/html-test/src/PatternSyns.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE PatternSynonyms, PolyKinds, TypeOperators #-} +{-# LANGUAGE ExistentialQuantification, PatternSynonyms, PolyKinds, TypeOperators #-} -- | Testing some pattern synonyms module PatternSyns where @@ -15,8 +15,19 @@ pattern Bar x = FooCtor (Foo x) -- | Pattern synonym for (':<->') pattern x :<-> y = (Foo x, Bar y) +-- | BlubType is existentially quantified +data BlubType = forall x. Show x => BlubCtor x + +-- | Pattern synonym for 'Blub' x +pattern Blub x = BlubCtor x + -- | Doc for ('><') data (a :: *) >< b = Empty -- | Pattern for 'Empty' pattern E = Empty + +-- | Earlier ghc versions didn't allow explicit signatures +-- on pattern synonyms. +pattern PatWithExplicitSig :: Eq somex => somex -> FooType somex +pattern PatWithExplicitSig x = FooCtor x diff --git a/html-test/src/SpuriousSuperclassConstraints.hs b/html-test/src/SpuriousSuperclassConstraints.hs index d9e43e1c..3e230945 100644 --- a/html-test/src/SpuriousSuperclassConstraints.hs +++ b/html-test/src/SpuriousSuperclassConstraints.hs @@ -7,7 +7,7 @@ -- -- <http://www.haskell.org/pipermail/haskell-cafe/2012-September/103600.html> -- --- And here is the corresponding theard on glasgow-haskell-users: +-- And here is the corresponding thread on glasgow-haskell-users: -- -- <http://www.haskell.org/pipermail/glasgow-haskell-users/2012-September/022914.html> -- diff --git a/latex-test/Main.hs b/latex-test/Main.hs index 5989410b..8d2a4922 100755 --- a/latex-test/Main.hs +++ b/latex-test/Main.hs @@ -1,10 +1,12 @@ {-# LANGUAGE CPP #-} +import Data.Function import System.Environment import System.FilePath import Test.Haddock +import Test.Haddock.Utils checkConfig :: CheckConfig String @@ -12,7 +14,7 @@ checkConfig = CheckConfig { ccfgRead = Just , ccfgClean = \_ -> id , ccfgDump = id - , ccfgEqual = (==) + , ccfgEqual = (==) `on` crlfToLf } diff --git a/build-windows-dist.sh b/scripts/build-windows-dist.sh index 2ae7dd2a..2ae7dd2a 100644 --- a/build-windows-dist.sh +++ b/scripts/build-windows-dist.sh diff --git a/make-sdist.sh b/scripts/make-sdist.sh index 914bf909..914bf909 100644 --- a/make-sdist.sh +++ b/scripts/make-sdist.sh |