Cabal (the library) `haddock` command does not support sublibraries
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
I think that this specific issue has not been reported previously: Cabal (the tool) can build Haddock documentation for a package with a sublibrary, but Cabal (the library) cannot.
I have a simple 'toy' package `my-project` with a library and a sublibrary `internal`. Its `Setup.hs` is the usual:
~~~haskell
import Distribution.Simple
main = defaultMain
~~~
`internal` can be `private` or `public`, and the following behaviour is the same:
Command `cabal haddock` (`cabal-install version 3.10.2.1`) in the package's root directory generates Haddock documentation for both libraries, each with their own `index.html`, in directories: `my-package\dist-newstyle\build\x86_64-windows\ghc-9.6.3\my-package-0.1.0.0\doc\html\my-package` (the main library) and `my-package\dist-newstyle\build\x86_64-windows\ghc-9.6.3\my-package-0.1.0.0\l\internal\doc\html\my-package` (the sublibrary).
However commands `runghc Setup.hs configure`, `runghc Setup.hs haddock` (`Cabal library version 3.10.1.0`) in the package's root directory generates Haddock documentation for both libraries in turn in directory `dist\doc\html\my-package\`, and the `index.html` for one library overwrites the same file for the other library.
My motivation is that Stack relies on the version of Cabal (the library) that is provided with the specified version of GHC: https://github.com/commercialhaskell/stack/issues/5254.
Contributor guide
Assessment
This issue has not been assessed yet.