scalawithcats / scala-with-cats

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

Validation case study: Transforming data begins with `Either` rather than `Validated` #153

Closed mmynsted closed 5 years ago

mmynsted commented 5 years ago

In the Validation Case Study, the Transforming data section begins with a description of how there are not enough types to actually perform a transformation. This makes sense but Either is used in the examples here. Just before this section was a the addition of the or combinator, and before that was converting from using Either to using Validated.

Example from the Transforming data section:

To implement map we need to change the definition of Check. Specifically, we need to a new type variable to separate the input type from the output:

type Check[E, A, B] = A => Either[E, B]

Then later in the Predicates section Validated is again used.

I propose that Validated be used throughout this document, rather than Either.

mmynsted commented 5 years ago

I can't assign it to myself so If you agree with this issue please assign it to me.

davegurnell commented 5 years ago

Thanks for looking at this @mmynsted. I think in the medium term we need to rewrite this and parts of the monads/applicatives chapters to use Parallel.

mmynsted commented 5 years ago

Ah yes. I see your issue here #103.

mmynsted commented 5 years ago

Sigh. I have no idea what I thought needed to be changed here. Could this one be closed? Perhaps time would be better spent on #103.

davegurnell commented 5 years ago

No worries -- thanks for closing.

👍 to #103. Some day I'll get time... some day!