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 220.127.116.11: 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 18.104.22.168: 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: