3
votes

So, I am using haddock (through cabal) to generate documentation for my local Haskell package. It has no trouble hyperlinking its own local html documents to each other. However, whenever my package references a symbol from another package, it does not create the link.

Most of my outside dependencies have haddock documentation on Hackage. Is there a way to set up haddock such that it can find the documentation of Hackage and hyperlink to it?

1
If you install the package locally with documentation (see --enable-documentation. for cabal), your local docs will link to the other external packages' local docs. Regarding Hackage: when you upload your package to Hackage, docs linking to other packages on Hackage wwill automatically be created. There is no way to link your local package Hackage docs though.Alec
@Alec I had issues building the docs for the dependencies. Could I download the ones from hackage instead of trying to build them myself?PyRulez
Unfortunately, I don't think you can. That seems like a potentially neat feature though, so I've opened a feature request: github.com/haskell/haddock/issues/1086.Alec
@Alec okay. Also, thank you! I was considering doing that myself, but just wanted to make sure it wasn't already in it.PyRulez
@Alec This cabal command seems to say it can work with haddock, but I can't get it to work: cabal.readthedocs.io/en/latest/…PyRulez

1 Answers

3
votes

I usually do,

cabal v2-haddock --haddock-html-location='https://hackage.haskell.org/package/$pkg-$version/docs' --haddock-hyperlink-source --haddock-quickjump

The only problem for me with this approach is that, it may link with latest packages that are not yet available on Hackage. For example, when I run this on ghc-8.8 it links to base-4.13 which hasn't been released on Hackage yet.