You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Consider reverting default usage of --enable-documentation in cabal haddock #8725
I was bitten by #8707 and I had no idea what was going on, had to search the issue tracker to find it.
Looks like now cabal haddock will with default settings (i.e. no documentation: True in the config file or --disable-documentation passed explicitly) lead to rebuild of all dependencies.
What is worse, if someone doesn't want to enable documentation: True, there seems to be no way to permanently disable this behavior.
This looks like a quite bad UX change to me.
Can this please be reverted? Or resolved in a better way.
We've also had a lot of ticket from people bitten by the inverse default. Especially newcomers, and they need any help they can get. How can we resolve this in a better way? @arybczak: what would mollify you, for example?
for example, I always build documentation (and have documentation = True in the global config).
Great, then you're not affected by this change at all. Why would you be against the revert then?
EDIT: Another option would be changing documentation to True as a default. I just don't understand the rationale of having this unconditionally enabled in this specific case, especially since the global configuration file, judging by the amount of options it has, lets you configure everything under the sun.
I find it extremely annoying to explain people, especially less experienced ones, that just cabal haddock is not enough and they must double down on their intention to build documentation with cabal haddock --enable-documentation. The sensible default behaviour is not to make users to ask you twice. Power users can always supply --disable-documentation.
Reacted by gbaz, Andreas Abel and ParetoOptimalDev
Agreed. I think this might be irritating the first time, but subsequently, as long as the versions don't change, then all those built haddocks will be cached and available, which on the whole will be handy. I'm certainly open to adding a global setting for controlling this as well though...
Power users can always supply --disable-documentation.
No, power users should be able to disable this in the configuration file.
might be irritating the first time, but subsequently, as long as the versions don't change
In reality they do almost every time you do cabal update.
Does documentation: False in the cabal.project file work, @arybczak ?
It doesn't. That's the crux of a problem. There is currently no way to override this behavior (other than passing --disable-documentation on the command line every single time).
Again, the problem here is not that this change is bad, it's that it's unconditionally enabled there is not way to disable it.
Providing another ~/.cabal/config option haddock-documentation with a default True that controls whether --enable-documentation is passed to cabal haddock so that it can be disabled.
Placing documentation: False in cabal.project should work, so, if it doesn't - it's probably a bug?
Perhaps. But why should it work for cabal.project, but not for ~/.cabal/config?
Why would anybody invoke cabal haddock, if not for documentation?
Did you try running cabal haddock without --enable-documentation? You still get the haddock for your package, but without links to external packages. For some people (like me) it's sufficient.
My understanding of the global level "documentation: False" is that it is supposed to control whether or not haddocks are run on packages as they are built in general. It is not supposed to determine if we recursively generate documentation for sub-dependencies of an individual package where we have already opted into asking for docs.
Again though, I think having a global opt-out of this flag would be a good thing, and a welcome PR. However, given the arguments both ways, circling around reverting the existing change seems like it won't be very fruitful.
cliConfig = commandLineFlagsToProjectConfig globalFlags flags' mempty-- ClientInstallFlags, not needed here
installFlags at this point contains only flags set on the command line, so setting it to Flag means that it overwrites any setting in a configuration file (which IIUC is considered later).
I tried adding a haddock specific setting full-documentation:
So that whether haddocks for dependencies are installed is done in elaborateInstallPlan, where global configuration is also considered.
The problem then becomes twofold:
Weird interaction between these flags, e.g. what should --disable-documentation --haddock-full-documentation mean?
Unfortunately it looks like haddock options are considered for all commands, not only the haddock action. So setting full-documentation in the haddock section to True amounts to the same thing as setting documentation to True 😞
I don't know how to solve these issues at the moment and I don't have more time to spend on this, but I'll restate again that the patch that added this goes against anything else done in cabal, i.e. that things are configurable via files.
I'll echo what @phadej said here: if people want full haddocks, they should set documentation to True.
If you decide to keep this as is, oh well, I suppose I'll live with running a fork. Presumably there will be many more people complaining about this after the release as I suspect not many people tried 3.9.0.0.
FWIW, I strongly agree that the command-line override needs a configuration file equivalent.
As to whether dependency haddocks should be on by default, my inclination is to say "no".
Perhaps a nice solution (though not an easy solution to implement) would be if we could make the haddocs independently installable: so that building the docs for a dependency did not imply rebuilding the code. For example, similar to how we handle building profiling these days. Such an approach may well mean the docs have to be independent entries in the store and in the build plan, rather than being "part of" each entry in the plan.
Reacted by Mikolaj Konarski and Francesco Gazzetta
I'm looking at this now afresh. The discussion seems to have died out because of the dead-end with the more ambitious idea based on a new cabal option (so-called full-documentation). However, a simple idea seemed to have been overlooked in the back and forth: if people specify documenation: False in their config or project file, that should override the new default for cabal haddock. This looks like a very natural solution, which should also have a straightforward implementation. @arybczak will this make you switch back to un-patched cabal, at least?
Activity
ulysses4ever commentedon Feb 2, 2023
As the author of the change in question, I'm happy with reverting, if people think that it's really annoying (and by the looks of it, they do).
Mikolaj commentedon Feb 2, 2023
We've also had a lot of ticket from people bitten by the inverse default. Especially newcomers, and they need any help they can get. How can we resolve this in a better way? @arybczak: what would mollify you, for example?
arybczak commentedon Feb 2, 2023
Well, for example having a way to disable this with a seting in
~/.cabal/configwould work.The issue here is that the new behavior can't be disabled without passing
--disable-documentationtocabal haddockevery time you invoke it.mouse07410 commentedon Feb 2, 2023
I'm not sure it would be good to revert - for example, I always build documentation (and have
documentation = Truein the global config).arybczak commentedon Feb 2, 2023
Great, then you're not affected by this change at all. Why would you be against the revert then?
EDIT: Another option would be changing
documentationtoTrueas a default. I just don't understand the rationale of having this unconditionally enabled in this specific case, especially since the global configuration file, judging by the amount of options it has, lets you configure everything under the sun.Bodigrim commentedon Feb 3, 2023
I find it extremely annoying to explain people, especially less experienced ones, that just
cabal haddockis not enough and they must double down on their intention to build documentation withcabal haddock --enable-documentation. The sensible default behaviour is not to make users to ask you twice. Power users can always supply--disable-documentation.gbaz commentedon Feb 3, 2023
Agreed. I think this might be irritating the first time, but subsequently, as long as the versions don't change, then all those built haddocks will be cached and available, which on the whole will be handy. I'm certainly open to adding a global setting for controlling this as well though...
andreasabel commentedon Feb 3, 2023
Does
documentation: Falsein thecabal.projectfile work, @arybczak ?arybczak commentedon Feb 3, 2023
No, power users should be able to disable this in the configuration file.
In reality they do almost every time you do
cabal update.It doesn't. That's the crux of a problem. There is currently no way to override this behavior (other than passing
--disable-documentationon the command line every single time).Again, the problem here is not that this change is bad, it's that it's unconditionally enabled there is not way to disable it.
I see two potential solutions:
documentation: Trueby default and reverting cabal haddock imply enable-documentation #8259.~/.cabal/configoptionhaddock-documentationwith a defaultTruethat controls whether--enable-documentationis passed tocabal haddockso that it can be disabled.mouse07410 commentedon Feb 3, 2023
A few naive questions.
documentation: Falseincabal.projectshould work, so, if it doesn't - it's probably a bug? And fixing it should resolve this issue?cabal haddock, if not for documentation?documentation: Falsein~/.cabal/config, which presumably alleviates the problem?arybczak commentedon Feb 3, 2023
Perhaps. But why should it work for
cabal.project, but not for~/.cabal/config?Did you try running
cabal haddockwithout--enable-documentation? You still get the haddock for your package, but without links to external packages. For some people (like me) it's sufficient.gbaz commentedon Feb 4, 2023
My understanding of the global level "documentation: False" is that it is supposed to control whether or not haddocks are run on packages as they are built in general. It is not supposed to determine if we recursively generate documentation for sub-dependencies of an individual package where we have already opted into asking for docs.
Again though, I think having a global opt-out of this flag would be a good thing, and a welcome PR. However, given the arguments both ways, circling around reverting the existing change seems like it won't be very fruitful.
arybczak commentedon Feb 7, 2023
Fair enough. I see there's a section
haddockin~/.cabal/config, I'll make a PR that adds adocumentationsetting to it.arybczak commentedon Feb 21, 2023
Ok, so I've spent a couple of hours on this and I think it's not that simple.
cabal/cabal-install/src/Distribution/Client/CmdHaddock.hs
Lines 146 to 148 in 04665d2
installFlagsat this point contains only flags set on the command line, so setting it toFlagmeans that it overwrites any setting in a configuration file (which IIUC is considered later).I tried adding a haddock specific setting
full-documentation:So that whether haddocks for dependencies are installed is done in
elaborateInstallPlan, where global configuration is also considered.The problem then becomes twofold:
--disable-documentation --haddock-full-documentationmean?haddockoptions are considered for all commands, not only thehaddockaction. So settingfull-documentationin thehaddocksection toTrueamounts to the same thing as settingdocumentationtoTrue😞I don't know how to solve these issues at the moment and I don't have more time to spend on this, but I'll restate again that the patch that added this goes against anything else done in
cabal, i.e. that things are configurable via files.I'll echo what @phadej said here: if people want full haddocks, they should set
documentationtoTrue.If you decide to keep this as is, oh well, I suppose I'll live with running a fork. Presumably there will be many more people complaining about this after the release as I suspect not many people tried 3.9.0.0.
Mikolaj commentedon Feb 23, 2023
@arybczak: thank you for the investigation. We are about to release, so let's gather here further feedback of this feature and ideas for improvements.
vdukhovni commentedon Mar 13, 2023
FWIW, I strongly agree that the command-line override needs a configuration file equivalent.
As to whether dependency haddocks should be on by default, my inclination is to say "no".
ci: change in behaviour of ‘cabal haddock’
dcoutts commentedon Apr 26, 2023
Perhaps a nice solution (though not an easy solution to implement) would be if we could make the haddocs independently installable: so that building the docs for a dependency did not imply rebuilding the code. For example, similar to how we handle building profiling these days. Such an approach may well mean the docs have to be independent entries in the store and in the build plan, rather than being "part of" each entry in the plan.
ci: change in behaviour of ‘cabal haddock’
michaelpj commentedon Jun 14, 2024
I made another issue for the problem of possibly building the docs separately: #10111
phadej commentedon May 21, 2025
Today I noticed that if you add a haddock flag, e.g.
--haddock-hoogle,cabal haddockwill rebuild all the transitive dependencies.In past two years, I haven't found a situation where I liked
cabal haddock(re)building the dependencies' docs by default. Please revert.arybczak commentedon May 21, 2025
Indeed. I'm still using build with a patch that reverts this locally:
ulysses4ever commentedon Jun 15, 2025
I'm looking at this now afresh. The discussion seems to have died out because of the dead-end with the more ambitious idea based on a new cabal option (so-called
full-documentation). However, a simple idea seemed to have been overlooked in the back and forth: if people specifydocumenation: Falsein their config or project file, that should override the new default forcabal haddock. This looks like a very natural solution, which should also have a straightforward implementation. @arybczak will this make you switch back to un-patched cabal, at least?arybczak commentedon Jun 16, 2025
If this also works at the level of ~/.cabal/config, yes.