-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
haskellPackages: doHaddockInterfaces #91557
Conversation
@pepeiborra Would you be able to explain a little bit more about what this does, and why we would want to enable it? (And possibly link to upstream documentation? Although it sounds like it might not be documented upstream...) In my experience, many packages have incorrect haddocks, so I'd be somewhat hesitant to enable this by default if it causes compile errors. |
The Your concern is fair, some packages have incorrect haddocks (specially in test suites) and
|
@pepeiborra Ah, so you're saying that anywhere we are already building haddocks, then the addition in this PR shouldn't cause any new build failures? In that case, it seems pretty safe to add this. Could you rebase this on the |
Kind of, except that Unfortunately I believe there is no way to instruct Cabal to use a GHC option only in the library stanza. This has been raised in the Cabal issue tracker, but no mention of progress: |
@pepeiborra Normally what happens with these types of PRs is that @peti will try merging it into the If it is just a few, then we fix them up by hand. If it is a bunch, then we merge it in but keep the option off by default. |
Lets see if ofborg is able to build a couple common packages for us: @GrahamcOfBorg build haskellPackages.lens |
What I really don‘t like about this change is, that it favors package without tests. On the other hand I am obviously hugely in favor for improving the IDE experience. And if we regard this as an experiment to be improved upon, I am in favor. |
Also: This shows that I would be awesome to have better tuned control over different cabal outputs in nix. |
I am not a huge fan either, but this is what I arrived at after much thinking and tinkering. If you have a better idea, I would love to hear it. Even when/if the issue gets fixed in GHC, backwards compatibility with previous GHC releases will limit our options here. |
At the very least, this now works with |
2afb81a
to
c7cadae
Compare
I don't like the constraint How about we enable the new Haddock feature for all packages, test build the package set, and see how many actual errors we'll have? If it's just a handful, then we could simply open PRs for the respective upstreams and fix those issues? |
I suspect it's quite a few packages that have comments in their test suites that trip up the Haddock parser. Even if we open PRs for all of them, it would take a long time for all those PRs to get merged and eventually released. And it looks like this issue will be fixed in GHC 8.12 anyway. Would you object to this PR if the default value for the new option was |
This is speculation, though. I'd rather know how many packages actually break, and we have the means to find out thanks to Hydra.
No, I think that would be perfectly fine. |
I'm not that familiar with Nix and Hydra. Do I just push a change to my branch to turn the setting on and wait for results? |
I have pushed a change to turn on |
I have merged your changes into the branch |
4131 failures, most of them caused by a parse error in the random-1.1 testsuite. My view is that this is a bug in GHC, not something that needs to be fixed in packages downstream, and the bugfix will be included in 8.12 (or 8.14 if it doesn't make the cut). With that in mind, I have changed the default value to enable the setting only in GHC >= 8.12 |
@GrahamcOfBorg build haskellPackages.lens |
good to merge now or are there any changes requested? |
@@ -53,7 +53,7 @@ in | |||
, maintainers ? [] | |||
, doCoverage ? false | |||
, doHaddock ? !(ghc.isHaLVM or false) | |||
, doHaddockInterfaces ? true | |||
, doHaddockInterfaces ? stdenv.lib.versionAtLeast ghc.version "8.12" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does ghc-8.12.x have to do with this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
8.12.x will turn Haddock errors into warnings, provided !2377 lands before the cut
Now is the time to start fixing those failures ...
Really? That doesn't look like a compiler bug to me at all. You just re-format the line
properly, and then it compiles just fine. |
Respectfully, we don't know how many failures there are, maintainers will be reluctant to cut a release just to change a comment in a test suite, and all that is wasted effort once !2377 is merged.
There is no error message referencing the problematic markup, Haddock, or even the line that caused the error:
The |
I'd rather not a time bomb like that included in Nixpkgs. If you are not going to support any efforts to fix those errors, then the only way I want that new feature included is if it's off by default. |
That's fine by me, I'll submit another PR to enable conditionally once !2377 has landed in GHC. |
!2377 has been scheduled for merging[1], so I would like to amend this PR to enable [1] https://gitlab.haskell.org/ghc/ghc/-/merge_requests/2377#note_289455 |
I think @peti's point about the time bomb here is, that while this might be perfectly reasonable code, we can't test this before we have 8.12 in nixpkgs. Maybe we can merge this PR now and instantly create a new Pr which switches the default on 8.12, but only merge that one, when have tested it? I mean we don't loose anything by merging something that only affects 8.12 only when we actually have 8.12, right? |
How badly does this affect compile times? Haskell compile times are already bad, and Haskell compile times with Nix are already worse (frequent rebuilds, ×2 time for profiling builds, ineffective CPU utilization), it would be sad to see this get even worse. |
Motivation for this change
Adds a new builder option
doHaddockInterfaces
to enable the-haddock
flag in GHC,which results in Haddock comments parsed at compile-time and embedded in
interface files. These are used by the
:doc
command in GHCi, as well as by IDEtools like ghcide and hls to display docs on hover.
The
-haddock
flag has been around since at least 8.2, even though it does notget a mention in the GHC Users guide.
There are two downsides to turning on this flag:
Item 2 in particular can be quite problematic for benchmarks and test suites,
where Haddock parse errors would not be a consideration.
This explains the default setting for
doHaddockInterfaces
beingdoHaddock && !doCheck
.Once the problem is fixed in
GHC, the
doHaddockInterfaces
default value can be updated to be always on incertain GHC versions.
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)