Category Theory
All of these concepts are covered quite nicely in the book this scala book. You should read it. It covers the motivatations behind sstreams and its basic components. It focuses less on using sstream to solve domain problems. This section acts more like a glossary for the rest of the material. It is designed to provide an ultra-light understanding of concepts in order to better, and more succinctly describe, sstreams. For a more extended introduciton, you can also check out learning scalaz.
There are many deep thoughts about semigroups, applicatives, et al. We will bypass all of the deep thoughts and summarize the key abstraction that each of these has. We also do not try to describe supporting detail since you can look many of these concepts up on your own. In all cases, scalaz provides these concepts as classes that can be instantiated for common types such as a List
or Set
or in some cases String
. Scalaz uses classes to represent these design patterns and creates instances of them for its library as well as for your use. These category theory classes play two roles. First, it acts as evidence
to a function that the type of one of its parameters satisfies certain properties that will be needed to perform the computation. Second, it provides the Strategy design pattern that is used to perform the calculation in the function and it can be called directly to perform the computation.
The classes that implement these components can be thought of as "small" design patterns because they represent abstract concepts, such as "addition" or "multiplication" for different types of objects. They are labelled "small" because they are very abstract and provide a simple operation.
Last updated