Skip to content

Cabal (the library) haddock command does not support sublibraries #9586

Open
@mpilgrem

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:

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: commercialhaskell/stack#5254.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions