-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Fix build for scaladoc generation of Laws #961
Conversation
@@ -2,7 +2,7 @@ package cats | |||
package laws | |||
|
|||
/** | |||
* Laws that must be obeyed by any `Bimonad`. | |||
* Laws that must be obeyed by any [[Bimonad]]. |
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.
Just added this to show that this compiles correctly during site generation and generates a link to Bimonad from BimonadLaws during site generation. This example was specifically referenced in #516
Current coverage is
|
Out of interest, what exactly is the cause of the scaladoc breaking the builds? By that, I mean is it scaladoc/unidoc/doctest/makesite...? I ask just to be sure that the correct thing is being disabled in the build. For example, if it is doctest that is failing, we could just disable that in 2.10 and still generate the docs |
You also might want to look at https://github.com/InTheNow/sbt-catalysts/blob/master/src/main/scala/sbtcatalysts/CatalystsPlugin.scala#L306-L308 Taken from the note at https://github.com/sbt/sbt-unidoc#how-to-unify-scaladoc |
Hey, thanks for getting back. Yea, for sure, I guess I raised this one as much for discussion as anything else. If there are better options we should definitely go with those. The other 2 PRs I sent were to disable scaladoc for 2.10 only. If theres a better way to do that, then all for it - they stop a problem which happens for macro expansion in 2.10 when generating scaladoc for But that's a different issue to this one. This one references an issue that's been around for a while. The issue #510 is basically stating that the laws scaladoc should be published, because it is an important part of cats. The problem there affects scala 2.11. Being honest, I'm not sure what the underlying cause is. It may not be related to macro expansion at all. It only seems to affect two syntax types, ApplySyntax and FoldableSyntax. Other syntax types used in the laws code seem fine when generating docs. It could be related to the Unapply classes that are used when constructing the syntax for Foldable and Apply. So basically, when I noticed that it only relates to the syntax for those two type classes, I put this PR together to show that it could be resolved by avoiding the syntax for those two type classes. So, this definitely solves #510. But it is kludgy and if there is a different way to solve it without avoiding the syntax issues, I definitely think we should do that. |
@mikejcurry Might be worth a look to see if the setting I mention helps somehow, even if other issues still exist |
Yea, I'd seen that alright, but couldn't find a way to get it to work with cats. Unfortunately,
|
f46cffe
to
a9034c7
Compare
a9034c7
to
c2ad568
Compare
Hey, I realize the changes might be a bit contentious. As far as I can ascertain, there is something that goes wrong with the application of The end result of all that is that the scaladoc for the laws project can't be published. The way I see it, this workaround at least allows the scaladoc for the laws project to be published, which is a good step forward. The limitations related to the syntax and the scaladoc references could be followed up separately. |
Kind of hoping that the amazing higher order unification work that has been going on makes this proposed workaround obsolete. I can close this if folks prefer, but might be worth keeping around for a while as a PR until an alternative is found. If the need for |
I cannot be certain, but akka/akka#20533 may be a similar issue, [error] value ap is not a member of type parameter F[B => C]
[error] value ap is not a member of type parameter F[A => B]
[error] Unused import
[error] import cats.syntax.apply._ ie the errors can be reproduced in the library @eed3si9n Any thoughts on this, please? |
Unifying the source seem to interfere with implicits and macros. implicit def fasttypetag[A]: FastTypeTag[A] = ??? liberally in the source, since you just need to get the code to compile to generate the docs. |
@eed3si9n Firstly, thanks for the feedback, very much appreciated. I wonder, when you say "Unifying the source seem...." if this would work better if we did not use unidoc for now (we have no Java code)? Or would it not make any difference? |
This PR changes a number of laws classes to not use syntax, and updates build.sbt to enable scaladoc generation for the law project.
The problem outlined in #516 only occur if syntax is used to reference the operations on Apply and Foldable. This PR changes these references to use the type classes directly instead of using the syntax.
Once this is in place, the scaladoc generates correctly for the laws project during the makeSite project.
This PR would fix #510 as it publishes the scaladoc for laws as part of the site.
The fix is a bit ugly, because specific syntax has to be avoided, and a deeper investigation into how to make that syntax work with scaladoc is probably required, but given where things are, this is probably a useful step forward, despite the kludginess.
Note that this has conflicts with both #959 and #960 so will need to merge to latest once those have been merged.