This is a catalogue of the major functions, type classes, and data types in Cats. It serves as a bird's-eye view of each class capabilities. It is also intended as a go-to reference for Cats users, who may not recall the answer to questions like these:
What is the difference between unit and void?
To discard the first value and keep only the first effect, is it <* or *>?
How do I make a computation F[A] fail by checking a condition on the value?
The signatures and type-classes have been simplified, are described below. If you want a printable version, you can also check out this cats-cheatsheet.
WARNING: this page is written manually, and not automatically generated, so many things may be missing. If you find a mistake, or addition, please submit a PR following the guidelines below.
Because Сats is a Scala library and Scala has many knobs and switches, the actual definitions and the implementations of the functions and type-classes in Сats can be a bit obfuscated at first. 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 higher kind.
We write type signatures in currified form: parameters are taken one at a time, and they are separated with the arrow => operation. In Scala, a method's parameters may be split in several comma-separated lists.
We do not differentiate between methods from the type-class trait (e.g. trait Functor), or the companion object, or the syntax companion (implicit class).
For functions defined as method of the typeclass trait, we ignore the receiver object.
We ignore implicit parameters that represent type-class constraints; and write them on a side column instead.
We use A => B for both Function1[A, B] and PartialFunction[A, B] parameters, without distinction. We add a side note when one is a PartialFunction.
We ignore the distinction between by-name and by-value input parameters. We use the notation => A, without parameters, to indicate constant functions.
We ignore Scala variance annotations. We also ignore extra type parameters, which in some methods are added with a subtype-constraint, (e.g. B >: A). These are usually meant for flexibility, but we replace each one by its bound.