-
Notifications
You must be signed in to change notification settings - Fork 723
Description
As reported by @mpilgrem in matrix.
Hi! Cabal gurus. A question: from GHC 9.8.1, GHC puts the Haddock documentation for its boot packages in folders named after the id or key field in the *.conf file - eg base-4.19.2.0-943b - not after the package name-version. Does Cabal (the tool) deal with that? If so, how? Stack assumes all packages have documentation in $pkg-$version folders, and consequently links between GHC boot packages in Haddock documentation no longer work. I can't see a way through.
In Stack's case, it uses Setup.hs haddock with --html-location=../$pkg-$version/ (link) relying on:
--html-location=url Specify a template for the location of HTML documentation for prerequisite packages. The substitutions (see listing) are applied to the template to obtain a location for each package, which will be used by hyperlinks in the generated documentation. For example, the following command generates links pointing at Hackage pages: runhaskell Setup.hs haddock --html-location='http://hackage.haskell.org/packages/archive/$pkg/latest/doc/html' Here the argument is quoted to prevent substitution by the shell. If this option is omitted, the location for each package is obtained using the package tool (e.g. ghc-pkg).
So, when it builds (say) Haddock documentation files for aeson, the links to the Haddock documentation files for base assume they will be in (eg) ../base-4.19.2.0/ and the links to the documentation files for (say) scientific assume they will be in (eg) ../scientific-0.3.8.0/.
I can't see that there is a way to tell Cabal's haddock command that the Haddock documentation files for GHC boot libraries are in folders which are the id or key value but the documentation files for other libraries are in folders which are named after the package name-version. Further there is no Cabal substitution for use with the --html-location template that is any more specific than a package name-version.
(edited)Cabal (the library), of course, only builds Haddock documentation files for a package. However, I believe that Cabal (the tool) can build Haddock documentation files for an entire project, so I am assuming that Cabal (the tool) could have encountered the same problem with the post-GHC 9.6.7 change to how the GHC project now provides Haddock files for its boot packages.
However, maybe Cabal (the tool) does not do what Stack does for projects. For projects, Stack moves all of the Haddock documentation files for project packages and all of their dependencies (including GHC boot packages) under a single parent folder, so that all that documentation files can be used together as a single 'unit'. (edited)
I think that, post-GHC 9.6.7, the GHC project provides the Hackage project with special versions of the Haddock documentation files for GHC boot packages that do not use name-version-hash links between them. See:
https://downloads.haskell.org/ghc/9.8.4/docs/users_guide/9.8.3-notes.html#haddock https://gitlab.haskell.org/ghc/ghc/-/issues/24086
but that is not what GHC ships with.
https://hackage.haskell.org/package/base-4.19.0.0/docs/GHC-Exts.html#v:listThreads-35- has a "Source" link to https://hackage.haskell.org/package/ghc-prim-0.11.0-997e/docs/src/GHC.Prim.html#listThreads%23 which doesn't exist, because it contains part of the ABI hash....