├── .arcconfig ├── .arclint ├── .ghci ├── .gitignore ├── .travis.yml ├── CHANGES.md ├── CONTRIBUTING ├── LICENSE ├── Makefile ├── README.md ├── STYLE ├── Setup.lhs ├── cabal.project ├── doc ├── .gitignore ├── Makefile ├── README.md ├── cheatsheet │ ├── LICENSE │ ├── README.md │ ├── haddocks.md │ ├── haddocks.pdf │ └── haddocks.svg ├── conf.py ├── ghc.mk ├── index.rst ├── intro.rst ├── invoking.rst └── markup.rst ├── driver-test ├── Main.hs └── ResponseFileSpec.hs ├── driver ├── Main.hs └── ResponseFile.hs ├── ghc.mk ├── haddock-api ├── .ghci ├── CHANGES.md ├── LICENSE ├── Setup.lhs ├── haddock-api.cabal ├── resources │ ├── html │ │ ├── Classic.theme │ │ │ ├── haskell_icon.gif │ │ │ ├── minus.gif │ │ │ ├── plus.gif │ │ │ └── xhaddock.css │ │ ├── Ocean.std-theme │ │ │ ├── hslogo-16.png │ │ │ ├── minus.gif │ │ │ ├── ocean.css │ │ │ ├── plus.gif │ │ │ └── synopsis.png │ │ ├── README.md │ │ ├── gulpfile.js │ │ ├── haddock-bundle.min.js │ │ ├── highlight.js │ │ ├── js-src │ │ │ ├── cookies.ts │ │ │ ├── details-helper.ts │ │ │ ├── init.ts │ │ │ ├── quick-jump.tsx │ │ │ └── style-menu.ts │ │ ├── package-lock.json │ │ ├── package.json │ │ ├── quick-jump.css │ │ ├── quick-jump.min.js │ │ ├── solarized.css │ │ └── tsconfig.json │ └── latex │ │ └── haddock.sty ├── src │ ├── Documentation │ │ └── Haddock.hs │ ├── Haddock.hs │ ├── Haddock │ │ ├── Backends │ │ │ ├── HaddockDB.hs │ │ │ ├── Hoogle.hs │ │ │ ├── Hyperlinker.hs │ │ │ ├── Hyperlinker │ │ │ │ ├── Ast.hs │ │ │ │ ├── Parser.hs │ │ │ │ ├── Renderer.hs │ │ │ │ ├── Types.hs │ │ │ │ └── Utils.hs │ │ │ ├── LaTeX.hs │ │ │ ├── Xhtml.hs │ │ │ └── Xhtml │ │ │ │ ├── Decl.hs │ │ │ │ ├── DocMarkup.hs │ │ │ │ ├── Layout.hs │ │ │ │ ├── Meta.hs │ │ │ │ ├── Names.hs │ │ │ │ ├── Themes.hs │ │ │ │ ├── Types.hs │ │ │ │ └── Utils.hs │ │ ├── Convert.hs │ │ ├── Doc.hs │ │ ├── GhcUtils.hs │ │ ├── Interface.hs │ │ ├── Interface │ │ │ ├── AttachInstances.hs │ │ │ ├── Create.hs │ │ │ ├── Json.hs │ │ │ ├── LexParseRn.hs │ │ │ ├── ParseModuleHeader.hs │ │ │ ├── Rename.hs │ │ │ └── Specialize.hs │ │ ├── InterfaceFile.hs │ │ ├── ModuleTree.hs │ │ ├── Options.hs │ │ ├── Parser.hs │ │ ├── Syb.hs │ │ ├── Types.hs │ │ ├── Utils.hs │ │ ├── Utils │ │ │ └── Json.hs │ │ └── Version.hs │ └── haddock.sh └── test │ ├── Haddock │ └── Backends │ │ └── Hyperlinker │ │ └── ParserSpec.hs │ └── Spec.hs ├── haddock-library ├── .ghci ├── CHANGES.md ├── LICENSE ├── Setup.hs ├── fixtures │ ├── Fixtures.hs │ └── examples │ │ ├── definitionList.input │ │ ├── definitionList.parsed │ │ ├── identifier.input │ │ ├── identifier.parsed │ │ ├── identifierBackticks.input │ │ ├── identifierBackticks.parsed │ │ ├── link.input │ │ ├── link.parsed │ │ ├── linkInline.input │ │ ├── linkInline.parsed │ │ ├── table-simple.input │ │ ├── table-simple.parsed │ │ ├── table1.input │ │ ├── table1.parsed │ │ ├── table2.input │ │ ├── table2.parsed │ │ ├── table3.input │ │ ├── table3.parsed │ │ ├── table4.input │ │ ├── table4.parsed │ │ ├── table5.input │ │ ├── table5.parsed │ │ ├── url.input │ │ ├── url.parsed │ │ ├── urlLabel.input │ │ └── urlLabel.parsed ├── haddock-library.cabal ├── src │ └── Documentation │ │ └── Haddock │ │ ├── Doc.hs │ │ ├── Markup.hs │ │ ├── Parser.hs │ │ ├── Parser │ │ ├── Monad.hs │ │ └── Util.hs │ │ ├── Types.hs │ │ └── Utf8.hs └── test │ ├── Documentation │ └── Haddock │ │ ├── Parser │ │ └── UtilSpec.hs │ │ ├── ParserSpec.hs │ │ └── Utf8Spec.hs │ └── Spec.hs ├── haddock-test ├── Setup.lhs ├── haddock-test.cabal └── src │ └── Test │ ├── Haddock.hs │ └── Haddock │ ├── Config.hs │ ├── Process.hs │ ├── Utils.hs │ └── Xhtml.hs ├── haddock.cabal ├── haddock.wrapper ├── hoogle-test ├── Main.hs ├── ref │ ├── Bug722 │ │ └── test.txt │ ├── Bug806 │ │ └── test.txt │ ├── Bug825 │ │ └── test.txt │ ├── assoc-types │ │ └── test.txt │ ├── classes │ │ └── test.txt │ ├── fixity │ │ └── test.txt │ ├── modules │ │ └── test.txt │ └── type-sigs │ │ └── test.txt ├── run └── src │ ├── Bug722 │ └── Bug722.hs │ ├── Bug806 │ └── Bug806.hs │ ├── Bug825 │ └── Bug825.hs │ ├── assoc-types │ └── AssocTypes.hs │ ├── classes │ └── Classes.hs │ ├── fixity │ └── Fixity.hs │ ├── modules │ ├── Bar.hs │ └── Foo.hs │ └── type-sigs │ ├── ReaderT.hs │ └── ReaderTReexport.hs ├── html-test ├── Main.hs ├── ref │ ├── A.html │ ├── B.html │ ├── Bold.html │ ├── Bug1.html │ ├── Bug195.html │ ├── Bug2.html │ ├── Bug201.html │ ├── Bug253.html │ ├── Bug26.html │ ├── Bug280.html │ ├── Bug294.html │ ├── Bug298.html │ ├── Bug3.html │ ├── Bug308.html │ ├── Bug308CrossModule.html │ ├── Bug310.html │ ├── Bug313.html │ ├── Bug335.html │ ├── Bug387.html │ ├── Bug4.html │ ├── Bug458.html │ ├── Bug546.html │ ├── Bug548.html │ ├── Bug6.html │ ├── Bug613.html │ ├── Bug647.html │ ├── Bug679.html │ ├── Bug7.html │ ├── Bug8.html │ ├── Bug85.html │ ├── BugDeprecated.html │ ├── BugExportHeadings.html │ ├── Bugs.html │ ├── BundledPatterns.html │ ├── BundledPatterns2.html │ ├── ConstructorPatternExport.html │ ├── CrossPackageDocs.html │ ├── DeprecatedClass.html │ ├── DeprecatedData.html │ ├── DeprecatedFunction.html │ ├── DeprecatedFunction2.html │ ├── DeprecatedFunction3.html │ ├── DeprecatedModule.html │ ├── DeprecatedModule2.html │ ├── DeprecatedNewtype.html │ ├── DeprecatedReExport.html │ ├── DeprecatedRecord.html │ ├── DeprecatedTypeFamily.html │ ├── DeprecatedTypeSynonym.html │ ├── DuplicateRecordFields.html │ ├── Examples.html │ ├── Extensions.html │ ├── FunArgs.html │ ├── GADTRecords.html │ ├── Hash.html │ ├── HiddenInstances.html │ ├── HiddenInstancesB.html │ ├── Hyperlinks.html │ ├── IgnoreExports.html │ ├── ImplicitParams.html │ ├── Instances.html │ ├── Math.html │ ├── Minimal.html │ ├── ModuleWithWarning.html │ ├── NamedDoc.html │ ├── Nesting.html │ ├── NoLayout.html │ ├── NonGreedy.html │ ├── Operators.html │ ├── OrphanInstances.html │ ├── OrphanInstancesClass.html │ ├── OrphanInstancesType.html │ ├── PR643.html │ ├── PR643_1.html │ ├── PatternSyns.html │ ├── PromotedTypes.html │ ├── Properties.html │ ├── PruneWithWarning.html │ ├── QuasiExpr.html │ ├── QuasiQuote.html │ ├── SpuriousSuperclassConstraints.html │ ├── TH.html │ ├── TH2.html │ ├── Table.html │ ├── Test.html │ ├── Threaded.html │ ├── Threaded_TH.html │ ├── Ticket112.html │ ├── Ticket61.html │ ├── Ticket75.html │ ├── TitledPicture.html │ ├── TypeFamilies.html │ ├── TypeFamilies2.html │ ├── TypeOperators.html │ ├── Unicode.html │ ├── Unicode2.html │ ├── Visible.html │ ├── haddock-util.js │ ├── hslogo-16.png │ ├── mini_A.html │ ├── mini_AdvanceTypes.html │ ├── mini_B.html │ ├── mini_Bug1.html │ ├── mini_Bug2.html │ ├── mini_Bug3.html │ ├── mini_Bug4.html │ ├── mini_Bug6.html │ ├── mini_Bug7.html │ ├── mini_Bug8.html │ ├── mini_BugDeprecated.html │ ├── mini_BugExportHeadings.html │ ├── mini_Bugs.html │ ├── mini_CrossPackageDocs.html │ ├── mini_DeprecatedClass.html │ ├── mini_DeprecatedData.html │ ├── mini_DeprecatedFunction.html │ ├── mini_DeprecatedFunction2.html │ ├── mini_DeprecatedFunction3.html │ ├── mini_DeprecatedModule.html │ ├── mini_DeprecatedModule2.html │ ├── mini_DeprecatedNewtype.html │ ├── mini_DeprecatedReExport.html │ ├── mini_DeprecatedRecord.html │ ├── mini_DeprecatedTypeFamily.html │ ├── mini_DeprecatedTypeSynonym.html │ ├── mini_Examples.html │ ├── mini_FunArgs.html │ ├── mini_GADTRecords.html │ ├── mini_Hash.html │ ├── mini_HiddenInstances.html │ ├── mini_HiddenInstancesB.html │ ├── mini_Hyperlinks.html │ ├── mini_IgnoreExports.html │ ├── mini_Math.html │ ├── mini_ModuleWithWarning.html │ ├── mini_NamedDoc.html │ ├── mini_NoLayout.html │ ├── mini_NonGreedy.html │ ├── mini_Properties.html │ ├── mini_PruneWithWarning.html │ ├── mini_QuasiExpr.html │ ├── mini_QuasiQuote.html │ ├── mini_SpuriousSuperclassConstraints.html │ ├── mini_TH.html │ ├── mini_TH2.html │ ├── mini_Test.html │ ├── mini_Ticket112.html │ ├── mini_Ticket253_1.html │ ├── mini_Ticket253_2.html │ ├── mini_Ticket61.html │ ├── mini_Ticket75.html │ ├── mini_TitledPicture.html │ ├── mini_TypeFamilies.html │ ├── mini_TypeOperators.html │ ├── mini_Unicode.html │ ├── mini_Visible.html │ ├── minus.gif │ ├── ocean.css │ ├── plus.gif │ └── synopsis.png ├── run └── src │ ├── A.hs │ ├── B.hs │ ├── Bold.hs │ ├── Bug1.hs │ ├── Bug195.hs │ ├── Bug2.hs │ ├── Bug201.hs │ ├── Bug253.hs │ ├── Bug26.hs │ ├── Bug280.hs │ ├── Bug294.hs │ ├── Bug298.hs │ ├── Bug3.hs │ ├── Bug308.hs │ ├── Bug308CrossModule.hs │ ├── Bug310.hs │ ├── Bug313.hs │ ├── Bug335.hs │ ├── Bug387.hs │ ├── Bug4.hs │ ├── Bug458.hs │ ├── Bug546.hs │ ├── Bug548.hs │ ├── Bug6.hs │ ├── Bug613.hs │ ├── Bug647.hs │ ├── Bug679.hs │ ├── Bug7.hs │ ├── Bug8.hs │ ├── Bug85.hs │ ├── BugDeprecated.hs │ ├── BugExportHeadings.hs │ ├── Bugs.hs │ ├── BundledPatterns.hs │ ├── BundledPatterns2.hs │ ├── ConstructorPatternExport.hs │ ├── CrossPackageDocs.hs_hidden │ ├── DeprecatedClass.hs │ ├── DeprecatedData.hs │ ├── DeprecatedFunction.hs │ ├── DeprecatedFunction2.hs │ ├── DeprecatedFunction3.hs │ ├── DeprecatedModule.hs │ ├── DeprecatedModule2.hs │ ├── DeprecatedNewtype.hs │ ├── DeprecatedReExport.hs │ ├── DeprecatedRecord.hs │ ├── DeprecatedTypeFamily.hs │ ├── DeprecatedTypeSynonym.hs │ ├── DuplicateRecordFields.hs │ ├── Examples.hs │ ├── Extensions.hs │ ├── FunArgs.hs │ ├── GADTRecords.hs │ ├── Hash.hs │ ├── Hidden.hs │ ├── HiddenInstances.hs │ ├── HiddenInstancesA.hs │ ├── HiddenInstancesB.hs │ ├── Hyperlinks.hs │ ├── IgnoreExports.hs │ ├── ImplicitParams.hs │ ├── Instances.hs │ ├── Math.hs │ ├── Minimal.hs │ ├── ModuleWithWarning.hs │ ├── NamedDoc.hs │ ├── Nesting.hs │ ├── NoLayout.hs │ ├── NonGreedy.hs │ ├── Operators.hs │ ├── OrphanInstances.hs │ ├── OrphanInstancesClass.hs │ ├── OrphanInstancesType.hs │ ├── PR643.hs │ ├── PR643_1.hs │ ├── PatternSyns.hs │ ├── PromotedTypes.hs │ ├── Properties.hs │ ├── PruneWithWarning.hs │ ├── QuasiExpr.hs │ ├── QuasiQuote.hs │ ├── SpuriousSuperclassConstraints.hs │ ├── TH.hs │ ├── TH2.hs │ ├── Table.hs │ ├── Test.hs │ ├── Threaded.hs │ ├── Threaded_TH.hs │ ├── Ticket112.hs │ ├── Ticket61.hs │ ├── Ticket61_Hidden.hs │ ├── Ticket75.hs │ ├── TitledPicture.hs │ ├── TypeFamilies.hs │ ├── TypeFamilies2.hs │ ├── TypeOperators.hs │ ├── Unicode.hs │ ├── Unicode2.hs │ └── Visible.hs ├── hypsrc-test ├── Main.hs ├── ref │ └── src │ │ ├── CPP.html │ │ ├── Classes.html │ │ ├── Constructors.html │ │ ├── Identifiers.html │ │ ├── Literals.html │ │ ├── Operators.html │ │ ├── Polymorphism.html │ │ ├── Records.html │ │ └── Types.html ├── run └── src │ ├── CPP.hs │ ├── Classes.hs │ ├── Constructors.hs │ ├── Identifiers.hs │ ├── Literals.hs │ ├── Operators.hs │ ├── Polymorphism.hs │ ├── Records.hs │ └── Types.hs ├── latex-test ├── Main.hs ├── ref │ └── Simple │ │ ├── Simple.tex │ │ ├── haddock.sty │ │ └── main.tex ├── run └── src │ └── Simple │ └── Simple.hs └── scripts ├── build-windows-dist.sh └── make-sdist.sh /.arcconfig: -------------------------------------------------------------------------------- 1 | { 2 | "project.name" : "haddock", 3 | "repository.callsign" : "HADDOCK", 4 | "phabricator.uri" : "https://phabricator.haskell.org" 5 | } 6 | -------------------------------------------------------------------------------- /.arclint: -------------------------------------------------------------------------------- 1 | { 2 | "linters": { 3 | "filename": { 4 | "type": "filename" 5 | }, 6 | "generated": { 7 | "type": "generated" 8 | }, 9 | "merge-conflict": { 10 | "type": "merge-conflict" 11 | }, 12 | "nolint": { 13 | "type": "nolint" 14 | }, 15 | "haskell": { 16 | "type": "text", 17 | "include": ["(\\.(l?hs(-boot)?|x|y\\.pp)(\\.in)?$)"], 18 | "severity": { 19 | "5": "disabled", 20 | "2": "warning" 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /.ghci: -------------------------------------------------------------------------------- 1 | :set --itest -idist/build -idist/build/autogen -packageghc -optP-include -optPdist/build/autogen/cabal_macros.h 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /dist/ 2 | /dist-newstyle/ 3 | /haddock-api/dist/ 4 | /haddock-library/dist/ 5 | /haddock-test/dist/ 6 | /html-test/out/ 7 | /hypsrc-test/out/ 8 | /latex-test/out/ 9 | /hoogle-test/out/ 10 | 11 | /doc/haddock 12 | /doc/haddock.ps 13 | /doc/haddock.pdf 14 | /doc/autom4te.cache/ 15 | /doc/config.log 16 | /doc/config.mk 17 | /doc/config.status 18 | /doc/configure 19 | tags 20 | TAGS 21 | 22 | /haddock-api/resources/html/node_modules 23 | /haddock-api/resources/html/*.js.map 24 | 25 | .cabal-sandbox 26 | .ghc.environment.* 27 | cabal.sandbox.config 28 | cabal.project.local 29 | cabal.project.local~ 30 | 31 | .stack-work/ 32 | -------------------------------------------------------------------------------- /CONTRIBUTING: -------------------------------------------------------------------------------- 1 | If you're filing an issue, here are the things which will help us a lot: 2 | 3 | * State your GHC version. 4 | 5 | * State your platform, OS and distribution if applicable. 6 | 7 | * State your cabal version if applicable. 8 | 9 | * Tell us how to replicate the problem. If we can't replicate it, we 10 | can't fix it. 11 | 12 | * If the problem involves running Haddock on some source, please 13 | include the sample on which we can replicate, the smaller/cleaner 14 | the better. Include some images if you think it will help us. 15 | 16 | * Include any other info you think might be relevant (sandbox? unusual 17 | setup?). 18 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2002-2010, Simon Marlow. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are met: 5 | 6 | - Redistributions of source code must retain the above copyright notice, 7 | this list of conditions and the following disclaimer. 8 | 9 | - Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY 14 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE 17 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 20 | BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 21 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 22 | OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 23 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # ----------------------------------------------------------------------------- 2 | # 3 | # (c) 2009 The University of Glasgow 4 | # 5 | # This file is part of the GHC build system. 6 | # 7 | # To understand how the build system works and how to modify it, see 8 | # http://hackage.haskell.org/trac/ghc/wiki/Building/Architecture 9 | # http://hackage.haskell.org/trac/ghc/wiki/Building/Modifying 10 | # 11 | # ----------------------------------------------------------------------------- 12 | 13 | dir = utils/haddock 14 | TOP = ../.. 15 | include $(TOP)/mk/sub-makefile.mk 16 | -------------------------------------------------------------------------------- /STYLE: -------------------------------------------------------------------------------- 1 | 2 | See http://github.com/waern/haskell-style-guide 3 | 4 | -------------------------------------------------------------------------------- /Setup.lhs: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env runhaskell 2 | > import Distribution.Simple 3 | > main = defaultMain 4 | -------------------------------------------------------------------------------- /cabal.project: -------------------------------------------------------------------------------- 1 | packages: ./ 2 | ./haddock-api 3 | ./haddock-library 4 | ./haddock-test 5 | -------------------------------------------------------------------------------- /doc/.gitignore: -------------------------------------------------------------------------------- 1 | .build-html -------------------------------------------------------------------------------- /doc/Makefile: -------------------------------------------------------------------------------- 1 | SPHINX_BUILD ?= sphinx-build 2 | 3 | all : html 4 | 5 | .PHONY : html 6 | 7 | html : 8 | $(SPHINX_BUILD) -b html . .build-html 9 | -------------------------------------------------------------------------------- /doc/README.md: -------------------------------------------------------------------------------- 1 | # Haddock documentation 2 | 3 | The documentation is in ReStructuredText format. You need 4 | [Sphinx](http://www.sphinx-doc.org/) to process it. To build the HTML 5 | documentation, 6 | 7 | $ make html 8 | 9 | which leaves the HTML documentation the `.build-html/` subdirectory. 10 | 11 | -------------------------------------------------------------------------------- /doc/cheatsheet/README.md: -------------------------------------------------------------------------------- 1 | ![License: CC BY-SA 4.0](https://img.shields.io/badge/License-CC%20BY--SA%204.0-lightgrey.svg) 2 | 3 | # Haddock Markup Quick Reference 4 | 5 | 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). 6 | 7 | ## License 8 | 9 | This document is licensed under the CC BY-SA 4.0 license. 10 | -------------------------------------------------------------------------------- /doc/cheatsheet/haddocks.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/fbhaddock/9712d8899d452292913a260058a6dd3346e8d39b/doc/cheatsheet/haddocks.pdf -------------------------------------------------------------------------------- /doc/conf.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | import sys 4 | import os 5 | import shlex 6 | 7 | extensions = [] 8 | 9 | source_suffix = '.rst' 10 | master_doc = 'index' 11 | 12 | # General information about the project. 13 | project = u'Haddock' 14 | copyright = u'2016, Simon Marlow' 15 | author = u'Simon Marlow' 16 | version = '1.0' 17 | release = '1.0' 18 | 19 | language = 'en' 20 | 21 | # List of patterns, relative to source directory, that match files and 22 | # directories to ignore when looking for source files. 23 | exclude_patterns = ['.build'] 24 | todo_include_todos = False 25 | 26 | # Syntax highlighting 27 | highlight_language = 'haskell' 28 | pygments_style = 'tango' 29 | 30 | # -- Options for HTML output ---------------------------------------------- 31 | 32 | htmlhelp_basename = 'Haddockdoc' 33 | 34 | 35 | # -- Options for LaTeX output --------------------------------------------- 36 | 37 | latex_elements = { } 38 | 39 | # Grouping the document tree into LaTeX files. List of tuples 40 | # (source start file, target name, title, 41 | # author, documentclass [howto, manual, or own class]). 42 | latex_documents = [ 43 | (master_doc, 'Haddock.tex', u'Haddock Documentation', 44 | u'Simon Marlow', 'manual'), 45 | ] 46 | 47 | 48 | # -- Options for manual page output --------------------------------------- 49 | 50 | # One entry per manual page. List of tuples 51 | # (source start file, name, description, authors, manual section). 52 | man_pages = [ 53 | (master_doc, 'haddock', u'Haddock Documentation', 54 | [author], 1) 55 | ] 56 | 57 | 58 | # -- Options for Texinfo output ------------------------------------------- 59 | 60 | # Grouping the document tree into Texinfo files. List of tuples 61 | # (source start file, target name, title, author, 62 | # dir menu entry, description, category) 63 | texinfo_documents = [ 64 | (master_doc, 'Haddock', u'Haddock Documentation', 65 | author, 'Haddock', 'One line description of project.', 66 | 'Miscellaneous'), 67 | ] 68 | 69 | -------------------------------------------------------------------------------- /doc/ghc.mk: -------------------------------------------------------------------------------- 1 | # ----------------------------------------------------------------------------- 2 | # 3 | # (c) 2009 The University of Glasgow 4 | # 5 | # This file is part of the GHC build system. 6 | # 7 | # To understand how the build system works and how to modify it, see 8 | # http://hackage.haskell.org/trac/ghc/wiki/Building/Architecture 9 | # http://hackage.haskell.org/trac/ghc/wiki/Building/Modifying 10 | # 11 | # ----------------------------------------------------------------------------- 12 | 13 | ifeq "$(BUILD_SPHINX_HTML)" "YES" 14 | html : html_utils/haddock/doc 15 | 16 | $(eval $(call clean-target,utils/haddock/doc,sphinx,utils/haddock/doc/haddock utils/haddock/doc/.build-html utils/haddock/doc/.build-pdf)) 17 | $(eval $(call all-target,utils/haddock/doc,html_utils/haddock/doc)) 18 | INSTALL_HTML_DOC_DIRS += utils/haddock/doc/haddock 19 | endif 20 | 21 | html_utils/haddock/doc : 22 | $(MAKE) -C utils/haddock/doc html SPHINX_BUILD=$(SPHINXBUILD) 23 | cp -R utils/haddock/doc/.build-html utils/haddock/doc/haddock 24 | 25 | -------------------------------------------------------------------------------- /doc/index.rst: -------------------------------------------------------------------------------- 1 | Welcome to Haddock's documentation! 2 | =================================== 3 | 4 | This is Haddock, a tool for automatically generating documentation from 5 | annotated Haskell source code. 6 | 7 | Contents: 8 | 9 | .. toctree:: 10 | :maxdepth: 2 11 | 12 | intro 13 | invoking 14 | markup 15 | 16 | 17 | Indices and tables 18 | ================== 19 | 20 | * :ref:`genindex` 21 | * :ref:`search` 22 | -------------------------------------------------------------------------------- /driver-test/Main.hs: -------------------------------------------------------------------------------- 1 | module Main where 2 | 3 | import Test.Hspec (describe, hspec, Spec) 4 | import qualified ResponseFileSpec (spec) 5 | 6 | 7 | main :: IO () 8 | main = hspec spec 9 | 10 | spec :: Spec 11 | spec = do 12 | describe "ResponseFile" ResponseFileSpec.spec 13 | -------------------------------------------------------------------------------- /driver/Main.hs: -------------------------------------------------------------------------------- 1 | module Main where 2 | 3 | import Documentation.Haddock (haddock) 4 | import ResponseFile (expandResponse) 5 | import System.Environment (getArgs) 6 | 7 | main :: IO () 8 | main = getArgs >>= expandResponse >>= haddock 9 | -------------------------------------------------------------------------------- /haddock-api/.ghci: -------------------------------------------------------------------------------- 1 | :set -isrc -idist/build -idist/build/autogen -optP-include -optPdist/build/autogen/cabal_macros.h 2 | -------------------------------------------------------------------------------- /haddock-api/CHANGES.md: -------------------------------------------------------------------------------- 1 | See [`haddock`'s changelog](https://hackage.haskell.org/package/haddock/changelog). 2 | -------------------------------------------------------------------------------- /haddock-api/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2002-2010, Simon Marlow. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are met: 5 | 6 | - Redistributions of source code must retain the above copyright notice, 7 | this list of conditions and the following disclaimer. 8 | 9 | - Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY 14 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE 17 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 20 | BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 21 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 22 | OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 23 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | -------------------------------------------------------------------------------- /haddock-api/Setup.lhs: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env runhaskell 2 | > import Distribution.Simple 3 | > main = defaultMain 4 | -------------------------------------------------------------------------------- /haddock-api/resources/html/Classic.theme/haskell_icon.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/fbhaddock/9712d8899d452292913a260058a6dd3346e8d39b/haddock-api/resources/html/Classic.theme/haskell_icon.gif -------------------------------------------------------------------------------- /haddock-api/resources/html/Classic.theme/minus.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/fbhaddock/9712d8899d452292913a260058a6dd3346e8d39b/haddock-api/resources/html/Classic.theme/minus.gif -------------------------------------------------------------------------------- /haddock-api/resources/html/Classic.theme/plus.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/fbhaddock/9712d8899d452292913a260058a6dd3346e8d39b/haddock-api/resources/html/Classic.theme/plus.gif -------------------------------------------------------------------------------- /haddock-api/resources/html/Ocean.std-theme/hslogo-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/fbhaddock/9712d8899d452292913a260058a6dd3346e8d39b/haddock-api/resources/html/Ocean.std-theme/hslogo-16.png -------------------------------------------------------------------------------- /haddock-api/resources/html/Ocean.std-theme/minus.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/fbhaddock/9712d8899d452292913a260058a6dd3346e8d39b/haddock-api/resources/html/Ocean.std-theme/minus.gif -------------------------------------------------------------------------------- /haddock-api/resources/html/Ocean.std-theme/plus.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/fbhaddock/9712d8899d452292913a260058a6dd3346e8d39b/haddock-api/resources/html/Ocean.std-theme/plus.gif -------------------------------------------------------------------------------- /haddock-api/resources/html/Ocean.std-theme/synopsis.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/fbhaddock/9712d8899d452292913a260058a6dd3346e8d39b/haddock-api/resources/html/Ocean.std-theme/synopsis.png -------------------------------------------------------------------------------- /haddock-api/resources/html/README.md: -------------------------------------------------------------------------------- 1 | # Compiling 2 | 3 | * Install [node](https://nodejs.org/) and [npm](https://www.npmjs.com) 4 | * Run `npm install` and `npm install gulp-cli -g` in this directory. 5 | * Run `gulp` in this directory. This rebuilds the minified JS files. 6 | 7 | # Development and manual testing 8 | 9 | Generate Haddock docs for some Haskell project. Start an HTTP server in the Haddock docs directory. 10 | (The `file://` protocol doesn't work since it doesn't allow AJAX requests.) 11 | 12 | After each change to the TypeScript sources, compile and copy the generated files (JS and sourcemaps for better debugging) to the Haddock directory: 13 | 14 | ``` 15 | gulp && cp *.min.js path-to/generated-haddock-docs && cp *.js.map path-to/generated-haddock-docs 16 | ``` -------------------------------------------------------------------------------- /haddock-api/resources/html/gulpfile.js: -------------------------------------------------------------------------------- 1 | const gulp = require('gulp'); 2 | const uglify = require('gulp-uglify'); 3 | const browserify = require('browserify'); 4 | const source = require('vinyl-source-stream'); 5 | const buffer = require('vinyl-buffer'); 6 | const tsify = require('tsify'); 7 | const sourcemaps = require('gulp-sourcemaps'); 8 | 9 | function buildJS(targetFileName, files) { 10 | var b = browserify({ entries: files, debug: true }); 11 | return b 12 | .plugin(tsify) 13 | .bundle() 14 | .pipe(source(targetFileName)) 15 | .pipe(buffer()) 16 | .pipe(sourcemaps.init({loadMaps: true})) 17 | .pipe(uglify().on('error', function(e) { console.log(e); })) 18 | .pipe(sourcemaps.write('.')) 19 | .pipe(gulp.dest('.')); 20 | } 21 | 22 | gulp.task('build-js', function() { 23 | buildJS('quick-jump.min.js', ['./js-src/quick-jump.tsx']); 24 | buildJS('haddock-bundle.min.js', ['./js-src/init.ts']); 25 | }); 26 | 27 | gulp.task('default', ['build-js']); -------------------------------------------------------------------------------- /haddock-api/resources/html/highlight.js: -------------------------------------------------------------------------------- 1 | 2 | var highlight = function (on) { 3 | return function () { 4 | var links = document.getElementsByTagName('a'); 5 | for (var i = 0; i < links.length; i++) { 6 | var that = links[i]; 7 | 8 | if (this.href != that.href) { 9 | continue; 10 | } 11 | 12 | if (on) { 13 | that.classList.add("hover-highlight"); 14 | } else { 15 | that.classList.remove("hover-highlight"); 16 | } 17 | } 18 | } 19 | }; 20 | 21 | window.onload = function () { 22 | var links = document.getElementsByTagName('a'); 23 | for (var i = 0; i < links.length; i++) { 24 | links[i].onmouseover = highlight(true); 25 | links[i].onmouseout = highlight(false); 26 | } 27 | }; 28 | -------------------------------------------------------------------------------- /haddock-api/resources/html/js-src/cookies.ts: -------------------------------------------------------------------------------- 1 | export function setCookie(name: string, value: string) { 2 | document.cookie = name + "=" + encodeURIComponent(value) + ";path=/;"; 3 | } 4 | 5 | export function clearCookie(name: string) { 6 | document.cookie = name + "=;path=/;expires=Thu, 01-Jan-1970 00:00:01 GMT;"; 7 | } 8 | 9 | export function getCookie(name: string) { 10 | const nameEQ = name + "="; 11 | const ca = document.cookie.split(';'); 12 | for (let i = 0; i < ca.length; i++) { 13 | let c = ca[i]; 14 | while (c.charAt(0)==' ') c = c.substring(1,c.length); 15 | if (c.indexOf(nameEQ) == 0) { 16 | return decodeURIComponent(c.substring(nameEQ.length,c.length)); 17 | } 18 | } 19 | return null; 20 | } -------------------------------------------------------------------------------- /haddock-api/resources/html/js-src/init.ts: -------------------------------------------------------------------------------- 1 | import * as styleMenu from "./style-menu"; 2 | import * as detailsHelper from "./details-helper"; 3 | import * as quickJump from "./quick-jump"; 4 | 5 | function onDomReady(callback: () => void) { 6 | if (document.readyState === 'interactive') { 7 | callback(); 8 | } else { 9 | document.addEventListener('readystatechange', () => { 10 | if (document.readyState === 'interactive') { 11 | callback(); 12 | } 13 | }); 14 | } 15 | } 16 | 17 | onDomReady(() => { 18 | document.body.classList.add('js-enabled'); 19 | styleMenu.init(); 20 | detailsHelper.init(); 21 | quickJump.init(); 22 | }); -------------------------------------------------------------------------------- /haddock-api/resources/html/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "haddock-quick-jump", 3 | "version": "0.1.0", 4 | "description": "A drop-down search on Haddock docs for navigating quickly to definitions of Haskell functions and types in the current package", 5 | "scripts": { 6 | "test": "echo \"Error: no test specified\" && exit 1", 7 | "build": "gulp" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "https://github.com/haskell/haddock.git" 12 | }, 13 | "author": "Tim Baumann ", 14 | "contributors": [ 15 | "Mark Lentczner ", 16 | "Moritz Drexl ", 17 | "Alex Biehl " 18 | ], 19 | "dependencies": { 20 | "fuse.js": "^3.1.0", 21 | "preact": "^8.2.5" 22 | }, 23 | "devDependencies": { 24 | "browserify": "^14.4.0", 25 | "gulp": "^3.9.1", 26 | "gulp-sourcemaps": "^2.6.1", 27 | "gulp-uglify": "^3.0.0", 28 | "tsify": "^3.0.3", 29 | "typescript": "^2.5.2", 30 | "vinyl-buffer": "^1.0.0", 31 | "vinyl-source-stream": "^1.1.0" 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /haddock-api/resources/html/solarized.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-color: #fdf6e3; 3 | } 4 | 5 | .hs-identifier { 6 | color: #073642; 7 | } 8 | 9 | .hs-identifier.hs-var { 10 | } 11 | 12 | .hs-identifier.hs-type { 13 | color: #5f5faf; 14 | } 15 | 16 | .hs-keyword { 17 | color: #af005f; 18 | } 19 | 20 | .hs-string, .hs-char { 21 | color: #cb4b16; 22 | } 23 | 24 | .hs-number { 25 | color: #268bd2; 26 | } 27 | 28 | .hs-operator { 29 | color: #d33682; 30 | } 31 | 32 | .hs-glyph, .hs-special { 33 | color: #dc322f; 34 | } 35 | 36 | .hs-comment { 37 | color: #8a8a8a; 38 | } 39 | 40 | .hs-pragma { 41 | color: #2aa198; 42 | } 43 | 44 | .hs-cpp { 45 | color: #859900; 46 | } 47 | 48 | a:link, a:visited { 49 | text-decoration: none; 50 | border-bottom: 1px solid #eee8d5; 51 | } 52 | 53 | a:hover, a.hover-highlight { 54 | background-color: #eee8d5; 55 | } 56 | -------------------------------------------------------------------------------- /haddock-api/resources/html/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "sourceMap": true, 4 | "noImplicitAny": true, 5 | "strictNullChecks": true, 6 | "noImplicitThis": true, 7 | "noFallthroughCasesInSwitch": true, 8 | "module": "commonjs", 9 | "target": "es5", 10 | "jsx": "react", 11 | "jsxFactory": "h", 12 | "lib": ["es2015", "dom"] 13 | }, 14 | "include": [ 15 | "js-src/*" 16 | ] 17 | } -------------------------------------------------------------------------------- /haddock-api/src/Haddock/Backends/Hyperlinker/Types.hs: -------------------------------------------------------------------------------- 1 | module Haddock.Backends.Hyperlinker.Types where 2 | 3 | 4 | import qualified GHC 5 | 6 | import Data.Map (Map) 7 | 8 | data Token = Token 9 | { tkType :: TokenType 10 | , tkValue :: String 11 | , tkSpan :: {-# UNPACK #-} !Span 12 | } 13 | deriving (Show) 14 | 15 | type Position = GHC.RealSrcLoc 16 | type Span = GHC.RealSrcSpan 17 | 18 | data TokenType 19 | = TkIdentifier 20 | | TkKeyword 21 | | TkString 22 | | TkChar 23 | | TkNumber 24 | | TkOperator 25 | | TkGlyph 26 | | TkSpecial 27 | | TkSpace 28 | | TkComment 29 | | TkCpp 30 | | TkPragma 31 | | TkUnknown 32 | deriving (Show, Eq) 33 | 34 | 35 | data RichToken = RichToken 36 | { rtkToken :: Token 37 | , rtkDetails :: Maybe TokenDetails 38 | } 39 | 40 | data TokenDetails 41 | = RtkVar GHC.Name 42 | | RtkType GHC.Name 43 | | RtkBind GHC.Name 44 | | RtkDecl GHC.Name 45 | | RtkModule GHC.ModuleName 46 | deriving (Eq) 47 | 48 | 49 | rtkName :: TokenDetails -> Either GHC.Name GHC.ModuleName 50 | rtkName (RtkVar name) = Left name 51 | rtkName (RtkType name) = Left name 52 | rtkName (RtkBind name) = Left name 53 | rtkName (RtkDecl name) = Left name 54 | rtkName (RtkModule name) = Right name 55 | 56 | 57 | -- | Path for making cross-package hyperlinks in generated sources. 58 | -- 59 | -- Used in 'SrcMap' to determine whether module originates in current package 60 | -- or in an external package. 61 | data SrcPath 62 | = SrcExternal FilePath 63 | | SrcLocal 64 | 65 | -- | Mapping from modules to cross-package source paths. 66 | type SrcMap = Map GHC.Module SrcPath 67 | 68 | -------------------------------------------------------------------------------- /haddock-api/src/Haddock/Backends/Xhtml/Meta.hs: -------------------------------------------------------------------------------- 1 | module Haddock.Backends.Xhtml.Meta where 2 | 3 | import Haddock.Utils.Json 4 | import Haddock.Version 5 | 6 | import Data.ByteString.Builder (hPutBuilder) 7 | import System.FilePath (()) 8 | import System.IO (withFile, IOMode (WriteMode)) 9 | 10 | -- | Everytime breaking changes to the Quckjump api 11 | -- happen this needs to be modified. 12 | quickjumpVersion :: Int 13 | quickjumpVersion = 1 14 | 15 | -- | Writes a json encoded file containing additional 16 | -- information about the generated documentation. This 17 | -- is useful for external tools (e.g. hackage). 18 | writeHaddockMeta :: FilePath -> Bool -> IO () 19 | writeHaddockMeta odir withQuickjump = do 20 | let 21 | meta_json :: Value 22 | meta_json = object (concat [ 23 | [ "haddock_version" .= String projectVersion ] 24 | , [ "quickjump_version" .= quickjumpVersion | withQuickjump ] 25 | ]) 26 | 27 | withFile (odir "meta.json") WriteMode $ \h -> 28 | hPutBuilder h (encodeToBuilder meta_json) 29 | -------------------------------------------------------------------------------- /haddock-api/src/Haddock/Backends/Xhtml/Types.hs: -------------------------------------------------------------------------------- 1 | ----------------------------------------------------------------------------- 2 | -- | 3 | -- Module : Haddock.Backends.Html.Types 4 | -- Copyright : (c) Simon Marlow 2003-2006, 5 | -- David Waern 2006-2009, 6 | -- Mark Lentczner 2010 7 | -- License : BSD-like 8 | -- 9 | -- Maintainer : haddock@projects.haskell.org 10 | -- Stability : experimental 11 | -- Portability : portable 12 | ----------------------------------------------------------------------------- 13 | module Haddock.Backends.Xhtml.Types ( 14 | SourceURLs, WikiURLs, 15 | LinksInfo, 16 | Splice, 17 | Unicode, 18 | ) where 19 | 20 | 21 | import Data.Map 22 | import GHC 23 | 24 | 25 | -- the base, module and entity URLs for the source code and wiki links. 26 | type SourceURLs = (Maybe FilePath, Maybe FilePath, Map UnitId FilePath, Map UnitId FilePath) 27 | type WikiURLs = (Maybe FilePath, Maybe FilePath, Maybe FilePath) 28 | 29 | 30 | -- The URL for source and wiki links 31 | type LinksInfo = (SourceURLs, WikiURLs) 32 | 33 | -- Whether something is a splice or not 34 | type Splice = Bool 35 | 36 | -- Whether unicode syntax is to be used 37 | type Unicode = Bool 38 | -------------------------------------------------------------------------------- /haddock-api/src/Haddock/Doc.hs: -------------------------------------------------------------------------------- 1 | {-# OPTIONS_GHC -fno-warn-orphans #-} 2 | module Haddock.Doc ( module Documentation.Haddock.Doc 3 | , docCodeBlock 4 | , combineDocumentation 5 | ) where 6 | 7 | import Data.Maybe 8 | import Documentation.Haddock.Doc 9 | import Haddock.Types 10 | import Haddock.Utils (mkMeta) 11 | 12 | combineDocumentation :: Documentation name -> Maybe (MDoc name) 13 | combineDocumentation (Documentation Nothing Nothing) = Nothing 14 | combineDocumentation (Documentation mDoc mWarning) = 15 | Just (maybe emptyMetaDoc mkMeta mWarning 16 | `metaDocAppend` 17 | fromMaybe emptyMetaDoc mDoc) 18 | 19 | -- Drop trailing whitespace from @..@ code blocks. Otherwise this: 20 | -- 21 | -- -- @ 22 | -- -- foo 23 | -- -- @ 24 | -- 25 | -- turns into (DocCodeBlock "\nfoo\n ") which when rendered in HTML 26 | -- gives an extra vertical space after the code block. The single space 27 | -- on the final line seems to trigger the extra vertical space. 28 | -- 29 | docCodeBlock :: DocH mod id -> DocH mod id 30 | docCodeBlock (DocString s) 31 | = DocString (reverse $ dropWhile (`elem` " \t") $ reverse s) 32 | docCodeBlock (DocAppend l r) 33 | = DocAppend l (docCodeBlock r) 34 | docCodeBlock d = d 35 | -------------------------------------------------------------------------------- /haddock-api/src/Haddock/Parser.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE OverloadedStrings #-} 2 | {-# LANGUAGE StandaloneDeriving 3 | , FlexibleInstances, UndecidableInstances 4 | , IncoherentInstances #-} 5 | {-# LANGUAGE LambdaCase #-} 6 | -- | 7 | -- Module : Haddock.Parser 8 | -- Copyright : (c) Mateusz Kowalczyk 2013, 9 | -- Simon Hengel 2013 10 | -- License : BSD-like 11 | -- 12 | -- Maintainer : haddock@projects.haskell.org 13 | -- Stability : experimental 14 | -- Portability : portable 15 | 16 | module Haddock.Parser ( parseParas 17 | , parseString 18 | , parseIdent 19 | ) where 20 | 21 | import qualified Documentation.Haddock.Parser as P 22 | import DynFlags (DynFlags) 23 | import FastString (mkFastString) 24 | import Documentation.Haddock.Types 25 | import Lexer (mkPState, unP, ParseResult(POk)) 26 | import Parser (parseIdentifier) 27 | import RdrName (RdrName) 28 | import SrcLoc (mkRealSrcLoc, unLoc) 29 | import StringBuffer (stringToStringBuffer) 30 | 31 | parseParas :: DynFlags -> Maybe Package -> String -> MetaDoc mod RdrName 32 | parseParas d p = overDoc (P.overIdentifier (parseIdent d)) . P.parseParas p 33 | 34 | parseString :: DynFlags -> String -> DocH mod RdrName 35 | parseString d = P.overIdentifier (parseIdent d) . P.parseString 36 | 37 | parseIdent :: DynFlags -> String -> Maybe RdrName 38 | parseIdent dflags str0 = 39 | let buffer = stringToStringBuffer str0 40 | realSrcLc = mkRealSrcLoc (mkFastString "") 0 0 41 | pstate = mkPState dflags buffer realSrcLc 42 | in case unP parseIdentifier pstate of 43 | POk _ name -> Just (unLoc name) 44 | _ -> Nothing 45 | -------------------------------------------------------------------------------- /haddock-api/src/Haddock/Version.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CPP #-} 2 | ----------------------------------------------------------------------------- 3 | -- | 4 | -- Module : Haddock.Version 5 | -- Copyright : (c) Simon Marlow 2003 6 | -- License : BSD-like 7 | -- 8 | -- Maintainer : haddock@projects.haskell.org 9 | -- Stability : experimental 10 | -- Portability : portable 11 | ----------------------------------------------------------------------------- 12 | module Haddock.Version ( 13 | projectName, projectVersion, projectUrl 14 | ) where 15 | 16 | #ifdef IN_GHC_TREE 17 | import Paths_haddock ( version ) 18 | #else 19 | import Paths_haddock_api ( version ) 20 | #endif 21 | import Data.Version ( showVersion ) 22 | 23 | projectName :: String 24 | projectName = "Haddock" 25 | 26 | projectUrl :: String 27 | projectUrl = "http://www.haskell.org/haddock/" 28 | 29 | projectVersion :: String 30 | projectVersion = showVersion version 31 | -------------------------------------------------------------------------------- /haddock-api/src/haddock.sh: -------------------------------------------------------------------------------- 1 | # Mini-driver for Haddock 2 | 3 | # needs the following variables: 4 | # HADDOCKLIB 5 | # HADDOCKBIN 6 | 7 | $HADDOCKBIN --lib $HADDOCKLIB ${1+"$@"} 8 | -------------------------------------------------------------------------------- /haddock-api/test/Spec.hs: -------------------------------------------------------------------------------- 1 | {-# OPTIONS_GHC -F -pgmF hspec-discover #-} 2 | -------------------------------------------------------------------------------- /haddock-library/.ghci: -------------------------------------------------------------------------------- 1 | :set -isrc -ivendor/attoparsec-0.12.1.1 -itest -idist/build -idist/build/autogen -optP-include -optPdist/build/autogen/cabal_macros.h 2 | -------------------------------------------------------------------------------- /haddock-library/CHANGES.md: -------------------------------------------------------------------------------- 1 | ## Changes in version 1.6.0 2 | 3 | * `MetaDoc` stores package name for since annotations 4 | 5 | ## Changes in version 1.5.0.1 6 | 7 | * Support for parsing unicode operators (#458) 8 | 9 | ## Changes in version 1.5.0 10 | 11 | * Bifunctor, Bifoldable and Bitraversable instances for DocH and MetaDoc 12 | 13 | * Support for grid tables 14 | * added `DocTable` constructor to `DocH` 15 | * added `Table`, `TableCell` and `TableRow` data types 16 | * added `markupTable` to `DocMarkupH` data type 17 | 18 | ## Changes in version 1.4.5 19 | 20 | * Move markup related data types to haddock-library 21 | -------------------------------------------------------------------------------- /haddock-library/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2002-2010, Simon Marlow. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are met: 5 | 6 | - Redistributions of source code must retain the above copyright notice, 7 | this list of conditions and the following disclaimer. 8 | 9 | - Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY 14 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE 17 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 20 | BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 21 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 22 | OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 23 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | -------------------------------------------------------------------------------- /haddock-library/Setup.hs: -------------------------------------------------------------------------------- 1 | import Distribution.Simple 2 | main = defaultMain 3 | -------------------------------------------------------------------------------- /haddock-library/fixtures/examples/definitionList.input: -------------------------------------------------------------------------------- 1 | [foo]: bar 2 | -------------------------------------------------------------------------------- /haddock-library/fixtures/examples/definitionList.parsed: -------------------------------------------------------------------------------- 1 | DocDefList [_×_ (DocString "foo") (DocString "bar")] 2 | -------------------------------------------------------------------------------- /haddock-library/fixtures/examples/identifier.input: -------------------------------------------------------------------------------- 1 | 'foo' 2 | -------------------------------------------------------------------------------- /haddock-library/fixtures/examples/identifier.parsed: -------------------------------------------------------------------------------- 1 | DocParagraph (DocIdentifier "foo") 2 | -------------------------------------------------------------------------------- /haddock-library/fixtures/examples/identifierBackticks.input: -------------------------------------------------------------------------------- 1 | `foo` 2 | -------------------------------------------------------------------------------- /haddock-library/fixtures/examples/identifierBackticks.parsed: -------------------------------------------------------------------------------- 1 | DocParagraph (DocIdentifier "foo") 2 | -------------------------------------------------------------------------------- /haddock-library/fixtures/examples/link.input: -------------------------------------------------------------------------------- 1 | [link](http://example.com) 2 | -------------------------------------------------------------------------------- /haddock-library/fixtures/examples/link.parsed: -------------------------------------------------------------------------------- 1 | DocParagraph 2 | (DocHyperlink 3 | Hyperlink 4 | {hyperlinkLabel = Just "link", 5 | hyperlinkUrl = "http://example.com"}) 6 | -------------------------------------------------------------------------------- /haddock-library/fixtures/examples/linkInline.input: -------------------------------------------------------------------------------- 1 | Bla [link](http://example.com) 2 | -------------------------------------------------------------------------------- /haddock-library/fixtures/examples/linkInline.parsed: -------------------------------------------------------------------------------- 1 | DocParagraph 2 | (DocAppend 3 | (DocString "Bla ") 4 | (DocHyperlink 5 | Hyperlink 6 | {hyperlinkLabel = Just "link", hyperlinkUrl = "http://example.com"})) 7 | -------------------------------------------------------------------------------- /haddock-library/fixtures/examples/table-simple.input: -------------------------------------------------------------------------------- 1 | +------+--------------+------------------------------------------+ 2 | | code | message | description | 3 | +======+==============+==========================================+ 4 | | 200 | @OK@ | operation successful | 5 | +------+--------------+------------------------------------------+ 6 | | 204 | @No Content@ | operation successful, no body returned | 7 | +------+--------------+------------------------------------------+ 8 | -------------------------------------------------------------------------------- /haddock-library/fixtures/examples/table1.input: -------------------------------------------------------------------------------- 1 | +------------------------+------------+----------+----------+ 2 | | Header row, column 1 | Header 2 | Header 3 | Header 4 | 3 | | (header rows optional) | | | | 4 | +========================+============+==========+==========+ 5 | | body row 1, column 1 | column 2 | column 3 | column 4 | 6 | +------------------------+------------+----------+----------+ 7 | | body row 2 | Cells may span columns. | 8 | +------------------------+------------+---------------------+ 9 | | body row 3 | Cells may | \[ | 10 | +------------------------+ span rows. | f(n) = \sum_{i=1} | 11 | | body row 4 | | \] | 12 | +------------------------+------------+---------------------+ 13 | -------------------------------------------------------------------------------- /haddock-library/fixtures/examples/table2.input: -------------------------------------------------------------------------------- 1 | +--------------+----------+-----------+-----------+ 2 | | row 1, col 1 | column 2 | column 3 | column 4 | 3 | +--------------+----------+-----------+-----------+ 4 | | row 2 | | 5 | +--------------+----------+-----------+-----------+ 6 | | row 3 | | | | 7 | +--------------+----------+-----------+-----------+ 8 | -------------------------------------------------------------------------------- /haddock-library/fixtures/examples/table3.input: -------------------------------------------------------------------------------- 1 | +--------------+----------+-----------+-----------+ 2 | | row 1, col 1 | column 2 | column 3 | column 4 | 3 | +--------------+----------+-----------+-----------+ 4 | | row 2 | Use the command ``ls | more``. | 5 | +--------------+----------+-----------+-----------+ 6 | | row 3 | | | | 7 | +--------------+----------+-----------+-----------+ 8 | -------------------------------------------------------------------------------- /haddock-library/fixtures/examples/table4.input: -------------------------------------------------------------------------------- 1 | Single outer cell: 2 | 3 | +-------------+ 4 | | outer | 5 | | | 6 | +-------+ | 7 | | inner | | 8 | +-------+-----+ 9 | 10 | Broken (only inner cell is rendered): 11 | 12 | +-------+-----+ 13 | | inner | | 14 | +-------+ | 15 | | | 16 | | outer | 17 | +-------------+ 18 | -------------------------------------------------------------------------------- /haddock-library/fixtures/examples/table4.parsed: -------------------------------------------------------------------------------- 1 | DocAppend 2 | (DocParagraph (DocString "Single outer cell:")) 3 | (DocAppend 4 | (DocTable 5 | Table 6 | {tableBodyRows = [TableRow 7 | [TableCell 8 | {tableCellColspan = 1, 9 | tableCellContents = DocString 10 | (concat 11 | [" outer \n", 12 | " \n", 13 | "-------+ \n", 14 | " inner | "]), 15 | tableCellRowspan = 1}]], 16 | tableHeaderRows = []}) 17 | (DocAppend 18 | (DocParagraph (DocString "Broken (only inner cell is rendered):")) 19 | (DocTable 20 | Table 21 | {tableBodyRows = [TableRow 22 | [TableCell 23 | {tableCellColspan = 1, 24 | tableCellContents = DocString " inner ", 25 | tableCellRowspan = 1}]], 26 | tableHeaderRows = []}))) 27 | -------------------------------------------------------------------------------- /haddock-library/fixtures/examples/table5.input: -------------------------------------------------------------------------------- 1 | +--------------+----------+-----------+-----------+ 2 | | row 1, col 1 | column 2 | column 3 | column 4 | 3 | +==============+==========+===========+===========+ 4 | | row 2 | Use the command @ls | more@. | 5 | | | | 6 | | +----------+-----------+-----------+ 7 | | row 3 | | | | 8 | +--------------+----------+-----------+-----------+ 9 | -------------------------------------------------------------------------------- /haddock-library/fixtures/examples/url.input: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /haddock-library/fixtures/examples/url.parsed: -------------------------------------------------------------------------------- 1 | DocParagraph 2 | (DocHyperlink 3 | Hyperlink 4 | {hyperlinkLabel = Nothing, hyperlinkUrl = "http://example.com/"}) 5 | -------------------------------------------------------------------------------- /haddock-library/fixtures/examples/urlLabel.input: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /haddock-library/fixtures/examples/urlLabel.parsed: -------------------------------------------------------------------------------- 1 | DocParagraph 2 | (DocHyperlink 3 | Hyperlink 4 | {hyperlinkLabel = Just "some link", 5 | hyperlinkUrl = "http://example.com/"}) 6 | -------------------------------------------------------------------------------- /haddock-library/test/Documentation/Haddock/Parser/UtilSpec.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE OverloadedStrings #-} 2 | module Documentation.Haddock.Parser.UtilSpec (main, spec) where 3 | 4 | import Documentation.Haddock.Parser.Monad 5 | import Documentation.Haddock.Parser.Util 6 | import Data.Either.Compat (isLeft) 7 | import Test.Hspec 8 | import Control.Applicative 9 | 10 | main :: IO () 11 | main = hspec spec 12 | 13 | spec :: Spec 14 | spec = do 15 | describe "takeUntil" $ do 16 | it "takes everything until a specified byte sequence" $ do 17 | snd <$> parseOnly (takeUntil "end") "someend" `shouldBe` Right "some" 18 | 19 | it "requires the end sequence" $ do 20 | snd <$> parseOnly (takeUntil "end") "someen" `shouldSatisfy` isLeft 21 | 22 | it "takes escaped bytes unconditionally" $ do 23 | snd <$> parseOnly (takeUntil "end") "some\\endend" `shouldBe` Right "some\\end" 24 | -------------------------------------------------------------------------------- /haddock-library/test/Documentation/Haddock/Utf8Spec.hs: -------------------------------------------------------------------------------- 1 | module Documentation.Haddock.Utf8Spec (main, spec) where 2 | 3 | import Test.Hspec 4 | import Test.QuickCheck 5 | import Documentation.Haddock.Utf8 6 | 7 | main :: IO () 8 | main = hspec spec 9 | 10 | spec :: Spec 11 | spec = do 12 | describe "decodeUtf8" $ do 13 | it "is inverse to encodeUtf8" $ do 14 | property $ \xs -> (decodeUtf8 . encodeUtf8) xs `shouldBe` xs 15 | -------------------------------------------------------------------------------- /haddock-library/test/Spec.hs: -------------------------------------------------------------------------------- 1 | {-# OPTIONS_GHC -F -pgmF hspec-discover #-} 2 | -------------------------------------------------------------------------------- /haddock-test/Setup.lhs: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env runhaskell 2 | > import Distribution.Simple 3 | > main = defaultMain 4 | -------------------------------------------------------------------------------- /haddock-test/haddock-test.cabal: -------------------------------------------------------------------------------- 1 | name: haddock-test 2 | version: 0.0.1 3 | synopsis: Test utilities for Haddock 4 | license: BSD3 5 | author: Simon Marlow, David Waern 6 | maintainer: Simon Hengel , Mateusz Kowalczyk 7 | homepage: http://www.haskell.org/haddock/ 8 | bug-reports: https://github.com/haskell/haddock/issues 9 | copyright: (c) Simon Marlow, David Waern 10 | category: Documentation 11 | build-type: Simple 12 | cabal-version: >= 1.10 13 | stability: experimental 14 | 15 | library 16 | default-language: Haskell2010 17 | ghc-options: -Wall 18 | hs-source-dirs: src 19 | build-depends: base >= 4.3 && < 4.12, bytestring, directory, process, filepath, Cabal, xml, xhtml, syb 20 | 21 | exposed-modules: 22 | Test.Haddock 23 | Test.Haddock.Config 24 | Test.Haddock.Utils 25 | Test.Haddock.Xhtml 26 | 27 | other-modules: 28 | Test.Haddock.Process 29 | -------------------------------------------------------------------------------- /haddock-test/src/Test/Haddock/Process.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE RecordWildCards #-} 2 | 3 | 4 | module Test.Haddock.Process where 5 | 6 | 7 | import Control.Monad 8 | 9 | import System.Exit 10 | import System.IO 11 | import System.Process 12 | 13 | 14 | type Environment = [(String, String)] 15 | 16 | 17 | data ProcessConfig = ProcessConfig 18 | { pcArgs :: [String] 19 | , pcWorkDir :: Maybe FilePath 20 | , pcEnv :: Maybe Environment 21 | , pcStdIn :: Maybe Handle 22 | , pcStdOut :: Maybe Handle 23 | , pcStdErr :: Maybe Handle 24 | } 25 | deriving (Show) 26 | 27 | 28 | processConfig :: ProcessConfig 29 | processConfig = ProcessConfig 30 | { pcArgs = [] 31 | , pcWorkDir = Nothing 32 | , pcEnv = Nothing 33 | , pcStdIn = Nothing 34 | , pcStdOut = Nothing 35 | , pcStdErr = Nothing 36 | } 37 | 38 | 39 | runProcess' :: FilePath -> ProcessConfig -> IO ProcessHandle 40 | runProcess' path (ProcessConfig { .. }) = runProcess 41 | path pcArgs pcWorkDir pcEnv pcStdIn pcStdOut pcStdErr 42 | 43 | 44 | waitForSuccess :: String -> ProcessHandle -> IO () 45 | waitForSuccess msg handle = do 46 | result <- waitForProcess handle 47 | unless (result == ExitSuccess) $ do 48 | hPutStrLn stderr $ msg 49 | exitFailure 50 | -------------------------------------------------------------------------------- /haddock-test/src/Test/Haddock/Utils.hs: -------------------------------------------------------------------------------- 1 | module Test.Haddock.Utils where 2 | 3 | 4 | import Control.Monad 5 | 6 | import Data.Maybe 7 | 8 | import System.Directory 9 | import System.FilePath 10 | 11 | 12 | mlast :: [a] -> Maybe a 13 | mlast = listToMaybe . reverse 14 | 15 | 16 | partitionM :: Monad m => (a -> m Bool) -> [a] -> m ([a], [a]) 17 | partitionM _ [] = pure ([], []) 18 | partitionM p (x:xs) = do 19 | (ss, fs) <- partitionM p xs 20 | b <- p x 21 | pure $ if b then (x:ss, fs) else (ss, x:fs) 22 | 23 | 24 | whenM :: Monad m => m Bool -> m () -> m () 25 | whenM mb action = mb >>= \b -> when b action 26 | 27 | 28 | getDirectoryTree :: FilePath -> IO [FilePath] 29 | getDirectoryTree path = do 30 | (dirs, files) <- partitionM isDirectory =<< contents 31 | subfiles <- fmap concat . forM dirs $ \dir -> 32 | map (dir ) <$> getDirectoryTree (path dir) 33 | pure $ files ++ subfiles 34 | where 35 | contents = filter realEntry <$> getDirectoryContents path 36 | isDirectory entry = doesDirectoryExist $ path entry 37 | realEntry entry = not $ entry == "." || entry == ".." 38 | 39 | 40 | createEmptyDirectory :: FilePath -> IO () 41 | createEmptyDirectory path = do 42 | whenM (doesDirectoryExist path) $ removeDirectoryRecursive path 43 | createDirectory path 44 | 45 | 46 | -- | Just like 'copyFile' but output directory path is not required to exist. 47 | copyFile' :: FilePath -> FilePath -> IO () 48 | copyFile' old new = do 49 | createDirectoryIfMissing True $ takeDirectory new 50 | copyFile old new 51 | 52 | 53 | crlfToLf :: String -> String 54 | crlfToLf "" = "" 55 | crlfToLf ('\r' : '\n' : rest) = '\n' : crlfToLf rest 56 | crlfToLf ('\r' : rest) = '\n' : crlfToLf rest 57 | crlfToLf (other : rest) = other : crlfToLf rest 58 | -------------------------------------------------------------------------------- /haddock.wrapper: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | exec "$executablename" -B"$topdir" -l"$topdir" ${1+"$@"} 4 | -------------------------------------------------------------------------------- /hoogle-test/Main.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CPP #-} 2 | 3 | 4 | import Data.Function 5 | import System.Environment 6 | import System.FilePath 7 | 8 | import Test.Haddock 9 | import Test.Haddock.Utils 10 | 11 | 12 | checkConfig :: CheckConfig String 13 | checkConfig = CheckConfig 14 | { ccfgRead = Just 15 | , ccfgClean = \_ -> id 16 | , ccfgDump = id 17 | , ccfgEqual = (==) `on` crlfToLf 18 | } 19 | 20 | 21 | dirConfig :: DirConfig 22 | dirConfig = defaultDirConfig $ takeDirectory __FILE__ 23 | 24 | 25 | main :: IO () 26 | main = do 27 | cfg <- parseArgs checkConfig dirConfig =<< getArgs 28 | runAndCheck $ cfg 29 | { cfgHaddockArgs = cfgHaddockArgs cfg ++ 30 | [ "--package-name=test" 31 | , "--package-version=0.0.0" 32 | , "--hoogle" 33 | ] 34 | } 35 | -------------------------------------------------------------------------------- /hoogle-test/ref/Bug722/test.txt: -------------------------------------------------------------------------------- 1 | -- Hoogle documentation, generated by Haddock 2 | -- See Hoogle, http://www.haskell.org/hoogle/ 3 | 4 | @package test 5 | @version 0.0.0 6 | 7 | module Bug722 8 | class Foo a 9 | (!@#) :: Foo a => a -> a -> a 10 | infixl 4 !@# 11 | type family &* :: * -> * -> * 12 | infixr 3 &* 13 | data a :-& b 14 | (:^&) :: a -> b -> (:-&) a b 15 | infixl 6 :-& 16 | infixl 6 :^& 17 | -------------------------------------------------------------------------------- /hoogle-test/ref/Bug806/test.txt: -------------------------------------------------------------------------------- 1 | -- Hoogle documentation, generated by Haddock 2 | -- See Hoogle, http://www.haskell.org/hoogle/ 3 | 4 | @package test 5 | @version 0.0.0 6 | 7 | module Bug806 8 | 9 | -- | F1 docs 10 | type family F1 a b :: * -> * 11 | 12 | -- | F2 docs 13 | type family F2 a b :: * -> * 14 | 15 | -- | D docs 16 | data family D a :: * -> * 17 | v :: Int 18 | 19 | -- | C docs 20 | class C a where { 21 | 22 | -- | AT docs 23 | type family AT a; 24 | type AT a = Proxy (Proxy (Proxy (Proxy (Proxy (Proxy (Proxy (Proxy (Proxy (Proxy))))))))); 25 | } 26 | -------------------------------------------------------------------------------- /hoogle-test/ref/Bug825/test.txt: -------------------------------------------------------------------------------- 1 | -- Hoogle documentation, generated by Haddock 2 | -- See Hoogle, http://www.haskell.org/hoogle/ 3 | 4 | @package test 5 | @version 0.0.0 6 | 7 | module Bug825 8 | data a :~: b 9 | data (:~~:) a b 10 | -------------------------------------------------------------------------------- /hoogle-test/ref/assoc-types/test.txt: -------------------------------------------------------------------------------- 1 | -- Hoogle documentation, generated by Haddock 2 | -- See Hoogle, http://www.haskell.org/hoogle/ 3 | 4 | @package test 5 | @version 0.0.0 6 | 7 | module AssocTypes 8 | class Foo a where { 9 | type family Bar a b; 10 | type family Baz a; 11 | type Baz a = [(a, a)]; 12 | } 13 | bar :: Foo a => Bar a a 14 | instance AssocTypes.Foo [a] 15 | -------------------------------------------------------------------------------- /hoogle-test/ref/classes/test.txt: -------------------------------------------------------------------------------- 1 | -- Hoogle documentation, generated by Haddock 2 | -- See Hoogle, http://www.haskell.org/hoogle/ 3 | 4 | @package test 5 | @version 0.0.0 6 | 7 | module Classes 8 | class Foo f 9 | bar :: Foo f => f a -> f b -> f (a, b) 10 | baz :: Foo f => f () 11 | class Quux q 12 | (+++) :: Quux q => q -> q -> q 13 | (///) :: Quux q => q -> q -> q 14 | (***) :: Quux q => q -> q -> q 15 | logBase :: Quux q => q -> q -> q 16 | foo :: Quux q => q -> q -> q 17 | quux :: Quux q => q -> q -> q 18 | -------------------------------------------------------------------------------- /hoogle-test/ref/fixity/test.txt: -------------------------------------------------------------------------------- 1 | -- Hoogle documentation, generated by Haddock 2 | -- See Hoogle, http://www.haskell.org/hoogle/ 3 | 4 | @package test 5 | @version 0.0.0 6 | 7 | module Fixity 8 | (+++) :: a -> a -> a 9 | infix 6 +++ 10 | (***) :: a -> a -> a 11 | infixl 7 *** 12 | (///) :: a -> a -> a 13 | infixr 8 /// 14 | -------------------------------------------------------------------------------- /hoogle-test/ref/modules/test.txt: -------------------------------------------------------------------------------- 1 | -- Hoogle documentation, generated by Haddock 2 | -- See Hoogle, http://www.haskell.org/hoogle/ 3 | 4 | @package test 5 | @version 0.0.0 6 | 7 | module Foo 8 | foo :: Int -> Int 9 | foo' :: Int -> Int -> Int 10 | 11 | module Bar 12 | bar :: Int -> Int 13 | bar' :: Int -> Int -> Int 14 | -------------------------------------------------------------------------------- /hoogle-test/ref/type-sigs/test.txt: -------------------------------------------------------------------------------- 1 | -- Hoogle documentation, generated by Haddock 2 | -- See Hoogle, http://www.haskell.org/hoogle/ 3 | 4 | @package test 5 | @version 0.0.0 6 | 7 | module ReaderT 8 | newtype ReaderT r m a 9 | ReaderT :: r -> m a -> ReaderT r m a 10 | [runReaderT] :: ReaderT r m a -> r -> m a 11 | 12 | module ReaderTReexport 13 | newtype ReaderT r m a 14 | ReaderT :: r -> m a -> ReaderT r m a 15 | [runReaderT] :: ReaderT r m a -> r -> m a 16 | runReaderT :: ReaderT r m a -> r -> m a 17 | -------------------------------------------------------------------------------- /hoogle-test/run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | export HADDOCK_PATH=$(which haddock) 4 | LIB_PATH="$(dirname "$BASH_SOURCE")/../haddock-test/src/" 5 | MAIN_PATH="$(dirname "$BASH_SOURCE")/Main.hs" 6 | runhaskell -i:"$LIB_PATH" $MAIN_PATH $@ 7 | -------------------------------------------------------------------------------- /hoogle-test/src/Bug722/Bug722.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE TypeOperators, TypeFamilies #-} 2 | module Bug722 where 3 | 4 | class Foo a where 5 | (!@#) :: a -> a -> a 6 | infixl 4 !@# 7 | 8 | type family (&*) :: * -> * -> * 9 | infixr 3 &* 10 | 11 | data a :-& b = a :^& b 12 | infixl 6 :-&, :^& 13 | 14 | -------------------------------------------------------------------------------- /hoogle-test/src/Bug806/Bug806.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE KindSignatures #-} 2 | {-# LANGUAGE TypeFamilies #-} 3 | {-# LANGUAGE UndecidableInstances #-} 4 | module Bug806 where 5 | 6 | import Data.Proxy 7 | 8 | -- | 'F1' docs 9 | type family F1 a b :: * -> * 10 | -- | 'F2' docs 11 | type family F2 a b :: * -> * where 12 | F2 Int b = Maybe 13 | F2 a b = [] 14 | -- | 'D' docs 15 | data family D a :: * -> * 16 | 17 | v :: Int 18 | v = 42 19 | 20 | -- | 'C' docs 21 | class C a where 22 | -- | 'AT' docs 23 | type AT a 24 | type AT a = Proxy (Proxy (Proxy (Proxy (Proxy (Proxy (Proxy (Proxy (Proxy (Proxy))))))))) 25 | -------------------------------------------------------------------------------- /hoogle-test/src/Bug825/Bug825.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE MultiParamTypeClasses #-} 2 | {-# LANGUAGE TypeOperators #-} 3 | module Bug825 where 4 | 5 | data a :~: b 6 | data (:~~:) a b 7 | -------------------------------------------------------------------------------- /hoogle-test/src/assoc-types/AssocTypes.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE TypeFamilies #-} 2 | {-# LANGUAGE AllowAmbiguousTypes #-} 3 | 4 | 5 | module AssocTypes where 6 | 7 | 8 | class Foo a where 9 | 10 | type Bar a b 11 | type Baz a 12 | 13 | type Baz a = [(a, a)] 14 | 15 | bar :: Bar a a 16 | bar = undefined 17 | 18 | 19 | instance Foo [a] where 20 | 21 | type Bar [a] Int = [(a, Bool)] 22 | type Bar [a] Bool = [(Int, a)] 23 | 24 | type Baz [a] = (a, a, a) 25 | -------------------------------------------------------------------------------- /hoogle-test/src/classes/Classes.hs: -------------------------------------------------------------------------------- 1 | module Classes where 2 | 3 | 4 | class Foo f where 5 | 6 | bar :: f a -> f b -> f (a, b) 7 | baz :: f () 8 | 9 | baz = undefined 10 | 11 | 12 | class Quux q where 13 | 14 | (+++), (///) :: q -> q -> q 15 | (***), logBase :: q -> q -> q 16 | foo, quux :: q -> q -> q 17 | -------------------------------------------------------------------------------- /hoogle-test/src/fixity/Fixity.hs: -------------------------------------------------------------------------------- 1 | module Fixity where 2 | 3 | 4 | (+++), (***), (///) :: a -> a -> a 5 | (+++) = undefined 6 | (***) = undefined 7 | (///) = undefined 8 | 9 | 10 | infix 6 +++ 11 | infixl 7 *** 12 | infixr 8 /// 13 | -------------------------------------------------------------------------------- /hoogle-test/src/modules/Bar.hs: -------------------------------------------------------------------------------- 1 | module Bar where 2 | 3 | 4 | import Foo 5 | 6 | 7 | bar :: Int -> Int 8 | bar x = foo' x x 9 | 10 | 11 | bar' :: Int -> Int -> Int 12 | bar' x y = foo' (bar (foo x)) (bar (foo y)) 13 | -------------------------------------------------------------------------------- /hoogle-test/src/modules/Foo.hs: -------------------------------------------------------------------------------- 1 | module Foo where 2 | 3 | 4 | foo :: Int -> Int 5 | foo = (* 2) 6 | 7 | 8 | foo' :: Int -> Int -> Int 9 | foo' x y = foo x + foo y 10 | -------------------------------------------------------------------------------- /hoogle-test/src/type-sigs/ReaderT.hs: -------------------------------------------------------------------------------- 1 | module ReaderT where 2 | 3 | newtype ReaderT r m a = ReaderT { runReaderT :: r -> m a } 4 | -------------------------------------------------------------------------------- /hoogle-test/src/type-sigs/ReaderTReexport.hs: -------------------------------------------------------------------------------- 1 | module ReaderTReexport (ReaderT(..), runReaderT) where 2 | 3 | import ReaderT 4 | -------------------------------------------------------------------------------- /html-test/Main.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CPP #-} 2 | 3 | 4 | import Data.Char 5 | import Data.Function (on) 6 | 7 | import System.Environment 8 | import System.FilePath 9 | 10 | import Test.Haddock 11 | import Test.Haddock.Xhtml 12 | 13 | 14 | checkConfig :: CheckConfig Xml 15 | checkConfig = CheckConfig 16 | { ccfgRead = parseXml 17 | , ccfgClean = stripIfRequired 18 | , ccfgDump = dumpXml 19 | , ccfgEqual = (==) `on` dumpXml 20 | } 21 | 22 | 23 | dirConfig :: DirConfig 24 | dirConfig = (defaultDirConfig $ takeDirectory __FILE__) 25 | { dcfgCheckIgnore = checkIgnore 26 | } 27 | 28 | 29 | main :: IO () 30 | main = do 31 | cfg <- parseArgs checkConfig dirConfig =<< getArgs 32 | runAndCheck $ cfg 33 | { cfgHaddockArgs = cfgHaddockArgs cfg ++ ["--pretty-html", "--html"] 34 | } 35 | 36 | 37 | stripIfRequired :: String -> Xml -> Xml 38 | stripIfRequired mdl = 39 | stripLinks' . stripFooter 40 | where 41 | stripLinks' 42 | | mdl `elem` preserveLinksModules = id 43 | | otherwise = stripLinks 44 | 45 | 46 | -- | List of modules in which we don't 'stripLinks' 47 | preserveLinksModules :: [String] 48 | preserveLinksModules = ["Bug253"] 49 | 50 | ingoredTests :: [FilePath] 51 | ingoredTests = 52 | [ 53 | -- Currently some declarations are exported twice 54 | -- we need a reliable way to deduplicate here. 55 | -- Happens since PR #688. 56 | "B" 57 | 58 | -- ignore-exports flag broke with PR #688. We use 59 | -- the Avails calculated by GHC now. Probably 60 | -- requires a change to GHC to "ignore" a modules 61 | -- export list reliably. 62 | , "IgnoreExports" 63 | ] 64 | 65 | checkIgnore :: FilePath -> Bool 66 | checkIgnore file | takeBaseName file `elem` ingoredTests = True 67 | checkIgnore file@(c:_) | takeExtension file == ".html" && isUpper c = False 68 | checkIgnore _ = True 69 | -------------------------------------------------------------------------------- /html-test/ref/Bug2.html: -------------------------------------------------------------------------------- 1 | Bug2
Safe HaskellSafe

Bug2

Documentation

x :: A #

-------------------------------------------------------------------------------- /html-test/ref/Bug280.html: -------------------------------------------------------------------------------- 1 | Bug280
CopyrightFoo
Bar
Baz
Safe HaskellSafe

Bug280

Description

The module description

Documentation

x :: [Char] #

-------------------------------------------------------------------------------- /html-test/ref/Bugs.html: -------------------------------------------------------------------------------- 1 | Bugs
Safe HaskellSafe

Bugs

Documentation

data A a #

Constructors

A a (a -> Int)
-------------------------------------------------------------------------------- /html-test/ref/DeprecatedModule.html: -------------------------------------------------------------------------------- 1 | DeprecatedModule
Safe HaskellSafe

DeprecatedModule

Description

Deprecated: Use Foo instead

Documentation for DeprecatedModule.

Documentation

foo :: Int #

-------------------------------------------------------------------------------- /html-test/ref/DeprecatedModule2.html: -------------------------------------------------------------------------------- 1 | DeprecatedModule2
Safe HaskellSafe

DeprecatedModule2

Description

Deprecated: Use Foo instead

Documentation

foo :: Int #

-------------------------------------------------------------------------------- /html-test/ref/NamedDoc.html: -------------------------------------------------------------------------------- 1 | NamedDoc
Safe HaskellSafe

NamedDoc

Synopsis

    Documentation

    bar

    -------------------------------------------------------------------------------- /html-test/ref/NonGreedy.html: -------------------------------------------------------------------------------- 1 | NonGreedy
    Safe HaskellSafe

    NonGreedy

    Synopsis
    • f :: a

    Documentation

    f :: a #

    -------------------------------------------------------------------------------- /html-test/ref/PruneWithWarning.html: -------------------------------------------------------------------------------- 1 | PruneWithWarning
    Safe HaskellSafe

    PruneWithWarning

    Description

    What is tested here:

    • If a binding has a deprecation message but no documentation, it is pruned 50 | when OPTIONS_HADDOCK prune is used.
    -------------------------------------------------------------------------------- /html-test/ref/QuasiQuote.html: -------------------------------------------------------------------------------- 1 | QuasiQuote
    Safe HaskellNone

    QuasiQuote

    Documentation

    -------------------------------------------------------------------------------- /html-test/ref/TH.html: -------------------------------------------------------------------------------- 1 | TH
    Safe HaskellNone

    TH

    Documentation

    decl :: Q [Dec] #

    -------------------------------------------------------------------------------- /html-test/ref/TH2.html: -------------------------------------------------------------------------------- 1 | TH2
    Safe HaskellNone

    TH2

    Documentation

    f :: p -> p #

    -------------------------------------------------------------------------------- /html-test/ref/Ticket61.html: -------------------------------------------------------------------------------- 1 | Ticket61
    Safe HaskellSafe

    Ticket61

    Documentation

    class C a where #

    Methods

    f :: a #

    A comment about f

    -------------------------------------------------------------------------------- /html-test/ref/Visible.html: -------------------------------------------------------------------------------- 1 | Visible
    Safe HaskellSafe

    Visible

    Documentation

    -------------------------------------------------------------------------------- /html-test/ref/hslogo-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/fbhaddock/9712d8899d452292913a260058a6dd3346e8d39b/html-test/ref/hslogo-16.png -------------------------------------------------------------------------------- /html-test/ref/mini_A.html: -------------------------------------------------------------------------------- 1 | 2 | A

    A

    62 | -------------------------------------------------------------------------------- /html-test/ref/mini_AdvanceTypes.html: -------------------------------------------------------------------------------- 1 | 2 | AdvanceTypes

    AdvanceTypes

    data Pattern

    36 | -------------------------------------------------------------------------------- /html-test/ref/mini_B.html: -------------------------------------------------------------------------------- 1 | 2 | B

    B

    48 | -------------------------------------------------------------------------------- /html-test/ref/mini_Bug1.html: -------------------------------------------------------------------------------- 1 | 2 | Bug1

    Bug1

    data T

    36 | -------------------------------------------------------------------------------- /html-test/ref/mini_Bug2.html: -------------------------------------------------------------------------------- 1 | 2 | Bug2

    Bug2

    34 | -------------------------------------------------------------------------------- /html-test/ref/mini_Bug3.html: -------------------------------------------------------------------------------- 1 | 2 | Bug3

    Bug3

    34 | -------------------------------------------------------------------------------- /html-test/ref/mini_Bug4.html: -------------------------------------------------------------------------------- 1 | 2 | Bug4

    Bug4

    34 | -------------------------------------------------------------------------------- /html-test/ref/mini_Bug6.html: -------------------------------------------------------------------------------- 1 | 2 | Bug6

    Bug6

    data A

    data B

    data C

    data D

    data E

    68 | -------------------------------------------------------------------------------- /html-test/ref/mini_Bug7.html: -------------------------------------------------------------------------------- 1 | 2 | Bug7

    Bug7

    data Foo

    class Bar x y

    44 | -------------------------------------------------------------------------------- /html-test/ref/mini_Bug8.html: -------------------------------------------------------------------------------- 1 | 2 | Bug8

    Bug8

    66 | -------------------------------------------------------------------------------- /html-test/ref/mini_BugDeprecated.html: -------------------------------------------------------------------------------- 1 | 2 | BugDeprecated

    BugDeprecated

    64 | -------------------------------------------------------------------------------- /html-test/ref/mini_BugExportHeadings.html: -------------------------------------------------------------------------------- 1 | 2 | BugExportHeadings

    BugExportHeadings

    Foo

    Bar

    Baz

    One

    Two

    Three

    76 | -------------------------------------------------------------------------------- /html-test/ref/mini_Bugs.html: -------------------------------------------------------------------------------- 1 | 2 | Bugs

    Bugs

    data A a

    36 | -------------------------------------------------------------------------------- /html-test/ref/mini_CrossPackageDocs.html: -------------------------------------------------------------------------------- 1 | 2 | CrossPackageDocs

    CrossPackageDocs

    46 | -------------------------------------------------------------------------------- /html-test/ref/mini_DeprecatedClass.html: -------------------------------------------------------------------------------- 1 | 2 | DeprecatedClass

    DeprecatedClass

    class SomeClass a

    44 | -------------------------------------------------------------------------------- /html-test/ref/mini_DeprecatedData.html: -------------------------------------------------------------------------------- 1 | 2 | DeprecatedData

    DeprecatedData

    data Foo

    data One

    44 | -------------------------------------------------------------------------------- /html-test/ref/mini_DeprecatedFunction.html: -------------------------------------------------------------------------------- 1 | 2 | DeprecatedFunction

    DeprecatedFunction

    40 | -------------------------------------------------------------------------------- /html-test/ref/mini_DeprecatedFunction2.html: -------------------------------------------------------------------------------- 1 | 2 | DeprecatedFunction2

    DeprecatedFunction2

    34 | -------------------------------------------------------------------------------- /html-test/ref/mini_DeprecatedFunction3.html: -------------------------------------------------------------------------------- 1 | 2 | DeprecatedFunction3

    DeprecatedFunction3

    34 | -------------------------------------------------------------------------------- /html-test/ref/mini_DeprecatedModule.html: -------------------------------------------------------------------------------- 1 | 2 | DeprecatedModule

    DeprecatedModule

    34 | -------------------------------------------------------------------------------- /html-test/ref/mini_DeprecatedModule2.html: -------------------------------------------------------------------------------- 1 | 2 | DeprecatedModule2

    DeprecatedModule2

    34 | -------------------------------------------------------------------------------- /html-test/ref/mini_DeprecatedNewtype.html: -------------------------------------------------------------------------------- 1 | 2 | DeprecatedNewtype

    DeprecatedNewtype

    44 | -------------------------------------------------------------------------------- /html-test/ref/mini_DeprecatedReExport.html: -------------------------------------------------------------------------------- 1 | 2 | DeprecatedReExport

    DeprecatedReExport

    Re-exported from an other module

    Re-exported from an other package

    38 | -------------------------------------------------------------------------------- /html-test/ref/mini_DeprecatedRecord.html: -------------------------------------------------------------------------------- 1 | 2 | DeprecatedRecord

    DeprecatedRecord

    data Foo

    36 | -------------------------------------------------------------------------------- /html-test/ref/mini_DeprecatedTypeFamily.html: -------------------------------------------------------------------------------- 1 | 2 | DeprecatedTypeFamily

    DeprecatedTypeFamily

    data family SomeTypeFamily k :: * -> *

    data family SomeOtherTypeFamily k :: * -> *

    44 | -------------------------------------------------------------------------------- /html-test/ref/mini_DeprecatedTypeSynonym.html: -------------------------------------------------------------------------------- 1 | 2 | DeprecatedTypeSynonym

    DeprecatedTypeSynonym

    44 | -------------------------------------------------------------------------------- /html-test/ref/mini_Examples.html: -------------------------------------------------------------------------------- 1 | 2 | Examples

    Examples

    34 | -------------------------------------------------------------------------------- /html-test/ref/mini_FunArgs.html: -------------------------------------------------------------------------------- 1 | 2 | FunArgs

    FunArgs

    58 | -------------------------------------------------------------------------------- /html-test/ref/mini_GADTRecords.html: -------------------------------------------------------------------------------- 1 | 2 | GADTRecords

    GADTRecords

    data H1 a b

    36 | -------------------------------------------------------------------------------- /html-test/ref/mini_Hash.html: -------------------------------------------------------------------------------- 1 | 2 | Hash

    Hash

    The HashTable type

    data HashTable key val

    Operations on HashTables

    The Hash class

    class Hash a

    74 | -------------------------------------------------------------------------------- /html-test/ref/mini_HiddenInstances.html: -------------------------------------------------------------------------------- 1 | 2 | HiddenInstances

    HiddenInstances

    44 | -------------------------------------------------------------------------------- /html-test/ref/mini_HiddenInstancesB.html: -------------------------------------------------------------------------------- 1 | 2 | HiddenInstancesB

    HiddenInstancesB

    class Foo a

    data Bar

    44 | -------------------------------------------------------------------------------- /html-test/ref/mini_Hyperlinks.html: -------------------------------------------------------------------------------- 1 | 2 | Hyperlinks

    Hyperlinks

    34 | -------------------------------------------------------------------------------- /html-test/ref/mini_IgnoreExports.html: -------------------------------------------------------------------------------- 1 | 2 | IgnoreExports

    IgnoreExports

    40 | -------------------------------------------------------------------------------- /html-test/ref/mini_Math.html: -------------------------------------------------------------------------------- 1 | 2 | Math

    Math

    34 | -------------------------------------------------------------------------------- /html-test/ref/mini_ModuleWithWarning.html: -------------------------------------------------------------------------------- 1 | 2 | ModuleWithWarning

    ModuleWithWarning

    34 | -------------------------------------------------------------------------------- /html-test/ref/mini_NamedDoc.html: -------------------------------------------------------------------------------- 1 | 2 | NamedDoc

    NamedDoc

    28 | -------------------------------------------------------------------------------- /html-test/ref/mini_NoLayout.html: -------------------------------------------------------------------------------- 1 | 2 | NoLayout

    NoLayout

    34 | -------------------------------------------------------------------------------- /html-test/ref/mini_NonGreedy.html: -------------------------------------------------------------------------------- 1 | 2 | NonGreedy

    NonGreedy

    34 | -------------------------------------------------------------------------------- /html-test/ref/mini_Properties.html: -------------------------------------------------------------------------------- 1 | 2 | Properties

    Properties

    34 | -------------------------------------------------------------------------------- /html-test/ref/mini_PruneWithWarning.html: -------------------------------------------------------------------------------- 1 | 2 | PruneWithWarning

    PruneWithWarning

    28 | -------------------------------------------------------------------------------- /html-test/ref/mini_QuasiExpr.html: -------------------------------------------------------------------------------- 1 | 2 | QuasiExpr

    QuasiExpr

    62 | -------------------------------------------------------------------------------- /html-test/ref/mini_QuasiQuote.html: -------------------------------------------------------------------------------- 1 | 2 | QuasiQuote

    QuasiQuote

    34 | -------------------------------------------------------------------------------- /html-test/ref/mini_SpuriousSuperclassConstraints.html: -------------------------------------------------------------------------------- 1 | 2 | SpuriousSuperclassConstraints

    SpuriousSuperclassConstraints

    data SomeType f a

    36 | -------------------------------------------------------------------------------- /html-test/ref/mini_TH.html: -------------------------------------------------------------------------------- 1 | 2 | TH

    TH

    34 | -------------------------------------------------------------------------------- /html-test/ref/mini_TH2.html: -------------------------------------------------------------------------------- 1 | 2 | TH2

    TH2

    34 | -------------------------------------------------------------------------------- /html-test/ref/mini_Ticket112.html: -------------------------------------------------------------------------------- 1 | 2 | Ticket112

    Ticket112

    34 | -------------------------------------------------------------------------------- /html-test/ref/mini_Ticket253_1.html: -------------------------------------------------------------------------------- 1 | 2 | Ticket253_1

    Ticket253_1

    32 | -------------------------------------------------------------------------------- /html-test/ref/mini_Ticket253_2.html: -------------------------------------------------------------------------------- 1 | 2 | Ticket253_2

    Ticket253_2

    data Baz

    40 | -------------------------------------------------------------------------------- /html-test/ref/mini_Ticket61.html: -------------------------------------------------------------------------------- 1 | 2 | Ticket61

    Ticket61

    class C a

    36 | -------------------------------------------------------------------------------- /html-test/ref/mini_Ticket75.html: -------------------------------------------------------------------------------- 1 | 2 | Ticket75

    Ticket75

    data a :- b

    42 | -------------------------------------------------------------------------------- /html-test/ref/mini_TitledPicture.html: -------------------------------------------------------------------------------- 1 | 2 | TitledPicture

    TitledPicture

    40 | -------------------------------------------------------------------------------- /html-test/ref/mini_Unicode.html: -------------------------------------------------------------------------------- 1 | 2 | Unicode

    Unicode

    34 | -------------------------------------------------------------------------------- /html-test/ref/mini_Visible.html: -------------------------------------------------------------------------------- 1 | 2 | Visible

    Visible

    34 | -------------------------------------------------------------------------------- /html-test/ref/minus.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/fbhaddock/9712d8899d452292913a260058a6dd3346e8d39b/html-test/ref/minus.gif -------------------------------------------------------------------------------- /html-test/ref/plus.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/fbhaddock/9712d8899d452292913a260058a6dd3346e8d39b/html-test/ref/plus.gif -------------------------------------------------------------------------------- /html-test/ref/synopsis.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/fbhaddock/9712d8899d452292913a260058a6dd3346e8d39b/html-test/ref/synopsis.png -------------------------------------------------------------------------------- /html-test/run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | export HADDOCK_PATH=$(which haddock) 4 | LIB_PATH="$(dirname "$BASH_SOURCE")/../haddock-test/src/" 5 | MAIN_PATH="$(dirname "$BASH_SOURCE")/Main.hs" 6 | runhaskell -i:"$LIB_PATH" $MAIN_PATH $@ 7 | -------------------------------------------------------------------------------- /html-test/src/A.hs: -------------------------------------------------------------------------------- 1 | module A where 2 | 3 | data A = A 4 | 5 | other :: Int 6 | other = 2 7 | 8 | -- | Doc for test2 9 | test2 :: Bool 10 | test2 = False 11 | 12 | -- | Should show up on the page for both modules A and B 13 | data X = X -- ^ Doc for consructor 14 | 15 | -- | Should show up on the page for both modules A and B 16 | reExport :: Int 17 | reExport = 1 18 | -------------------------------------------------------------------------------- /html-test/src/B.hs: -------------------------------------------------------------------------------- 1 | module B ( module A, test, reExport, X(..) ) where 2 | import A ( A(..), test2, reExport, X(..) ) 3 | 4 | -- | This link shouldn't work: 'other'. 5 | -- These links should work: 'A.other', 'Data.List.sortBy', 'test2', 'A.test2', 'Data.Maybe.fromMaybe'. 6 | -- Module link: "Prelude". 7 | test :: Int 8 | test = 1 9 | -------------------------------------------------------------------------------- /html-test/src/Bold.hs: -------------------------------------------------------------------------------- 1 | module Bold where 2 | -- | Some __bold text__. 3 | -- 4 | -- * __Bold__ in a list 5 | -- 6 | -- [__bold in a definition__] list 7 | -- 8 | -- @ bold __in__ a __code__ block @ 9 | foo = undefined 10 | -------------------------------------------------------------------------------- /html-test/src/Bug1.hs: -------------------------------------------------------------------------------- 1 | module Bug1 where 2 | 3 | -- | We should have different anchors for constructors and types\/classes. This 4 | -- hyperlink should point to the type constructor by default: 'T'. 5 | data T = T 6 | 7 | -------------------------------------------------------------------------------- /html-test/src/Bug195.hs: -------------------------------------------------------------------------------- 1 | module Bug195 where 2 | 3 | data T = A { someField :: () -- ^ Doc for someField of A 4 | , someOtherField :: () -- ^ Doc for someOtherField of A 5 | } 6 | | B { someField :: () -- ^ Doc for someField of B 7 | , someOtherField :: () -- ^ Doc for someOtherField of B 8 | } 9 | | C { someField :: () -- ^ Doc for someField of C 10 | , someOtherField :: () -- ^ Doc for someOtherField of C 11 | } 12 | -------------------------------------------------------------------------------- /html-test/src/Bug2.hs: -------------------------------------------------------------------------------- 1 | module Bug2 ( x ) where 2 | import B 3 | x :: A 4 | x = A 5 | -------------------------------------------------------------------------------- /html-test/src/Bug201.hs: -------------------------------------------------------------------------------- 1 | -- We test that leading whitespace gets properly dropped (or not!) 2 | -- from codeblocks 3 | module Bug201 where 4 | 5 | -- | 6 | -- @ 7 | -- This leading whitespace 8 | -- should be dropped 9 | -- @ 10 | f :: () 11 | f = () 12 | 13 | {-| 14 | @ 15 | But this one 16 | should not 17 | @ 18 | 19 | > this should 20 | > be dropped 21 | 22 | @ 23 | and so should this 24 | because there's a space before closing @ 25 | @ 26 | -} 27 | g :: () 28 | g = () 29 | -------------------------------------------------------------------------------- /html-test/src/Bug253.hs: -------------------------------------------------------------------------------- 1 | -- | This module tests that if we're trying to link to a /qualified/ 2 | -- identifier that's not in scope, we get an anchor as if it was a 3 | -- variable. Previous behaviour was to treat it as a type constructor 4 | -- so issue like #253 arose. Also see @rename@ function comments in 5 | -- source. 6 | module Bug253 where 7 | 8 | -- | This link should generate @#v@ anchor: 'DoesNotExist.fakeFakeFake' 9 | foo :: () 10 | foo = () 11 | -------------------------------------------------------------------------------- /html-test/src/Bug26.hs: -------------------------------------------------------------------------------- 1 | -- | This module tests the ‘@since …’ annotation. 2 | -- 3 | -- @since 1.2.3 4 | module Bug26 where 5 | 6 | -- | Foo 7 | -- 8 | -- @since 2.10.7 9 | -- 10 | -- @since 2.10.8 11 | f :: () 12 | f = () 13 | 14 | -- | Bar 15 | g :: () 16 | g = () 17 | 18 | -- | Class 19 | -- 20 | -- @since 1.0 21 | class C a where 22 | -- | @since 1.2.3 23 | c_f :: a 24 | 25 | -- | instance for () 26 | -- 27 | -- @since 0.7.8 28 | instance C () where 29 | c_f = () 30 | -------------------------------------------------------------------------------- /html-test/src/Bug280.hs: -------------------------------------------------------------------------------- 1 | {-| 2 | Copyright: Foo, 3 | Bar, 4 | Baz 5 | 6 | The module description 7 | -} 8 | -- The module header can start with newlines. They are not taken into account for the indentation level 9 | module Bug280 where 10 | 11 | x = "" 12 | -------------------------------------------------------------------------------- /html-test/src/Bug294.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE TypeFamilies, FlexibleInstances, GADTs #-} 2 | -- This tests that we are able to extract record selectors for 3 | -- associated types when the type itself is not exported. Making this 4 | -- bug exhibit is very simple: simply mention a record field defined 5 | -- inside of the associated type anywhere in the export list. 6 | -- 7 | -- Note: ProblemCtor only shows up when T or A are exported but PolyCtor 8 | -- only shows up when the class is exported as well, since it's polymorphic. 9 | module Bug294 ( A, problemField, problemField', gadtField 10 | , TP(ProblemCtor), DP(ProblemCtor'), TO'(PolyCtor)) where 11 | 12 | data A 13 | 14 | class T t where 15 | data TO t :: * 16 | data TP t :: * 17 | 18 | t :: t 19 | 20 | instance T A where 21 | data TO A = TA { problemField :: A } 22 | data TP A = ProblemCtor A 23 | 24 | data family DO t :: * 25 | data family DP t :: * 26 | 27 | data instance DO A = DA { problemField' :: A } 28 | data instance DP A = ProblemCtor' A 29 | 30 | data GADT :: * -> * where 31 | Ctor :: { gadtField :: A } -> GADT A 32 | 33 | class T' t where 34 | data TO' t :: * 35 | 36 | instance T' a where 37 | data TO' a = PolyCtor 38 | -------------------------------------------------------------------------------- /html-test/src/Bug298.hs: -------------------------------------------------------------------------------- 1 | -- We introduced a regression in 2.14.x where we don't consider 2 | -- identifiers with ^ as valid. We test that the regression goes away 3 | -- here. It's a silly typo in the parser, really. Same with ★ which is a valid 4 | -- symbol according to the 2010 report. 5 | module Bug298 where 6 | 7 | 8 | (<^>) :: (a -> a) -> a -> a 9 | x <^> y = x y 10 | 11 | (<^) :: a -> a -> a 12 | x <^ y = x 13 | 14 | (^>) :: a -> a -> a 15 | x ^> y = y 16 | 17 | (⋆^) :: a -> a -> a 18 | x ⋆^ y = y 19 | 20 | -- | Links to '<^>' and '^>', '<^' and '⋆^'. 21 | f :: () 22 | f = () 23 | -------------------------------------------------------------------------------- /html-test/src/Bug3.hs: -------------------------------------------------------------------------------- 1 | module Bug3 where 2 | 3 | -- | /multi-line 4 | -- emphasis/ 5 | foo :: Int 6 | foo = undefined 7 | -------------------------------------------------------------------------------- /html-test/src/Bug308.hs: -------------------------------------------------------------------------------- 1 | -- From 2.14.x onwards we were forgetting to swallow ‘#’ as a special 2 | -- character resulting in broken anchors if they accured 3 | -- mid-paragraph. Here we check that anchors get generated as 4 | -- expected. 5 | module Bug308 where 6 | 7 | -- | start#startAnchor# followed by middle#middleAnchor# and end#endAnchor# 8 | f :: () 9 | f = () 10 | 11 | {-| 12 | start "Bug308#startAnchor" 13 | 14 | startOldStyle "Bug308\#startAnchor" 15 | 16 | middle "Bug308#middleAnchor" 17 | 18 | end "Bug308#middleAnchor" 19 | -} 20 | g :: () 21 | g = () 22 | -------------------------------------------------------------------------------- /html-test/src/Bug308CrossModule.hs: -------------------------------------------------------------------------------- 1 | -- Just like Bug308 module but here we test that referring to anchors 2 | -- from other modules works. 3 | module Bug308CrossModule where 4 | 5 | import Bug308 6 | 7 | {-| 8 | start "Bug308#startAnchor" 9 | 10 | startOldStyle "Bug308\#startAnchor" 11 | 12 | middle "Bug308#middleAnchor" 13 | 14 | end "Bug308#middleAnchor" 15 | -} 16 | h :: () 17 | h = () 18 | -------------------------------------------------------------------------------- /html-test/src/Bug310.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE ExplicitNamespaces #-} 2 | module Bug310 ( type (+) ) where 3 | 4 | import GHC.TypeLits 5 | -------------------------------------------------------------------------------- /html-test/src/Bug313.hs: -------------------------------------------------------------------------------- 1 | -- | The first list is incorrectly numbered as 1. 2. 1.; the second example 2 | -- renders fine (1. 2. 3.). 3 | -- 4 | -- See https://github.com/haskell/haddock/issues/313 5 | module Bug313 where 6 | 7 | {- | 8 | Some text. 9 | 10 | 1. Item 1 11 | 12 | 2. Item 2 13 | 14 | > Some code 15 | 16 | 3. Item 3 17 | 18 | Some more text. 19 | -} 20 | a :: a 21 | a = undefined 22 | 23 | {- | 24 | Some text. 25 | 26 | 1. Item 1 27 | 28 | 2. Item 2 29 | 30 | > Some code 31 | 32 | 3. Item 3 33 | 34 | -} 35 | -- | Some more text. 36 | b :: a 37 | b = undefined 38 | -------------------------------------------------------------------------------- /html-test/src/Bug335.hs: -------------------------------------------------------------------------------- 1 | -- Tests for collapsable headers 2 | module Bug335 where 3 | 4 | {-| 5 | === __ExF:__ 6 | abc 7 | -} 8 | f :: () 9 | f = () 10 | 11 | {-| 12 | === __ExG:__ 13 | >>> a 14 | b 15 | 16 | >>> c 17 | d 18 | 19 | ==== Under ex 20 | foo 21 | 22 | == Out of Ex 23 | foo 24 | -} 25 | g :: () 26 | g = () 27 | -------------------------------------------------------------------------------- /html-test/src/Bug387.hs: -------------------------------------------------------------------------------- 1 | module Bug387 2 | ( -- * Section1#a:section1# 3 | test1 4 | -- * Section2#a:section2# 5 | , test2 6 | ) where 7 | 8 | test1 :: Int 9 | test1 = 223 10 | 11 | test2 :: Int 12 | test2 = 42 13 | -------------------------------------------------------------------------------- /html-test/src/Bug4.hs: -------------------------------------------------------------------------------- 1 | module Bug4 where 2 | -- | don't use apostrophe's in the wrong place's 3 | foo :: Int 4 | foo = undefined 5 | 6 | -------------------------------------------------------------------------------- /html-test/src/Bug458.hs: -------------------------------------------------------------------------------- 1 | module Bug458 where 2 | 3 | -- | See the defn of @'⊆'@. 4 | (⊆) :: () -> () -> () 5 | _ ⊆ _ = () 6 | 7 | -------------------------------------------------------------------------------- /html-test/src/Bug548.hs: -------------------------------------------------------------------------------- 1 | module Bug548 (WrappedArrow(..)) where 2 | 3 | import Control.Applicative 4 | -------------------------------------------------------------------------------- /html-test/src/Bug6.hs: -------------------------------------------------------------------------------- 1 | -- | Exporting records. 2 | module Bug6( A(A), B(B), b, C(C,c1,c2), D(D,d1), E(E) ) where 3 | 4 | -- | 5 | -- This record is exported without its field 6 | data A = A { a :: Int } 7 | 8 | -- | 9 | -- .. with its field, but the field is named separately in the export list 10 | -- (the field isn't documented separately since it is already documented here) 11 | data B = B { b :: Int } 12 | 13 | -- | 14 | -- .. with fields names as subordinate names in the export 15 | data C = C { c1 :: Int, c2 :: Int } 16 | 17 | -- | 18 | -- .. with only some of the fields exported (we can't handle this one - 19 | -- how do we render the declaration?) 20 | data D = D { d1 :: Int, d2 :: Int } 21 | 22 | -- | a newtype with a field 23 | newtype E = E { e :: Int } 24 | -------------------------------------------------------------------------------- /html-test/src/Bug613.hs: -------------------------------------------------------------------------------- 1 | module Bug613 where 2 | 3 | import Prelude (Either(Left, Right)) 4 | 5 | class Functor f where 6 | fmap :: (a -> b) -> f a -> f b 7 | 8 | instance Functor (Either a) where 9 | fmap _ (Left x) = Left x 10 | fmap f (Right y) = Right (f y) 11 | 12 | -- | 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 13 | data ThreeVars a0 a b = ThreeVars a b 14 | 15 | instance Functor (ThreeVars a0 a) where 16 | fmap f (ThreeVars a b) = ThreeVars a (f b) 17 | -------------------------------------------------------------------------------- /html-test/src/Bug647.hs: -------------------------------------------------------------------------------- 1 | module Bug647 where 2 | 3 | class Bug647 a where 4 | f :: a -- ^ doc for arg1 5 | -> a -- ^ doc for arg2 6 | -> a -- ^ doc for arg3 -------------------------------------------------------------------------------- /html-test/src/Bug679.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE TemplateHaskell #-} 2 | 3 | module Bug679 where 4 | 5 | import Language.Haskell.TH 6 | 7 | data Bar a = Bar 8 | 9 | $(do 10 | a <- newName "a" 11 | 12 | let classN = mkName "Foo" 13 | let methodN = mkName "foo" 14 | 15 | methodTy <- [t| $(varT a) -> $(varT a) |] 16 | let cla = ClassD [] classN [PlainTV a] [] [SigD methodN methodTy] 17 | 18 | -- Note that we are /reusing/ the same type variable 'a' as in the class 19 | instanceHead <- [t| $(conT classN) (Bar $(varT a)) |] 20 | idCall <- [e| id |] 21 | let ins = InstanceD Nothing [] instanceHead [FunD methodN [Clause [] (NormalB idCall) []]] 22 | 23 | pure [cla,ins]) 24 | 25 | -------------------------------------------------------------------------------- /html-test/src/Bug7.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE MultiParamTypeClasses #-} 2 | -- | This module caused a duplicate instance in the documentation for the Foo 3 | -- type. 4 | module Bug7 where 5 | 6 | -- | The Foo datatype 7 | data Foo = Foo 8 | 9 | -- | The Bar class 10 | class Bar x y 11 | 12 | -- | Just one instance 13 | instance Bar Foo Foo 14 | -------------------------------------------------------------------------------- /html-test/src/Bug8.hs: -------------------------------------------------------------------------------- 1 | module Bug8 where 2 | 3 | infix --> 4 | infix ---> 5 | 6 | data Typ = Type (Typ,[Typ]) 7 | | TFree (Typ, [Typ]) 8 | 9 | x --> y = Type(s,[s,t]) 10 | (--->) :: (Foldable t0) => t0 t -> Typ -> Typ 11 | (--->) = flip $ foldr (-->) 12 | 13 | s = undefined 14 | t = undefined 15 | main = undefined 16 | -------------------------------------------------------------------------------- /html-test/src/Bug85.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE GADTs, KindSignatures #-} 2 | module Bug85 where 3 | 4 | -- explicitly stated non-trivial kind 5 | data Foo :: (* -> *) -> * -> * where 6 | Bar :: f x -> Foo f (f x) 7 | 8 | -- Just kind * but explicitly written 9 | data Baz :: * where 10 | Baz' :: Baz 11 | 12 | -- No kind signature written down at all 13 | data Qux where 14 | Quux :: Qux 15 | -------------------------------------------------------------------------------- /html-test/src/BugDeprecated.hs: -------------------------------------------------------------------------------- 1 | module BugDeprecated where 2 | 3 | foo :: Int 4 | foo = 23 5 | 6 | bar :: Int 7 | bar = 23 8 | 9 | baz :: Int 10 | baz = 23 11 | {-# DEPRECATED foo "for foo" #-} 12 | {-# DEPRECATED bar "for bar" #-} 13 | {-# DEPRECATED baz "for baz" #-} 14 | 15 | -- | some documentation for one 16 | one :: Int 17 | one = 23 18 | 19 | two :: Int 20 | two = 23 21 | 22 | three :: Int 23 | three = 23 24 | {-# DEPRECATED one "for one" #-} 25 | {-# DEPRECATED two "for two" #-} 26 | {-# DEPRECATED three "for three" #-} 27 | -------------------------------------------------------------------------------- /html-test/src/BugExportHeadings.hs: -------------------------------------------------------------------------------- 1 | -- test for #192 2 | module BugExportHeadings ( 3 | -- * Foo 4 | foo 5 | -- * Bar 6 | , bar 7 | -- * Baz 8 | , baz 9 | 10 | -- * One 11 | , one 12 | -- * Two 13 | , two 14 | -- * Three 15 | , three 16 | ) where 17 | 18 | foo, bar, baz :: Int 19 | foo = 23 20 | bar = 23 21 | baz = 23 22 | 23 | one, two, three :: Int 24 | one = 23 25 | two = 23 26 | three = 23 27 | {-# DEPRECATED one "for one" #-} 28 | {-# DEPRECATED two "for two" #-} 29 | {-# DEPRECATED three "for three" #-} 30 | -------------------------------------------------------------------------------- /html-test/src/Bugs.hs: -------------------------------------------------------------------------------- 1 | module Bugs where 2 | 3 | data A a = A a (a -> Int) 4 | -------------------------------------------------------------------------------- /html-test/src/BundledPatterns2.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE DataKinds, GADTs, KindSignatures, PatternSynonyms, TypeOperators, 2 | ViewPatterns #-} 3 | module BundledPatterns2 (Vec((:>), Empty), RTree(..)) where 4 | 5 | import GHC.TypeLits 6 | 7 | import BundledPatterns 8 | 9 | pattern Empty :: Vec 0 a 10 | pattern Empty <- Nil 11 | -------------------------------------------------------------------------------- /html-test/src/ConstructorPatternExport.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE PatternSynonyms #-} 2 | {-# LANGUAGE ExistentialQuantification #-} 3 | {-# LANGUAGE GADTs #-} 4 | {-# LANGUAGE KindSignatures #-} 5 | 6 | module ConstructorPatternExport ( 7 | pattern FooCons 8 | , pattern MyRecCons 9 | , pattern (:+) 10 | , pattern BlubCons 11 | , pattern MyGADTCons 12 | ) where 13 | 14 | data Foo a = FooCons String a 15 | 16 | data MyRec = MyRecCons { one :: Bool, two :: Int } 17 | 18 | data MyInfix a = String :+ a 19 | 20 | data Blub = forall b. Show b => BlubCons b 21 | 22 | data MyGADT :: * -> * where 23 | MyGADTCons :: forall a. Eq a => a -> Int -> MyGADT (Maybe String) 24 | 25 | pattern MyGADTCons' :: () => forall a. Eq a => a -> Int -> MyGADT (Maybe String) 26 | pattern MyGADTCons' x y = MyGADTCons x y -------------------------------------------------------------------------------- /html-test/src/CrossPackageDocs.hs_hidden: -------------------------------------------------------------------------------- 1 | module CrossPackageDocs (map, IsString(..), runInteractiveProcess) where 2 | 3 | import System.Process 4 | import Data.String 5 | -------------------------------------------------------------------------------- /html-test/src/DeprecatedClass.hs: -------------------------------------------------------------------------------- 1 | module DeprecatedClass where 2 | 3 | -- | some class 4 | class SomeClass a where 5 | -- | documentation for foo 6 | foo :: a -> a 7 | 8 | {-# DEPRECATED SomeClass "SomeClass" #-} 9 | {-# DEPRECATED foo "foo" #-} 10 | 11 | class SomeOtherClass a where 12 | bar :: a -> a 13 | 14 | {-# DEPRECATED SomeOtherClass "SomeOtherClass" #-} 15 | {-# DEPRECATED bar "bar" #-} 16 | -------------------------------------------------------------------------------- /html-test/src/DeprecatedData.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE TypeFamilies #-} 2 | module DeprecatedData where 3 | 4 | -- | type Foo 5 | data Foo = Foo -- ^ constructor Foo 6 | | Bar -- ^ constructor Bar 7 | 8 | {-# DEPRECATED Foo "Foo" #-} 9 | {-# DEPRECATED Bar "Bar" #-} 10 | 11 | data One = One 12 | | Two 13 | 14 | {-# DEPRECATED One "One" #-} 15 | {-# DEPRECATED Two "Two" #-} 16 | -------------------------------------------------------------------------------- /html-test/src/DeprecatedFunction.hs: -------------------------------------------------------------------------------- 1 | module DeprecatedFunction where 2 | 3 | -- | some documentation for foo 4 | foo :: Int 5 | foo = 23 6 | {-# DEPRECATED foo "use `bar` instead" #-} 7 | 8 | -- | some documentation for bar 9 | bar :: Int 10 | bar = 42 11 | -------------------------------------------------------------------------------- /html-test/src/DeprecatedFunction2.hs: -------------------------------------------------------------------------------- 1 | module DeprecatedFunction2 where 2 | 3 | 4 | foo :: Int 5 | foo = 23 6 | {-# DEPRECATED foo "use bar instead" #-} 7 | -------------------------------------------------------------------------------- /html-test/src/DeprecatedFunction3.hs: -------------------------------------------------------------------------------- 1 | module DeprecatedFunction3 where 2 | 3 | 4 | 5 | foo = 23 6 | {-# DEPRECATED foo "use bar instead" #-} 7 | -------------------------------------------------------------------------------- /html-test/src/DeprecatedModule.hs: -------------------------------------------------------------------------------- 1 | -- | Documentation for "DeprecatedModule". 2 | module DeprecatedModule {-# DEPRECATED "Use \"Foo\" instead" #-} where 3 | 4 | foo :: Int 5 | foo = 23 6 | -------------------------------------------------------------------------------- /html-test/src/DeprecatedModule2.hs: -------------------------------------------------------------------------------- 1 | module DeprecatedModule2 {-# DEPRECATED "Use Foo instead" #-} where 2 | 3 | foo :: Int 4 | foo = 23 5 | -------------------------------------------------------------------------------- /html-test/src/DeprecatedNewtype.hs: -------------------------------------------------------------------------------- 1 | module DeprecatedNewtype where 2 | 3 | -- | some documentation 4 | newtype SomeNewType = SomeNewTypeConst String {- ^ constructor docu -} 5 | {-# DEPRECATED SomeNewType "SomeNewType" #-} 6 | {-# DEPRECATED SomeNewTypeConst "SomeNewTypeConst" #-} 7 | 8 | newtype SomeOtherNewType = SomeOtherNewTypeConst String 9 | {-# DEPRECATED SomeOtherNewType "SomeOtherNewType" #-} 10 | {-# DEPRECATED SomeOtherNewTypeConst "SomeOtherNewTypeConst" #-} 11 | -------------------------------------------------------------------------------- /html-test/src/DeprecatedReExport.hs: -------------------------------------------------------------------------------- 1 | -- | 2 | -- What is tested here: 3 | -- 4 | -- * Deprecation messages are shown for re-exported items. 5 | -- 6 | module DeprecatedReExport ( 7 | -- * Re-exported from an other module 8 | foo 9 | -- * Re-exported from an other package 10 | -- | Not yet working, see 11 | -- , isEmptyChan 12 | , 13 | ) where 14 | 15 | import DeprecatedFunction 16 | import Control.Concurrent.Chan 17 | -------------------------------------------------------------------------------- /html-test/src/DeprecatedRecord.hs: -------------------------------------------------------------------------------- 1 | module DeprecatedRecord where 2 | 3 | -- | type Foo 4 | data Foo = Foo { 5 | fooName :: String -- ^ some name 6 | , fooValue :: Int -- ^ some value 7 | } 8 | 9 | {-# DEPRECATED fooValue "do not use this" #-} 10 | -------------------------------------------------------------------------------- /html-test/src/DeprecatedTypeFamily.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE TypeFamilies #-} 2 | module DeprecatedTypeFamily where 3 | 4 | -- | some documentation 5 | data family SomeTypeFamily k :: * -> * 6 | {-# DEPRECATED SomeTypeFamily "SomeTypeFamily" #-} 7 | 8 | data family SomeOtherTypeFamily k :: * -> * 9 | {-# DEPRECATED SomeOtherTypeFamily "SomeOtherTypeFamily" #-} 10 | -------------------------------------------------------------------------------- /html-test/src/DeprecatedTypeSynonym.hs: -------------------------------------------------------------------------------- 1 | 2 | module DeprecatedTypeSynonym where 3 | 4 | -- | some documentation 5 | type TypeSyn = String 6 | {-# DEPRECATED TypeSyn "TypeSyn" #-} 7 | 8 | type OtherTypeSyn = String 9 | {-# DEPRECATED OtherTypeSyn "OtherTypeSyn" #-} 10 | -------------------------------------------------------------------------------- /html-test/src/DuplicateRecordFields.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE DuplicateRecordFields #-} 2 | module DuplicateRecordFields (RawReplay(..)) where 3 | 4 | import Prelude hiding (Int) 5 | 6 | data Int = Int 7 | 8 | data RawReplay = RawReplay 9 | { headerSize :: Int 10 | -- ^ The byte size of the first section. 11 | , headerCRC :: Int 12 | -- ^ The CRC of the first section. 13 | , header :: Int 14 | -- ^ The first section. 15 | , contentSize :: Int 16 | -- ^ The byte size of the second section. 17 | , contentCRC :: Int 18 | -- ^ The CRC of the second section. 19 | , content :: Int 20 | -- ^ The second section. 21 | , footer :: Int 22 | -- ^ Arbitrary data after the second section. In replays generated by 23 | -- Rocket League, this is always empty. However it is not technically 24 | -- invalid to put something here. 25 | } -------------------------------------------------------------------------------- /html-test/src/Examples.hs: -------------------------------------------------------------------------------- 1 | module Examples where 2 | 3 | -- | Fibonacci number of given 'Integer'. 4 | -- 5 | -- Examples: 6 | -- 7 | -- >>> fib 5 8 | -- 5 9 | -- >>> fib 10 10 | -- 55 11 | -- 12 | -- >>> fib 10 13 | -- 55 14 | -- 15 | -- One more Example: 16 | -- 17 | -- >>> fib 5 18 | -- 5 19 | -- 20 | -- One more Example: 21 | -- 22 | -- >>> fib 5 23 | -- 5 24 | -- 25 | -- Example with an import: 26 | -- 27 | -- >>> import Data.Char 28 | -- >>> isSpace 'a' 29 | -- False 30 | -- 31 | -- >>> putStrLn "foo\n\nbar" 32 | -- foo 33 | -- 34 | -- bar 35 | -- 36 | fib :: Integer -> Integer 37 | fib 0 = 0 38 | fib 1 = 1 39 | fib n = fib (n - 1) + fib (n - 2) 40 | -------------------------------------------------------------------------------- /html-test/src/Extensions.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE Haskell2010, ExplicitForAll, MonomorphismRestriction #-} 2 | {-# OPTIONS_HADDOCK show-extensions #-} 3 | module Extensions where 4 | 5 | -- | Bar 6 | foobar :: t 7 | foobar = undefined 8 | -------------------------------------------------------------------------------- /html-test/src/FunArgs.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE RankNTypes, DataKinds, TypeFamilies #-} 2 | module FunArgs where 3 | 4 | f :: forall a. Ord a 5 | => Int -- ^ First argument 6 | -> a -- ^ Second argument 7 | -> Bool -- ^ Third argument 8 | -> (a -> a) -- ^ Fourth argument 9 | -> () -- ^ Result 10 | f = undefined 11 | 12 | 13 | g :: a -- ^ First argument 14 | -> b -- ^ Second argument 15 | -> c -- ^ Third argument 16 | -> d -- ^ Result 17 | g = undefined 18 | 19 | 20 | h :: forall a b c 21 | . a -- ^ First argument 22 | -> b -- ^ Second argument 23 | -> c -- ^ Third argument 24 | -> forall d. d -- ^ Result 25 | h = undefined 26 | 27 | 28 | i :: forall a (b :: ()) d. (d ~ '()) 29 | => forall c 30 | . a b c d -- ^ abcd 31 | -> () -- ^ Result 32 | i = undefined 33 | 34 | 35 | j :: forall proxy (a :: ()) b 36 | . proxy a -- ^ First argument 37 | -> b -- ^ Result 38 | j = undefined 39 | -------------------------------------------------------------------------------- /html-test/src/GADTRecords.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE GADTs #-} 2 | module GADTRecords (H1(..)) where 3 | 4 | -- | h1 5 | data H1 a b where 6 | C1 :: H1 a b 7 | C2 :: Ord a => [a] -> H1 a a 8 | C3 :: { field :: Int -- ^ hello docs 9 | } -> H1 Int Int 10 | C4 :: { field2 :: a -- ^ hello2 docs 11 | } -> H1 Int a 12 | -------------------------------------------------------------------------------- /html-test/src/Hash.hs: -------------------------------------------------------------------------------- 1 | {- | 2 | Implementation of fixed-size hash tables, with a type 3 | class for constructing hash values for structured types. 4 | -} 5 | module Hash ( 6 | -- * The @HashTable@ type 7 | HashTable, 8 | 9 | -- ** Operations on @HashTable@s 10 | new, insert, lookup, 11 | 12 | -- * The @Hash@ class 13 | Hash(..), 14 | ) where 15 | 16 | import Data.Array 17 | import Prelude hiding (lookup) 18 | 19 | -- | A hash table with keys of type @key@ and values of type @val@. 20 | -- The type @key@ should be an instance of 'Eq'. 21 | data HashTable key val = HashTable Int (Array Int [(key,val)]) 22 | 23 | -- | Builds a new hash table with a given size 24 | new :: (Eq key, Hash key) => Int -> IO (HashTable key val) 25 | new = undefined 26 | 27 | -- | Inserts a new element into the hash table 28 | insert :: (Eq key, Hash key) => key -> val -> IO () 29 | insert = undefined 30 | 31 | -- | Looks up a key in the hash table, returns @'Just' val@ if the key 32 | -- was found, or 'Nothing' otherwise. 33 | lookup :: Hash key => key -> IO (Maybe val) 34 | lookup = undefined 35 | 36 | -- | A class of types which can be hashed. 37 | class Hash a where 38 | -- | hashes the value of type @a@ into an 'Int' 39 | hash :: a -> Int 40 | 41 | instance Hash Int where 42 | hash = id 43 | 44 | instance Hash Float where 45 | hash = trunc 46 | 47 | instance (Hash a, Hash b) => Hash (a,b) where 48 | hash (a,b) = hash a `xor` hash b 49 | 50 | trunc = undefined 51 | xor = undefined 52 | -------------------------------------------------------------------------------- /html-test/src/Hidden.hs: -------------------------------------------------------------------------------- 1 | {-# OPTIONS_HADDOCK hide #-} 2 | 3 | module Hidden where 4 | 5 | hidden :: Int -> Int 6 | hidden a = a 7 | -------------------------------------------------------------------------------- /html-test/src/HiddenInstances.hs: -------------------------------------------------------------------------------- 1 | -- http://trac.haskell.org/haddock/ticket/37 2 | module HiddenInstances (VisibleClass, VisibleData) where 3 | 4 | -- | Should be visible 5 | class VisibleClass a 6 | 7 | -- | Should *not* be visible 8 | class HiddenClass a 9 | 10 | -- | Should *not* be visible 11 | data HiddenData = HiddenData 12 | 13 | -- | Should be visible 14 | data VisibleData = VisibleData 15 | 16 | -- | Should be visible 17 | instance VisibleClass Int 18 | 19 | -- | Should be visible 20 | instance VisibleClass VisibleData 21 | 22 | -- | Should be visible 23 | instance Num VisibleData 24 | 25 | -- | Should *not* be visible 26 | instance VisibleClass HiddenData 27 | 28 | -- | Should *not* be visible 29 | instance HiddenClass Int 30 | 31 | -- | Should *not* be visible 32 | instance HiddenClass VisibleData 33 | 34 | -- | Should *not* be visible 35 | instance HiddenClass HiddenData 36 | -------------------------------------------------------------------------------- /html-test/src/HiddenInstancesA.hs: -------------------------------------------------------------------------------- 1 | {-# OPTIONS_HADDOCK hide #-} 2 | module HiddenInstancesA where 3 | 4 | -- | Should be visible 5 | class Foo a 6 | 7 | -- | Should be visible 8 | data Bar 9 | 10 | -- | Should be visible 11 | instance Foo Bar 12 | 13 | -- | Should *not* be visible 14 | data Baz 15 | 16 | -- | Should *not* be visible 17 | instance Foo Baz 18 | -------------------------------------------------------------------------------- /html-test/src/HiddenInstancesB.hs: -------------------------------------------------------------------------------- 1 | module HiddenInstancesB (Foo, Bar) where 2 | import HiddenInstancesA 3 | -------------------------------------------------------------------------------- /html-test/src/Hyperlinks.hs: -------------------------------------------------------------------------------- 1 | module Hyperlinks where 2 | 3 | -- | 4 | -- A plain URL: 5 | -- 6 | -- A URL with a label: 7 | foo :: Int 8 | foo = 23 9 | -------------------------------------------------------------------------------- /html-test/src/IgnoreExports.hs: -------------------------------------------------------------------------------- 1 | {-# OPTIONS_HADDOCK ignore-exports #-} 2 | module IgnoreExports (foo) where 3 | 4 | -- | documentation for foo 5 | foo :: Int 6 | foo = 23 7 | 8 | -- | documentation for bar 9 | bar :: Int 10 | bar = 23 11 | -------------------------------------------------------------------------------- /html-test/src/ImplicitParams.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE ImplicitParams, RankNTypes #-} 2 | module ImplicitParams where 3 | 4 | data X = X 5 | 6 | c :: (?x :: X) => X 7 | c = ?x 8 | 9 | d :: (?x :: X, ?y :: X) => (X, X) 10 | d = (?x, ?y) 11 | 12 | f :: ((?x :: X) => a) -> a 13 | f a = let ?x = X in a 14 | -------------------------------------------------------------------------------- /html-test/src/Math.hs: -------------------------------------------------------------------------------- 1 | -- | Math (display) for 'normalDensity' 2 | -- 3 | -- \[ 4 | -- \int_{-\infty}^{\infty} e^{-x^2/2} = \sqrt{2\pi} 5 | -- \] 6 | -- 7 | -- \(\int_{-\infty}^{\infty} e^{-x^2/2} = \sqrt{2\pi}\) 8 | 9 | module Math where 10 | 11 | -- | Math (inline) for 'normalDensity' 12 | -- \(\int_{-\infty}^{\infty} e^{-x^2/2} = \sqrt{2\pi}\) 13 | -- \[\int_{-\infty}^{\infty} e^{-x^2/2} = \sqrt{2\pi}\] 14 | f = 5 15 | -------------------------------------------------------------------------------- /html-test/src/Minimal.hs: -------------------------------------------------------------------------------- 1 | -- | This tests the new MINIMAL pragma present in GHC 7.8 2 | module Minimal 3 | ( Foo(..) 4 | , Weird(..) 5 | , NoMins(..) 6 | , FullMin(..) 7 | , PartialMin(ccc) 8 | , EmptyMin(..) 9 | ) where 10 | 11 | class Foo a where 12 | -- | Any two of these are required... 13 | foo :: a 14 | bar :: a 15 | bat :: a 16 | 17 | -- | .. or just this 18 | fooBarBat :: (a,a,a) 19 | 20 | {-# MINIMAL (foo, bar) | (bar, bat) | (foo, bat) | fooBarBat #-} 21 | 22 | class Weird a where 23 | a :: a 24 | b :: a 25 | c :: a 26 | d :: a 27 | e :: a 28 | f :: a 29 | g :: a 30 | 31 | {-# MINIMAL ((a, b), c | (d | (e, (f | g)))) #-} 32 | 33 | class NoMins a where 34 | x :: a 35 | y :: a 36 | z :: a 37 | 38 | -- | Has a default implementation! 39 | z = x 40 | 41 | class FullMin a where 42 | aaa :: a 43 | bbb :: a 44 | 45 | class PartialMin a where 46 | ccc :: a 47 | ddd :: a 48 | 49 | class EmptyMin a where 50 | eee :: a 51 | fff :: a 52 | eee = fff 53 | fff = undefined 54 | -------------------------------------------------------------------------------- /html-test/src/ModuleWithWarning.hs: -------------------------------------------------------------------------------- 1 | -- | Documentation for "ModuleWithWarning". 2 | module ModuleWithWarning {-# WARNING "This is an unstable interface. Prefer functions from \"Prelude\" instead!" #-} where 3 | 4 | foo :: Int 5 | foo = 23 6 | -------------------------------------------------------------------------------- /html-test/src/NamedDoc.hs: -------------------------------------------------------------------------------- 1 | module NamedDoc where 2 | 3 | -- $foo bar 4 | 5 | -------------------------------------------------------------------------------- /html-test/src/NoLayout.hs: -------------------------------------------------------------------------------- 1 | 2 | -- Haddock comments are parsed as separate declarations so we 3 | -- need to insert a ';' when using them with explicit layout. 4 | -- This should probably be changed. 5 | 6 | module NoLayout where { 7 | -- | the function 'g' 8 | ; 9 | g :: Int; 10 | g = undefined 11 | } 12 | 13 | -------------------------------------------------------------------------------- /html-test/src/NonGreedy.hs: -------------------------------------------------------------------------------- 1 | module NonGreedy where 2 | 3 | -- | 4 | f :: a 5 | f = undefined 6 | -------------------------------------------------------------------------------- /html-test/src/Operators.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE PatternSynonyms, TypeOperators, TypeFamilies, MultiParamTypeClasses, GADTs #-} 2 | {-# LANGUAGE FunctionalDependencies #-} 3 | 4 | -- | Test operators with or without fixity declarations 5 | module Operators where 6 | 7 | -- | Operator with no fixity 8 | (+-) :: a -> a -> a 9 | a +- _ = a 10 | 11 | -- | Operator with infixr 7 12 | (*/) :: a -> a -> a 13 | _ */ b = b 14 | infixr 7 */ 15 | 16 | -- | Named function with infixl 3 17 | foo :: a -> a -> a 18 | foo a _ = a 19 | infixl 3 `foo` 20 | 21 | -- | Data type with operator constructors 22 | data Foo 23 | = Foo `Bar` Foo -- ^ Has infixl 3 24 | | Foo :- Foo -- ^ Has infixr 5 25 | infixr 5 :- 26 | infixl 3 `Bar` 27 | 28 | -- | Pattern synonym, infixr 3 29 | pattern (:+) a b <- [a,b] 30 | infixr 3 :+ 31 | 32 | -- | Type name, infixl 6 and GADT constructor 33 | data (a <-> b) where 34 | (:<->) :: a -> b -> a <-> b 35 | infixl 6 <-> 36 | infixr 6 :<-> 37 | 38 | -- | Type family with fixity 39 | type family a ++ b 40 | infix 3 ++ 41 | 42 | -- | Data family with fixity 43 | data family a ** b 44 | infix 9 ** 45 | 46 | -- | Class with fixity, including associated types 47 | class a ><> b | a -> b where 48 | -- Dec 2015: Added @a -> b@ functional dependency to clean up ambiguity 49 | -- See GHC #11264 50 | type a <>< b :: * 51 | data a ><< b 52 | (>><), (<<>) :: a -> b -> () 53 | 54 | -- | Multiple fixities 55 | (**>), (**<), (>**), (<**) :: a -> a -> () 56 | 57 | infixr 1 ><> 58 | infixl 2 <>< 59 | infixl 3 ><< 60 | infixr 4 >>< 61 | infixl 5 <<> 62 | 63 | infixr 8 **>, >** 64 | infixl 8 **<, <** 65 | 66 | -- | Type synonym with fixity 67 | type (a >-< b) = a <-> b 68 | infixl 6 >-< 69 | -------------------------------------------------------------------------------- /html-test/src/OrphanInstances.hs: -------------------------------------------------------------------------------- 1 | module OrphanInstances where 2 | 3 | import OrphanInstancesType 4 | import OrphanInstancesClass 5 | 6 | -- | This is an orphan instance. 7 | instance AClass AType where 8 | aClass (AType n) = n 9 | -------------------------------------------------------------------------------- /html-test/src/OrphanInstancesClass.hs: -------------------------------------------------------------------------------- 1 | module OrphanInstancesClass (AClass(..)) where 2 | 3 | class AClass a where 4 | aClass :: a -> Int 5 | -------------------------------------------------------------------------------- /html-test/src/OrphanInstancesType.hs: -------------------------------------------------------------------------------- 1 | module OrphanInstancesType (AType(..)) where 2 | 3 | data AType = AType Int 4 | -------------------------------------------------------------------------------- /html-test/src/PR643.hs: -------------------------------------------------------------------------------- 1 | module PR643 (test) where 2 | 3 | import PR643_1 4 | -------------------------------------------------------------------------------- /html-test/src/PR643_1.hs: -------------------------------------------------------------------------------- 1 | module PR643_1 where 2 | 3 | infixr 5 `test` 4 | 5 | -- | Some big documentation 6 | test :: () 7 | test = () 8 | -------------------------------------------------------------------------------- /html-test/src/PatternSyns.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE ExistentialQuantification, PatternSynonyms, PolyKinds, TypeOperators #-} 2 | 3 | -- | Testing some pattern synonyms 4 | module PatternSyns where 5 | 6 | -- | FooType doc 7 | data FooType x = FooCtor x 8 | 9 | -- | Pattern synonym for 'Foo' x 10 | pattern Foo x = FooCtor x 11 | 12 | -- | Pattern synonym for 'Bar' x 13 | pattern Bar x = FooCtor (Foo x) 14 | 15 | -- | Pattern synonym for (':<->') 16 | pattern x :<-> y = (Foo x, Bar y) 17 | 18 | -- | BlubType is existentially quantified 19 | data BlubType = forall x. Show x => BlubCtor x 20 | 21 | -- | Pattern synonym for 'Blub' x 22 | pattern Blub x = BlubCtor x 23 | 24 | -- | Doc for ('><') 25 | data (a :: *) >< b = Empty 26 | 27 | -- | Pattern for 'Empty' 28 | pattern E = Empty 29 | 30 | -- | Earlier ghc versions didn't allow explicit signatures 31 | -- on pattern synonyms. 32 | pattern PatWithExplicitSig :: Eq somex => somex -> FooType somex 33 | pattern PatWithExplicitSig x = FooCtor x 34 | -------------------------------------------------------------------------------- /html-test/src/PromotedTypes.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE DataKinds #-} 2 | {-# LANGUAGE GADTs #-} 3 | {-# LANGUAGE KindSignatures #-} 4 | {-# LANGUAGE TypeOperators #-} 5 | 6 | 7 | module PromotedTypes where 8 | 9 | 10 | data RevList a = RNil | RevList a :> a 11 | 12 | 13 | data Pattern :: [*] -> * where 14 | Nil :: Pattern '[] 15 | Cons :: Maybe h -> Pattern t -> Pattern (h ': t) 16 | 17 | 18 | -- Unlike (:), (:>) does not have to be quoted on type level. 19 | data RevPattern :: RevList * -> * where 20 | RevNil :: RevPattern RNil 21 | RevCons :: Maybe h -> RevPattern t -> RevPattern (t :> h) 22 | 23 | 24 | data Tuple :: (*, *) -> * where 25 | Tuple :: a -> b -> Tuple '(a, b) 26 | -------------------------------------------------------------------------------- /html-test/src/Properties.hs: -------------------------------------------------------------------------------- 1 | module Properties where 2 | 3 | -- | Fibonacci number of given 'Integer'. 4 | -- 5 | -- prop> fib n <= fib (n + 1) 6 | fib :: Integer -> Integer 7 | fib 0 = 0 8 | fib 1 = 1 9 | fib n = fib (n - 1) + fib (n - 2) 10 | -------------------------------------------------------------------------------- /html-test/src/PruneWithWarning.hs: -------------------------------------------------------------------------------- 1 | {-# OPTIONS_HADDOCK prune #-} 2 | -- | 3 | -- What is tested here: 4 | -- 5 | -- * If a binding has a deprecation message but no documentation, it is pruned 6 | -- when @OPTIONS_HADDOCK prune@ is used. 7 | -- 8 | module PruneWithWarning (foo, bar) where 9 | 10 | foo :: Int 11 | foo = 23 12 | {-# DEPRECATED foo "use bar instead" #-} 13 | 14 | bar :: Int 15 | bar = 42 16 | -------------------------------------------------------------------------------- /html-test/src/QuasiExpr.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE TemplateHaskell #-} 2 | 3 | -- Used by QuasiQuote. Example taken from the GHC documentation. 4 | module QuasiExpr where 5 | 6 | import Language.Haskell.TH 7 | import Language.Haskell.TH.Quote 8 | 9 | data Expr = IntExpr Integer 10 | | AntiIntExpr String 11 | | BinopExpr BinOp Expr Expr 12 | | AntiExpr String 13 | deriving Show 14 | 15 | data BinOp = AddOp 16 | | SubOp 17 | | MulOp 18 | | DivOp 19 | deriving Show 20 | 21 | eval :: Expr -> Integer 22 | eval (IntExpr n) = n 23 | eval (BinopExpr op x y) = (opToFun op) (eval x) (eval y) 24 | where 25 | opToFun AddOp = (+) 26 | opToFun SubOp = (-) 27 | opToFun MulOp = (*) 28 | opToFun DivOp = div 29 | 30 | expr = QuasiQuoter parseExprExp undefined undefined undefined 31 | 32 | -- cheating... 33 | parseExprExp :: String -> Q Exp 34 | parseExprExp _ = [| BinopExpr AddOp (IntExpr 1) (IntExpr 2) |] 35 | -------------------------------------------------------------------------------- /html-test/src/QuasiQuote.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE TemplateHaskell, QuasiQuotes #-} 2 | 3 | -- example taken from the GHC documentation 4 | module QuasiQuote where 5 | 6 | import QuasiExpr 7 | 8 | val :: Integer 9 | val = eval [expr|1 + 2|] 10 | -------------------------------------------------------------------------------- /html-test/src/SpuriousSuperclassConstraints.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE EmptyDataDecls, KindSignatures #-} 2 | -- | 3 | -- What is tested here: 4 | -- 5 | -- Due to a change in GHC 7.6.1 we had a bug that superclass contraints were 6 | -- included in the instances list. Edward K. repported it here: 7 | -- 8 | -- 9 | -- 10 | -- And here is the corresponding thread on glasgow-haskell-users: 11 | -- 12 | -- 13 | -- 14 | -- It has been fixed in: 15 | -- 16 | -- > 6ccf78e15a525282fef61bc4f58a279aa9c21771 17 | -- > Fix spurious superclass constraints bug. 18 | -- 19 | module SpuriousSuperclassConstraints where 20 | 21 | import Control.Applicative 22 | 23 | data SomeType (f :: * -> *) a 24 | 25 | instance Functor (SomeType f) where 26 | fmap = undefined 27 | 28 | instance Applicative f => Applicative (SomeType f) where 29 | pure = undefined 30 | (<*>) = undefined 31 | -------------------------------------------------------------------------------- /html-test/src/TH.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE TemplateHaskell #-} 2 | 3 | module TH where 4 | 5 | import Language.Haskell.TH 6 | 7 | decl :: Q [Dec] 8 | decl = [d| f x = x|] 9 | -------------------------------------------------------------------------------- /html-test/src/TH2.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE TemplateHaskell #-} 2 | 3 | module TH2 where 4 | 5 | import TH 6 | 7 | $( decl ) 8 | -------------------------------------------------------------------------------- /html-test/src/Threaded.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE TemplateHaskell #-} 2 | 3 | -- | Ensures haddock built with @-threaded@. 4 | module Threaded where 5 | 6 | import Threaded_TH 7 | 8 | -- | @$(forkTH)@ fails at compile time if haddock isn't using the 9 | -- threaded RTS. 10 | f = $(forkTH) 11 | -------------------------------------------------------------------------------- /html-test/src/Threaded_TH.hs: -------------------------------------------------------------------------------- 1 | -- | Imported by 'Threaded', since a TH splice can't be used in the 2 | -- module where it is defined. 3 | module Threaded_TH where 4 | 5 | import Control.Concurrent (forkOS) 6 | import Language.Haskell.TH.Syntax (Exp (LitE), Lit (IntegerL), Q, runIO) 7 | 8 | -- | forkOS requires the threaded RTS, so this TH fails if haddock was 9 | -- built without @-threaded@. 10 | forkTH :: Q Exp 11 | forkTH = do 12 | _ <- runIO (forkOS (return ())) 13 | return (LitE (IntegerL 0)) 14 | -------------------------------------------------------------------------------- /html-test/src/Ticket112.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE MagicHash #-} 2 | 3 | module Ticket112 where 4 | 5 | import GHC.Prim 6 | 7 | -- | ...given a raw 'Addr#' to the string, and the length of the string. 8 | f :: a 9 | f = undefined 10 | -------------------------------------------------------------------------------- /html-test/src/Ticket61.hs: -------------------------------------------------------------------------------- 1 | module Ticket61 (module Ticket61_Hidden) where 2 | 3 | import Ticket61_Hidden 4 | -------------------------------------------------------------------------------- /html-test/src/Ticket61_Hidden.hs: -------------------------------------------------------------------------------- 1 | {-# OPTIONS_HADDOCK hide #-} 2 | 3 | module Ticket61_Hidden where 4 | 5 | class C a where 6 | -- | A comment about f 7 | f :: a 8 | -------------------------------------------------------------------------------- /html-test/src/Ticket75.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE TypeOperators #-} 2 | module Ticket75 where 3 | 4 | data a :- b = Q 5 | 6 | -- | A reference to ':-' 7 | f :: Int 8 | f = undefined 9 | -------------------------------------------------------------------------------- /html-test/src/TitledPicture.hs: -------------------------------------------------------------------------------- 1 | module TitledPicture where 2 | 3 | -- | Picture for 'foo' without a title <> 4 | foo = 5 5 | 6 | -- | Picture for 'bar' with title <> 7 | bar = 6 8 | -------------------------------------------------------------------------------- /html-test/src/TypeFamilies2.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE TypeFamilies #-} 2 | -- This tests what happens if we have unexported types 3 | -- in type instances. The expected behaviour is 4 | -- that we get the instance, Y is not linked and 5 | -- Haddock shows a linking warning. 6 | -- 7 | -- The other families and instances that are not exported should not 8 | -- show up at all 9 | module TypeFamilies2 (W, Foo, Bar) where 10 | 11 | -- | Exported type 12 | data W 13 | 14 | -- | Hidden type 15 | data Z 16 | 17 | -- | Exported type family 18 | type family Foo a 19 | 20 | -- | Should be visible, but with a hidden right hand side 21 | type instance Foo W = Z 22 | 23 | -- | Should be hidden 24 | type instance Foo Z = W 25 | 26 | -- | Exported data family 27 | data family Bar a 28 | 29 | -- | Shown because BarX is still exported despite Z being hidden 30 | data instance Bar W = BarX Z 31 | 32 | -- | Should be completely invisible, including instances 33 | type family Invisible a 34 | type instance Invisible W = Z 35 | type instance Invisible Z = W 36 | 37 | data family Invisible2 a 38 | data instance Invisible2 W = Invis Z 39 | data instance Invisible2 Z = Invis' W 40 | -------------------------------------------------------------------------------- /html-test/src/TypeOperators.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE TypeOperators, GADTs, MultiParamTypeClasses, FlexibleContexts #-} 2 | module TypeOperators where 3 | 4 | data a :-: b 5 | 6 | data (a :+: b) c 7 | 8 | data a `Op` b 9 | 10 | newtype (g `O` f) a = O { unO :: g (f a) } 11 | 12 | class a <=> b 13 | 14 | biO :: (g `O` f) a 15 | biO = undefined 16 | 17 | f :: (a ~ b) => a -> b 18 | f = id 19 | 20 | g :: (a ~ b, b ~ c) => a -> c 21 | g = id 22 | 23 | x :: ((a :-: a) <=> (a `Op` a)) => a 24 | x = undefined 25 | 26 | y :: (a <=> a, (a `Op` a) <=> a) => a 27 | y = undefined 28 | -------------------------------------------------------------------------------- /html-test/src/Unicode.hs: -------------------------------------------------------------------------------- 1 | module Unicode where 2 | 3 | -- | γλώσσα 4 | x :: Int 5 | x = 1 6 | 7 | -------------------------------------------------------------------------------- /html-test/src/Unicode2.hs: -------------------------------------------------------------------------------- 1 | module Unicode2 where 2 | 3 | -- | All of the following work with a unicode character ü: 4 | -- 5 | -- * an italicized /ü/ 6 | -- 7 | -- * inline code @ü@ 8 | -- 9 | -- * a code block: 10 | -- 11 | -- > ü 12 | -- 13 | -- * a url 14 | -- 15 | -- * a link to 'ü' 16 | -- 17 | ü :: () 18 | ü = () 19 | -------------------------------------------------------------------------------- /html-test/src/Visible.hs: -------------------------------------------------------------------------------- 1 | module Visible where 2 | visible :: Int -> Int 3 | visible a = a 4 | -------------------------------------------------------------------------------- /hypsrc-test/Main.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CPP #-} 2 | 3 | 4 | import Data.Char 5 | import Data.List 6 | import Data.Function (on) 7 | 8 | import System.Environment 9 | import System.FilePath 10 | 11 | import Test.Haddock 12 | import Test.Haddock.Xhtml 13 | 14 | 15 | checkConfig :: CheckConfig Xml 16 | checkConfig = CheckConfig 17 | { ccfgRead = parseXml 18 | , ccfgClean = \_ -> strip 19 | , ccfgDump = dumpXml 20 | , ccfgEqual = (==) `on` dumpXml 21 | } 22 | where 23 | strip = stripAnchors' . stripLinks' . stripFooter 24 | stripLinks' = stripLinksWhen $ \href -> "#local-" `isPrefixOf` href 25 | stripAnchors' = stripAnchorsWhen $ \name -> "local-" `isPrefixOf` name 26 | 27 | 28 | dirConfig :: DirConfig 29 | dirConfig = (defaultDirConfig $ takeDirectory __FILE__) 30 | { dcfgCheckIgnore = checkIgnore 31 | } 32 | 33 | 34 | main :: IO () 35 | main = do 36 | cfg <- parseArgs checkConfig dirConfig =<< getArgs 37 | runAndCheck $ cfg 38 | { cfgHaddockArgs = cfgHaddockArgs cfg ++ 39 | [ "--pretty-html" 40 | , "--hyperlinked-source" 41 | ] 42 | } 43 | 44 | 45 | checkIgnore :: FilePath -> Bool 46 | checkIgnore file 47 | | and . map ($ file) $ [isHtmlFile, isSourceFile, isModuleFile] = False 48 | where 49 | isHtmlFile = (== ".html") . takeExtension 50 | isSourceFile = (== "src") . takeDirectory 51 | isModuleFile = isUpper . head . takeBaseName 52 | checkIgnore _ = True 53 | -------------------------------------------------------------------------------- /hypsrc-test/run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | export HADDOCK_PATH=$(which haddock) 4 | LIB_PATH="$(dirname "$BASH_SOURCE")/../haddock-test/src/" 5 | MAIN_PATH="$(dirname "$BASH_SOURCE")/Main.hs" 6 | runhaskell -i:"$LIB_PATH" $MAIN_PATH $@ 7 | -------------------------------------------------------------------------------- /hypsrc-test/src/CPP.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CPP #-} 2 | module CPP where 3 | 4 | #define SOMETHING1 5 | 6 | foo :: String 7 | foo = {- " single quotes are fine in block comments 8 | {- nested block comments are fine -} 9 | -} "foo" 10 | 11 | #define SOMETHING2 12 | 13 | bar :: String 14 | bar = "block comment in a string is not a comment {- " 15 | 16 | #define SOMETHING3 17 | 18 | -- " single quotes are fine in line comments 19 | -- {- unclosed block comments are fine in line comments 20 | 21 | -- Multiline CPP is also fine 22 | #define FOO\ 23 | 1 24 | 25 | baz :: String 26 | baz = "line comment in a string is not a comment --" 27 | -------------------------------------------------------------------------------- /hypsrc-test/src/Classes.hs: -------------------------------------------------------------------------------- 1 | module Classes where 2 | 3 | 4 | class Foo a where 5 | bar :: a -> Int 6 | baz :: Int -> (a, a) 7 | 8 | instance Foo Int where 9 | bar = id 10 | baz x = (x, x) 11 | 12 | instance Foo [a] where 13 | bar = length 14 | baz _ = ([], []) 15 | 16 | 17 | class Foo a => Foo' a where 18 | quux :: (a, a) -> a 19 | quux (x, y) = norf [x, y] 20 | 21 | norf :: [a] -> a 22 | norf = quux . baz . sum . map bar 23 | 24 | instance Foo' Int where 25 | norf = sum 26 | 27 | instance Foo' [a] where 28 | quux = uncurry (++) 29 | 30 | 31 | class Plugh p where 32 | plugh :: p a a -> p b b -> p (a -> b) (b -> a) 33 | 34 | instance Plugh Either where 35 | plugh (Left a) _ = Right $ const a 36 | plugh (Right a) _ = Right $ const a 37 | plugh _ (Left b) = Left $ const b 38 | plugh _ (Right b) = Left $ const b 39 | -------------------------------------------------------------------------------- /hypsrc-test/src/Constructors.hs: -------------------------------------------------------------------------------- 1 | module Constructors where 2 | 3 | 4 | data Foo 5 | = Bar 6 | | Baz 7 | | Quux Foo Int 8 | 9 | newtype Norf = Norf (Foo, [Foo], Foo) 10 | 11 | 12 | bar, baz, quux :: Foo 13 | bar = Bar 14 | baz = Baz 15 | quux = Quux quux 0 16 | 17 | 18 | unfoo :: Foo -> Int 19 | unfoo Bar = 0 20 | unfoo Baz = 0 21 | unfoo (Quux foo n) = 42 * n + unfoo foo 22 | 23 | 24 | unnorf :: Norf -> [Foo] 25 | unnorf (Norf (Bar, xs, Bar)) = xs 26 | unnorf (Norf (Baz, xs, Baz)) = reverse xs 27 | unnorf _ = undefined 28 | 29 | 30 | unnorf' :: Norf -> Int 31 | unnorf' x@(Norf (f1@(Quux _ n), _, f2@(Quux f3 _))) = 32 | x' + n * unfoo f1 + aux f3 33 | where 34 | aux fx = unfoo f2 * unfoo fx * unfoo f3 35 | x' = sum . map unfoo . unnorf $ x 36 | -------------------------------------------------------------------------------- /hypsrc-test/src/Identifiers.hs: -------------------------------------------------------------------------------- 1 | module Identifiers where 2 | 3 | 4 | foo, bar, baz :: Int -> Int -> Int 5 | foo x y = x + x * bar y x * y + y 6 | bar x y = y + x - baz x y - x + y 7 | baz x y = x * y * y * y * x 8 | 9 | quux :: Int -> Int 10 | quux x = foo (bar x x) (bar x x) 11 | 12 | norf :: Int -> Int -> Int -> Int 13 | norf x y z 14 | | x < 0 = quux x 15 | | y < 0 = quux y 16 | | z < 0 = quux z 17 | | otherwise = norf (-x) (-y) (-z) 18 | 19 | 20 | main :: IO () 21 | main = do 22 | putStrLn . show $ foo x y 23 | putStrLn . show $ quux z 24 | putStrLn . show $ Identifiers.norf x y z 25 | where 26 | x = 10 27 | y = 20 28 | z = 30 29 | -------------------------------------------------------------------------------- /hypsrc-test/src/Literals.hs: -------------------------------------------------------------------------------- 1 | module Literals where 2 | 3 | 4 | str :: String 5 | str = "str literal" 6 | 7 | num :: Num a => a 8 | num = 0 + 1 + 1010011 * 41231 + 12131 9 | 10 | frac :: Fractional a => a 11 | frac = 42.0000001 12 | 13 | list :: [[[[a]]]] 14 | list = [[], [[]], [[[]]]] 15 | 16 | pair :: ((), ((), (), ()), ()) 17 | pair = ((), ((), (), ()), ()) 18 | -------------------------------------------------------------------------------- /hypsrc-test/src/Operators.hs: -------------------------------------------------------------------------------- 1 | module Operators where 2 | 3 | 4 | (+++) :: [a] -> [a] -> [a] 5 | a +++ b = a ++ b ++ a 6 | 7 | ($$$) :: [a] -> [a] -> [a] 8 | a $$$ b = b +++ a 9 | 10 | (***) :: [a] -> [a] -> [a] 11 | (***) a [] = a 12 | (***) a (_:b) = a +++ (a *** b) 13 | 14 | (*/\*) :: [[a]] -> [a] -> [a] 15 | a */\* b = concatMap (*** b) a 16 | 17 | (**/\**) :: [[a]] -> [[a]] -> [[a]] 18 | a **/\** b = zipWith (*/\*) [a +++ b] (a $$$ b) 19 | 20 | 21 | (#.#) :: a -> b -> (c -> (a, b)) 22 | a #.# b = const $ (a, b) 23 | -------------------------------------------------------------------------------- /hypsrc-test/src/Polymorphism.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE RankNTypes #-} 2 | {-# LANGUAGE ScopedTypeVariables #-} 3 | 4 | 5 | module Polymorphism where 6 | 7 | 8 | foo :: a -> a -> a 9 | foo = undefined 10 | 11 | foo' :: forall a. a -> a -> a 12 | foo' = undefined 13 | 14 | bar :: a -> b -> (a, b) 15 | bar = undefined 16 | 17 | bar' :: forall a b. a -> b -> (a, b) 18 | bar' = undefined 19 | 20 | baz :: a -> (a -> [a -> a] -> b) -> b 21 | baz = undefined 22 | 23 | baz' :: forall a b. a -> (a -> [a -> a] -> b) -> b 24 | baz' = undefined 25 | 26 | quux :: a -> (forall a. a -> a) -> a 27 | quux x f = f x 28 | 29 | quux' :: forall a. a -> (forall a. a -> a) -> a 30 | quux' x f = f x 31 | 32 | 33 | num :: Num a => a -> a -> a 34 | num = undefined 35 | 36 | num' :: forall a. Num a => a -> a -> a 37 | num' = undefined 38 | 39 | eq :: (Eq a, Eq b) => [a] -> [b] -> (a, b) 40 | eq = undefined 41 | 42 | eq' :: forall a b. (Eq a, Eq b) => [a] -> [b] -> (a, b) 43 | eq' = undefined 44 | 45 | mon :: Monad m => (a -> m a) -> m a 46 | mon = undefined 47 | 48 | mon' :: forall m a. Monad m => (a -> m a) -> m a 49 | mon' = undefined 50 | 51 | 52 | norf :: a -> (forall a. Ord a => a -> a) -> a 53 | norf x f = x 54 | 55 | norf' :: forall a. a -> (forall a. Ord a => a -> a) -> a 56 | norf' x f = x 57 | 58 | 59 | plugh :: forall a. a -> a 60 | plugh x = x :: a 61 | 62 | thud :: forall a b. (a -> b) -> a -> (a, b) 63 | thud f x = 64 | (x :: a, y) :: (a, b) 65 | where 66 | y = (f :: a -> b) x :: b 67 | -------------------------------------------------------------------------------- /hypsrc-test/src/Records.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE NamedFieldPuns #-} 2 | {-# LANGUAGE RecordWildCards #-} 3 | 4 | 5 | module Records where 6 | 7 | 8 | data Point = Point 9 | { x :: !Int 10 | , y :: !Int 11 | } 12 | 13 | 14 | point :: Int -> Int -> Point 15 | point x y = Point { x = x, y = y } 16 | 17 | 18 | lengthSqr :: Point -> Int 19 | lengthSqr (Point { x = x, y = y }) = x * x + y * y 20 | 21 | lengthSqr' :: Point -> Int 22 | lengthSqr' (Point { x, y }) = y * y + x * x 23 | 24 | 25 | translateX, translateY :: Point -> Int -> Point 26 | translateX p d = p { x = x p + d } 27 | translateY p d = p { y = y p + d } 28 | 29 | translate :: Int -> Int -> Point -> Point 30 | translate x y p = 31 | aux p 32 | where 33 | (dx, dy) = (x, y) 34 | aux Point{..} = p { x = x + dx, y = y + dy } 35 | -------------------------------------------------------------------------------- /hypsrc-test/src/Types.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE TypeFamilies #-} 2 | 3 | 4 | module Types where 5 | 6 | 7 | data Quux = Bar | Baz 8 | 9 | newtype Foo = Foo () 10 | 11 | type FooQuux = (Foo, Quux) 12 | type QuuxFoo = (Quux, Foo) 13 | 14 | 15 | data family Norf a b 16 | 17 | data instance Norf Foo Quux = NFQ Foo Quux 18 | data instance Norf Quux Foo = NQF Quux Foo 19 | 20 | 21 | type family Norf' a b 22 | 23 | type instance Norf' Foo Quux = (Foo, Quux) 24 | type instance Norf' Quux Foo = (Quux, Foo) 25 | 26 | 27 | norf1 :: Norf Foo Quux -> Int 28 | norf1 (NFQ (Foo ()) Bar) = 0 29 | norf1 (NFQ (Foo ()) Baz) = 1 30 | 31 | norf2 :: Norf Quux Foo -> Int 32 | norf2 (NQF Bar (Foo ())) = 0 33 | norf2 (NQF Baz (Foo ())) = 1 34 | 35 | 36 | norf1' :: Norf' Foo Quux -> Int 37 | norf1' (Foo (), Bar) = 0 38 | norf1' (Foo (), Baz) = 1 39 | 40 | norf2' :: Norf' Quux Foo -> Int 41 | norf2' (Bar, Foo ()) = 0 42 | norf2' (Baz, Foo ()) = 1 43 | -------------------------------------------------------------------------------- /latex-test/Main.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CPP #-} 2 | 3 | 4 | import Data.Function 5 | import System.Environment 6 | import System.FilePath 7 | 8 | import Test.Haddock 9 | import Test.Haddock.Utils 10 | 11 | 12 | checkConfig :: CheckConfig String 13 | checkConfig = CheckConfig 14 | { ccfgRead = Just 15 | , ccfgClean = \_ -> id 16 | , ccfgDump = id 17 | , ccfgEqual = (==) `on` crlfToLf 18 | } 19 | 20 | 21 | dirConfig :: DirConfig 22 | dirConfig = defaultDirConfig $ takeDirectory __FILE__ 23 | 24 | 25 | main :: IO () 26 | main = do 27 | cfg <- parseArgs checkConfig dirConfig =<< getArgs 28 | runAndCheck $ cfg 29 | { cfgHaddockArgs = cfgHaddockArgs cfg ++ ["--latex"] 30 | } 31 | -------------------------------------------------------------------------------- /latex-test/ref/Simple/Simple.tex: -------------------------------------------------------------------------------- 1 | \haddockmoduleheading{Simple} 2 | \label{module:Simple} 3 | \haddockbeginheader 4 | {\haddockverb\begin{verbatim} 5 | module Simple ( 6 | foo 7 | ) where\end{verbatim}} 8 | \haddockendheader 9 | 10 | \begin{haddockdesc} 11 | \item[\begin{tabular}{@{}l} 12 | foo\ ::\ t 13 | \end{tabular}]\haddockbegindoc 14 | This is foo.\par 15 | 16 | \end{haddockdesc} -------------------------------------------------------------------------------- /latex-test/ref/Simple/main.tex: -------------------------------------------------------------------------------- 1 | \documentclass{book} 2 | \usepackage{haddock} 3 | \begin{document} 4 | \begin{titlepage} 5 | \begin{haddocktitle} 6 | 7 | \end{haddocktitle} 8 | \end{titlepage} 9 | \tableofcontents 10 | \input{Simple} 11 | \end{document} -------------------------------------------------------------------------------- /latex-test/run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | export HADDOCK_PATH=$(which haddock) 4 | LIB_PATH="$(dirname "$BASH_SOURCE")/../haddock-test/src/" 5 | MAIN_PATH="$(dirname "$BASH_SOURCE")/Main.hs" 6 | runhaskell -i:"$LIB_PATH" $MAIN_PATH $@ 7 | -------------------------------------------------------------------------------- /latex-test/src/Simple/Simple.hs: -------------------------------------------------------------------------------- 1 | module Simple (foo) where 2 | 3 | -- | This is foo. 4 | foo :: t 5 | foo = undefined 6 | -------------------------------------------------------------------------------- /scripts/build-windows-dist.sh: -------------------------------------------------------------------------------- 1 | # mini script for building the relocatable Windows binary distribution. 2 | # 3 | # sh build-windows-dist.sh 4 | # 5 | # NB. the Cabal that shipped with GHC 6.6 isn't enough for this, because it 6 | # is missing this patch: 7 | # 8 | # Fri Oct 13 11:09:41 BST 2006 Simon Marlow 9 | # * Fix getDataDir etc. when bindir=$prefix 10 | # 11 | # So you need to use a more recent Cabal. GHC 6.6 is fine for building the 12 | # package, though. 13 | 14 | ghc --make Setup 15 | ./Setup configure --prefix=`pwd`/install --bindir='$prefix' --libdir='$prefix' --datadir='$prefix' 16 | ./Setup build 17 | ./Setup install 18 | echo Now zip up `pwd`/install as "haddock--Win32.zip" 19 | -------------------------------------------------------------------------------- /scripts/make-sdist.sh: -------------------------------------------------------------------------------- 1 | # Put the Happy-generated .hs files in the right place in the source dist. 2 | set -e 3 | rm -f dist/haddock-*.tar.gz 4 | rm -rf dist/haddock-*/ 5 | ./Setup sdist 6 | cd dist 7 | tar xvzf haddock-*.tar.gz 8 | cd haddock-*/ 9 | mkdir dist 10 | mkdir dist/build 11 | mv haddock dist/build 12 | cd .. 13 | tar cvzf haddock-*.tar.gz haddock-*/ 14 | 15 | # Steps for doing a release: 16 | # * Update version number in .cabal, doc/haddock.xml 17 | # * Update CHANGES 18 | # * Source: 19 | # - do the above 20 | # - upload the dist to haskell.org:haddock/dist/${version} 21 | # - scp CHANGES haskell.org:haddock/CHANGES.txt 22 | # * Binaries: 23 | # - build the Windows binary zip (see build-windows-dist.sh) 24 | # - scp haddock--Win32.zip haskell.org:haddock/dist 25 | # * Documentation: 26 | # - cd doc 27 | # - make html 28 | # - mv haddock haddock-html 29 | # - tar cvzf haddock-doc-html-${version}.tar.gz haddock-html 30 | # - scp haddock-doc-html-${version}.tar.gz www.haskell.org:../haskell/haddock/doc 31 | # - ssh haskell.org 32 | # - cd haddock/doc 33 | # - tar xvzf haddock-doc-html-${version}.tar.gz 34 | # - rm -rf html-OLD 35 | # - mv html html-OLD && mv haddock-html html 36 | # * Update the web page (~/darcs/www/haddock/index.html), and push it 37 | --------------------------------------------------------------------------------