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
singletons-2.7's Haddocks omit the kinds of type families #466
Comments
I'd just go with solution (1) in haskell/haddock#1178 and render SAKS unconditionally. |
Certainly, fixing haskell/haddock#1178 would be ideal. In fact, I tried implementing solution (1) myself, but it turns out that there are a lot of tricky design decisions one must figure out:
In light of all this uncertainty, I abandoned my attempt at implementing solution (1). This is the main reason why I predicted in #466 (comment) that I don't foresee things changing any time soon on Haddock's end. |
I don't see why it's a problem. Consider the declaration and its SAKS as a single unit, with a documentation comment that applies to both of them.
Indeed, that's what I meant when I said "unconditionally". Just render SAKS for every type, as
I'd say the solution here is ghc-proposals/ghc-proposals#326. Render it as follows:
And the policy is to show those invisible binders on LHS that are used on the RHS. For example,
No
We must skip a binder for
For the preview, I'd say we need to define "boring" kinds and render only the interesting ones. Personally, I think boring kinds are defined by the following grammar:
So |
I agree wholeheartedly with @int-index above. And the summary of issues is very helpful, @RyanGlScott. Thanks. |
I broadly agree with the design in #466 (comment), but at the same time, I don't see this being implemented any time soon. In light of this, I still think it would be worthwhile to include redundant kind information in TH-generated declarations, which would be trivial to implement. Do you agree? |
If it's indeed easy to implement, then yes. |
Unfortunately, a Haddock limitation (discussed in #466) causes standalone kind signatures not to be rendered at all, which makes the Haddocks for much of `singletons-base` omit crucial kind information. To work around this Haddock limitation, this patch generates extra argument and result kinds in the bodies of type-level declarations. See `Note [Keep redundant kind information for Haddocks]` in `D.S.Promote`.
See #467. This PR appears large from a glance, but only because (1) lots of test cases needed to be updated, and (2) I had to update several hand-written declarations to match the new redundant kind policy. |
Unfortunately, a Haddock limitation (discussed in #466) causes standalone kind signatures not to be rendered at all, which makes the Haddocks for much of `singletons-base` omit crucial kind information. To work around this Haddock limitation, this patch generates extra argument and result kinds in the bodies of type-level declarations. See `Note [Keep redundant kind information for Haddocks]` in `D.S.Promote`.
Fixed in #467. |
While browsing the Haddocks for
singletons-2.7
recently, I came across this:Notice how
Flip
has no kind information whatsoever! Contrast this with howFlip
is rendered here in the Haddocks forsingletons-2.6
:I'm using
Flip
as an example, but this problem applies to basically every TH-generated promoted type family, defunctionalization symbol, and singleton type. Eek.What changed between
singletons-2.6
andsingletons-2.7
? There's a superficial difference between the wayFlip
is defined between the two versions, assingletons-2.6
definesFlip
like shown above (modulo TH-generated oddities), whereassingletons-2.7
definesFlip
with a standalone kind signature:This raises another question: why doesn't Haddock just render the standalone kind signature for
Flip
? Unfortunately, this is because of a deficiency of Haddock—see haskell/haddock#1178. Fixing haskell/haddock#1178 would be a pretty tall order, so I don't foresee things changing any time soon on Haddock's end.In the meantime, I we could make things slightly more tolerable for Haddock users. Since Haddock simply drops standalone kind signatures, we can give it more kind information in the body:
Indeed,
singletons-th
already computes the argument and result kinds in this fashion, but it currently avoids putting them into the body of the type family under the guise that this information is redundant. However, given the existence of haskell/haddock#1178, it might be worth including this redundant information for the benefit of Haddock readers.The text was updated successfully, but these errors were encountered: