Skip to content
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

Add Nomenclature / Cheatsheet page #2558

Merged
merged 2 commits into from
Nov 8, 2018
Merged

Add Nomenclature / Cheatsheet page #2558

merged 2 commits into from
Nov 8, 2018

Conversation

diesalbla
Copy link
Contributor

Adds a page with the types and names of the many functions and methods of cats.
The types are written in a Haskell-lke form, as separate currified type signatures, without the names of the parameters.

@codecov-io
Copy link

codecov-io commented Oct 15, 2018

Codecov Report

Merging #2558 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2558   +/-   ##
=======================================
  Coverage   95.14%   95.14%           
=======================================
  Files         361      361           
  Lines        6630     6630           
  Branches      289      283    -6     
=======================================
  Hits         6308     6308           
  Misses        322      322

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 774fb51...1251004. Read the comment docs.

@arosien
Copy link

arosien commented Oct 16, 2018

This is great!

Perhaps "Nomenclature" isn't the right term, it's more of an overview, or cheatsheet, or index of the major functions?

(disclaimer: I made something similar, as a PDF, at https://arosien.github.io/cats-cheatsheets/typeclasses.pdf)

@diesalbla
Copy link
Contributor Author

@arosien Well, I am really sorry to say, I did not know of your cheatsheet. Otherwise, I would have saved me some time by sed-ing it :(. I will add a link to it. Of course, Markdown is not quite as nice as fourier, but still, that be good enough.

This commit introduces a new page to the documentation,
showing the name and simplified type signatures of the methods
in the type classes and data types of the cats library.

Whereas other pages of the documentation try to explain one
type-class at a time in a manner that is amenable to beginners;
whereas the Scaladocs are good only for those who remember the
name of the type-class and want to recall what they do.

ScalaDocs, in particular, suffer from a limitation: they are
structured following the classes-packages-objects structure
of the Scala codeHowever, practitioners using a type-class
or a data type may be interested on browsing easyily through
different methods that may be defined in separate "modules".
@diesalbla diesalbla changed the title WIP - Add Nomenclature page Add Nomenclature / Cheatsheet page Oct 17, 2018
@diesalbla
Copy link
Contributor Author

I am putting this to submission, and removing the WIP label. While this page may be further refined, the current version is wide enough for a first version.

- Type signatures are currified, parameters are taken one at a time, and they are separated with the arrow `=>` operation. This simplifies Scala's use of several lists of parameters.
- We ignore from the type signatures any implicit parameters, and instead add them as constraints at the side.
- We ignore the distinction between by-name and by-value input parameers, so we just use the type for both. Instead, we use the notation `=> A`, without any parameters, to indicate constant functions.
- We ignore the distinction between the Scala traits of `Function` and `PartialFunction[A, B]`. Thus, we use in both cases the symbol `A => B` to indicate both a `Function[A,B]`, and a `PartialFunction[A,B]`; and for partial functions we add a note besides it.
Copy link
Contributor

@kailuowang kailuowang Oct 17, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and for partial functions we add a note besides it

hmm.. I didn't see the note besides partial functions (at least not in ApplicativeError). I don't mind if we add them in a separate PR though, but we probably want to remove this sentence before merge.

@kailuowang
Copy link
Contributor

Thanks so much @diesalbla! This is amazing. I left a minor comment.


Because `cats` is a library for Scala, and because Scala has many more knobs and switches, the actual definitions and implementations of some functions in the library can seem a bit too obfuscated at first sight. To alleviate this, in this glossary we focus on the plain type signatures of the method, and ignore many of the details from Scala. In particular, in our type signatures:

- We use `A,B,C` for type variables of kind `*`, and `F, G, H` for type variables of a higuer kind.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

higuer -> higher

kailuowang
kailuowang previously approved these changes Oct 18, 2018
Copy link
Contributor

@kailuowang kailuowang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found one typo, but I think we should merge in and iterate after.

- Attend code review comments, and mention PartialFunction.
- Add section on the Kleisli data structure.
@kailuowang kailuowang added this to the 1.5 milestone Nov 6, 2018
Copy link
Contributor

@ceedubs ceedubs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Thanks, @diesalbla!

@ceedubs ceedubs merged commit 536bcb9 into typelevel:master Nov 8, 2018
@diesalbla diesalbla deleted the nomenclator branch November 12, 2018 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants