scalawithcats / scala-with-cats

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

Confounding example on `MonadError.handleError` #187

Closed yhpark closed 4 years ago

yhpark commented 4 years ago

In Ch. 4.5.2, the book shows a simple example of using handleError method, which maps the error type String to ErrorOr[String] so the resulting type is nested ErrorOr[ErrorOr[String]] which possibly confound readers to think handleError takes E => F[A]. I would change the example to handleError returns some Int instead of ErrorOr[String] because it's simpler and coherent with the previous code example.

yhpark commented 4 years ago

Also I found the exercise 4.5.4 Exercise: Abstracting empty. Seems it's been left unfinished since the initial writing 3 years ago

noelwelsh commented 4 years ago

Thanks. I've fixed it now.