Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document haddock-options #7419

Open
goldfirere opened this issue May 31, 2021 · 3 comments
Open

Document haddock-options #7419

goldfirere opened this issue May 31, 2021 · 3 comments

Comments

@goldfirere
Copy link

Describe the bug
I do not know whether to add an idea to a .cabal file or to a cabal.project file.

More concretely: I needed to pass an extra flag to haddock during documentation building. Given the existence of ghc-options in a .cabal file, I tried a haddock-options field there. That did not work. Instead, I had to make a cabal.project file with a package stanza and put the haddock-options in the stanza.

haddock-options is not listed in https://cabal.readthedocs.io/en/3.4/cabal-package.html, but all users of my package will need this haddock option, so somehow cabal.project seems like the wrong place. (My understanding, which might be flawed, is that cabal.project should be for local options, while .cabal is for options that go with the package.)

haddock-options is also not listed in https://cabal.readthedocs.io/en/3.4/cabal-project.html, even though it is actually allowed there.... but I was able to figure things out based on the gloss "In general, the accepted field names coincide with the accepted command line flags that cabal install and other commands take." at the top of that page.

Expected behavior
I would expect haddock-options to be accepted in a .cabal file. But if that's the wrong design, then I would still expect haddock-options to be documented in the manual.

Additional context
Really, I'm trying to get cabal to play nicely with plugins, but that's beyond just this ticket.

@goldfirere goldfirere changed the title cabal file vs cabal.project file Document haddock-options May 31, 2021
@gbaz
Copy link
Collaborator

gbaz commented Jun 1, 2021

This doesn't say where options go per-se, but cabal.project is options for developing a package and cabal.project.local is options for locally developing a package (i.e. machine-specific specialization of the former). The rule of thumb is no .project goes in a distribution tarball, cabal.project goes into the github repo, and cabal.project.local doesn't even go there.

Which does give a hint -- as end users will want to haddock a distribution tarball, clearly the haddock options should be settable in *.cabal.

@Mikolaj
Copy link
Member

Mikolaj commented Jun 1, 2021

Actually I do put my cabal.project into extra-source-files so that it ends up in the package archive, in the vain hope that some day build tools will honour, e.g., this bit from my cabal.project:

 package splitmix
    flags: +optimised-mixer

I don't think we will ever be able to specify this in .cabal file, so that leaves me no other option, both for development and package archive.

@amigalemming
Copy link
Contributor

See this older ticket: #926

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

No branches or pull requests

4 participants