Skip to content
This repository was archived by the owner on Aug 3, 2024. It is now read-only.

Fix #1015 with dataConUserTyVars #1016

Closed
wants to merge 9 commits into from
Closed

Fix #1015 with dataConUserTyVars #1016

wants to merge 9 commits into from

Conversation

RyanGlScott
Copy link
Member

The central trick in this patch is to use dataConUserTyVars instead of univ_tvs ++ ex_tvs, which displays the foralls in a GADT constructor in a way that's more faithful to how the user originally wrote it. With these changes, the example from #1015 now renders as:

haddock

Along the way, I simplified some code that tried to calculate where a data constructor should use GADT syntax in an ad hoc fashion. Luckily, this information is cached as isGadtSyntaxTyCon, so I just used that instead.

Thankfully, there's already a test case in html-test that stress-tests this code path, so I didn't need to add the test case from #1015 (since it relies on code from base which might change in the future).

harpocrates and others added 9 commits November 11, 2018 20:01
Matches b71da1feabf33efbbc517ac376bb690b5a604c2f from hackage-server.

Fixes #967.
 * don't forget to print explicit `forall`'s when there are arg docs
 * when printing an explicit `forall`, print all tyvars

Fixes #973
* WIP: Load (typechecker) plugins from language pragmas

* Revert "Load plugins when starting a GHC session (#905)"

This reverts commit 72d82e5.

* Simplify plugin initialization code
The information about whether or not there is a source-level `forall`
is already available on a `ConDecl` (as `con_forall`), so we should use
it instead of always assuming `False`!

Fixes #1002.
It looks like the new versions don't cause any breakage
and loosening the bounds helps deps fit in one stack resolver.
@harpocrates
Copy link
Collaborator

So this is something already fixed in the Hi Haddock branch at a53c131. There are a bunch of fixes to Convert in that branch which exist nowhere else. Rather than re-fix them in ghc-head and face hell when the time comes to rebase that branch, I think the right thing to do would be split them out of wip/hi-haddock (since that's probably not going to get merged in time for 8.8).

If @sjakobi isn't planning on working on Hi Haddock this weekend, I could try to do that now. Thoughts @sjakobi?

@RyanGlScott
Copy link
Member Author

Looking at a53c131, it looks like that commit tackles the problem in a much different way. Intead of using dataConUserTyVars, it simply hardcodes con_forall to False! If I'm reading that correctly, that means that Haddock will never render the foralls in a GADT constructor's type signature, which feels rather strange.

@harpocrates
Copy link
Collaborator

harpocrates commented Feb 2, 2019 via email

@harpocrates
Copy link
Collaborator

@RyanGlScott I've split out of wip/hi-haddock and into ghc-head the changes I was worried would conflict. Do you mind rebasing this onto ghc-head?

@RyanGlScott
Copy link
Member Author

I take it, then, that you don't want me to target this PR against ghc-8.6 (as it is currently)?

@harpocrates
Copy link
Collaborator

harpocrates commented Feb 4, 2019 via email

@RyanGlScott
Copy link
Member Author

That's fine—I'm just wondering if this could be cherry-picked into ghc-8.6, since @kosmikus was asking for this in well-typed/generics-sop#92 (comment).

@harpocrates
Copy link
Collaborator

Oh I see. Sigh.

I guess we can merge this now in ghc-8.6 and deal with the conflicts when next merging into ghc-head. Do you know if there is even a new Haddock release planned for the 8.6 release? (Is there even another 8.6 release planned?) I haven't heard anything from Ben.

@RyanGlScott
Copy link
Member Author

Perhaps I'm operating under a misconception. I was under the impression that Haddock releases occurred independently of GHC, and that the ghc-8.6 branch was the main upstream for that release cycle (while ghc-head tracks a separate development cycle that's geared specifically to GHC HEAD's needs). Moreover, I was imagining that, at periodic intervals, there would be a mass merging of commits from one branch to the other. But perhaps this is not the case?

@harpocrates
Copy link
Collaborator

I was under the impression that Haddock releases occurred independently of GHC

That's not the case. Since most people get Haddock from their GHC installation (NB: the binary-dists that get released include a Haddock executable), I've been syncing releases up with GHC releases. I guess we could release more often, but I doubt people would remember to install a newer version of Haddock. And even if they did:

  1. Cabal/Stack have some magic around trying to guess the right Haddock executable for cabal/stack haddock, which I don't think would pick up the newer executables (unless explicitly directed to do so). I haven't tested this...
  2. The Haddock distributed with GHC is built under slightly different circumstances (for now at least, see flag(in-ghc-tree)), so it's nice to minimize the "flavours" of Haddock executables floating around in the wild. I hope to get rid of this once the Make system disappears and only Hadrian remains.

...and that the ghc-8.6 branch was the main upstream for that release cycle (while ghc-head tracks a separate development cycle that's geared specifically to GHC HEAD's needs). Moreover, I was imagining that, at periodic intervals, there would be a mass merging of commits from one branch to the other.

This part is spot on. We regularly merge branches for older release cycles into ones for newer release cycles. This sort of merge is generally not very pleasant though.


If you have any ideas for improving this state of affairs, I'm all ears. 😄

@RyanGlScott
Copy link
Member Author

I wasn't aware of the nuances that go into Haddock releases, thanks for letting me know. I certainly don't want to create more work for you, so forget I said anything about cherry-picking into ghc-8.6. We'll have to wait slightly longer to use this feature with a non-HEAD compiler, but good things take time anyway :)

I'll see if I can wrangle GitHub to change the branch I'm targeting against.

@RyanGlScott RyanGlScott changed the base branch from ghc-8.6 to ghc-head February 4, 2019 17:25
@RyanGlScott
Copy link
Member Author

It looks like the haddock repo disallows force-pushing (even for branches), so rebasing this as-is proves to be trickier than I thought. I think I'll just opt to close this and open a fresh PR against ghc-head.

@RyanGlScott
Copy link
Member Author

Closing in favor of #1022.

@RyanGlScott RyanGlScott closed this Feb 4, 2019
@RyanGlScott RyanGlScott deleted the T1015 branch February 4, 2019 18:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants