scalawithcats / scala-with-cats

Source code for Scala with Cats
http://underscore.io/books/scala-with-cats
389 stars 129 forks source link

consider adding a bit more more info about cats implementation of Monoid[Option[Int]] ? #113

Open philipschwarz opened 6 years ago

philipschwarz commented 6 years ago

https://twitter.com/philip_schwarz/status/946863214897266691

image

image

image

image

image

image

image

phderome commented 6 years ago

I thought that section 1.2.3 Implicit Recursive Resolution, which covers Option[Int] in the context of JsonWriter type class was actually leading quite naturally to Monoid[Option[Int]] realizing that Monoid is a type class just like JsonWriter. Furthermore, the link to typelevel class on CATS shown above seems to be a "almost a given" to be required reading alongside this book as those exercises are so useful and simple. In short, I see no difficulty in reading the material of 2.5.2 raised by Philip.

I'll grant that this book should not be read with the assumption that the Haskell book, the "Red" book or Sam Halliday are required readings alongside (though they are good material and recommendable in general); if it seems useful, it'd be indicative that more explanation is required. This book on its own, playing around with the code in an editor/IDE, and the typelevel.org exercises should be sufficient hopefully to go through this whole book.