https://github.com/coot/haddock-example
Example project with multiple package
https://github.com/coot/haddock-example
Last synced: 11 months ago
JSON representation
Example project with multiple package
- Host: GitHub
- URL: https://github.com/coot/haddock-example
- Owner: coot
- Created: 2021-02-13T17:28:21.000Z (over 5 years ago)
- Default Branch: development
- Last Pushed: 2022-05-21T13:13:20.000Z (about 4 years ago)
- Last Synced: 2025-01-30T12:13:14.666Z (over 1 year ago)
- Language: Haskell
- Size: 4.92 MB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Haddock example
===============
Example how to build haddocks for multiple cabal packages, or check the [haddock manual][haddock-manual]
Requirements
------------
* `${GHC_9}` is a path to `ghc-9.0.1``
* `${HADDOCK}` is a path to `haddock` build from [this](https://github.com/coot/haddock/tree/coot/multiple-packages) branch (PR [#1277](https://github.com/haskell/haddock/pull/1277)).
* You might need to add `--haddock-options: --lib PATH`, where `PATH` is a path
to haddocks resource directory ([haddock-api/resources](https://github.com/haskell/haddock/tree/ghc-9.0/haddock-api/resources)), also don't forget to add it to the `haddock` command below.
Build instructions
------------------
To build the docs directory:
```
rm rf docs/*
cabal haddock --with-compiler GHC_9 \
--with-haddock=${HADDOCK} \
--haddock-html \
--haddock-quickjump \
--haddock-option='--use-index=../doc-index.html' \
--haddock-option='--use-contents=../index.html' \
--haddock-option='--base-url=..' \
all
cp -r dist-newstyle/build/x86_64-linux/ghc-9.0.1/package-a-0.1.0.0/doc/html/package-a/ docs
cp -r dist-newstyle/build/x86_64-linux/ghc-9.0.1/package-b-0.1.0.0/doc/html/package-b/ docs
${HADDOCK} -o docs --quickjump --gen-index --gen-contents \
--read-interface=package-a,docs/package-a/package-a.haddock \
--read-interface=package-b,docs/package-b/package-b.haddock
```
To include `base` documentation, copy `base` docs from `~/.ghcup/ghc/9.0.1/share/doc/ghc-9.0.1/html/librarires/base-4.15.0.0` to `docs/base` and also include `--read-interface` option:
```
${HADDOCK} -o docs --quickjump --gen-index --gen-contents --read-interface=package-a,docs/package-a/package-a.haddock --read-interface=package-b,docs/package-b/package-b.haddock --read-interface=base,${HOME}/.ghcup/ghc/9.0.1/share/doc/ghc-9.0.1/html/libraries/base-4.15.0.0/base.haddock
```
And serve `docs` with some http server, e.g. `http-server docs`.
## Notes
`--read-interface=PATH,...`: the `PATH` must be relative url of a package it points to (relative to `docs` directory).
[haddock-manual]: https://haskell-haddock.readthedocs.io/en/latest/multi-components.html