typelevel / cats

Lightweight, modular, and extensible library for functional programming.
https://typelevel.org/cats/
Other
5.23k stars 1.19k forks source link

Add docs url for all functions in Glossary page #4444

Open lenguyenthanh opened 1 year ago

lenguyenthanh commented 1 year ago

This page is awesome: https://typelevel.org/cats/nomenclature.html. But I think it'll be better if we add docs url to all functions.

For example:

| `F[A] => F[Unit]`  | `void`   |

To

| `F[A] => F[Unit]`  | `[void](https://www.javadoc.io/doc/org.typelevel/cats-docs_2.13/latest/cats/Functor.html#void[A](fa:F[A]):F[Unit])`   |

If this is something we accept, I can work on this.

armanbilge commented 1 year ago

Thank you, that sounds good to me! I wonder if we should add an example of how to use it with syntax as well? Since it's a bit different than calling the method directly on the typeclass.

lenguyenthanh commented 1 year ago

I guess we can add examples, but it can be convoluted, which is opposite to the purpose of this page which in turn to give an overview of all the type classes.

I think if we have examples in the java doc, for each function is enough. wdyt?

armanbilge commented 1 year ago

I think if we have examples in the java doc, for each example is enough. wdyt?

good point! :)

lenguyenthanh commented 1 year ago

I did add some link here https://github.com/lenguyenthanh/cats/blob/add-links-for-glossary-page/docs/nomenclature.md.

But there are few issues, I can see right away (and not sure how to fix):

armanbilge commented 1 year ago
  • We have to keep update the docs url with scala version and cats version.

We can use @VERSION@ mdoc variable to keep the Cats version in sync. What if we link to the Scala 3 docs, does that work for going straight to the function?

  • CI failed at generating the site

Hmmm. I wonder if it helps to put the links at the bottom of the doc instead of inline.

Thanks for your work on this!!

lenguyenthanh commented 1 year ago

thanks! The scala 3 docs version works 💯

I also tried @VERSION@ with hope that mdoc works, because the scala 3 docs url is much simpler than the scala 2 docs with a lot of [][][][] :D

lenguyenthanh commented 1 year ago

after switching to scala 3 docs url, everything passes: https://github.com/lenguyenthanh/cats/actions/runs/5259440112

But I can't build the site locally. Both docs/tlSitePreview and docs/tlSite shutdown the sbt after a lot of warning like this: https://gist.github.com/lenguyenthanh/df88115b7af5b974d0324c3c2a712df6

But they did generate md files in site/target/mdoc, and the generated files look correct.

armanbilge commented 1 year ago

shutdown the sbt

ugh, that's https://github.com/scalameta/mdoc/issues/613

so that means that there are errors that need to be fixed

https://gist.github.com/lenguyenthanh/df88115b7af5b974d0324c3c2a712df6#file-cats-txt-L234

probably this?

https://gist.github.com/lenguyenthanh/df88115b7af5b974d0324c3c2a712df6#file-cats-txt-L192-L199