Cats effect
The Cats effect is a library for concurrent programming in cats
. Its main feature is a bunch of type classes, data types, and concurrency primitives to describe concurrent programming in Scala with cats
.
The concurrency primitives support among other things:
- Resource management—think try-with-resources.
- Seamless composition of parallel computations.
- Communication between parallel computations.
We will start discussing the library by looking at its central concurrency primitive, IO
, and some capabilities of Cats that we will need in the process of discussing it.
ProductR
Before diving deep into the library and discussing its features, we need to mention a particular operator that is frequently used throughout this library. We have already discussed the Applicative type class, and that it is useful for parallel composition.
An operator from this type class that is frequently used in cats
is a so-called right product operator.
The operator in question takes two computations, performs a product...