Solutions to "Scala with Cats": Chapter 6April 5, 2023
These are my solutions to the exercises of chapter 6 of Scala with Cats.
Table of Contents
Exercise 22.214.171.124: The Product of Lists
List produces the Cartesian product is because
product is implemented in terms of
Semigroupal[List].product(List(1, 2), List(3, 4)) is the same as:
Which results in the Cartesian product.
Exercise 126.96.36.199: Parallel List
List does have a
Parallel instance. It zips the lists instead of doing the
Cartesian product. This can be exhibited by the following snippet: