alvinj / FunctionalProgrammingSimplified

Notes and projects for my book, “Functional Programming, Simplified"
18 stars 2 forks source link

Either paragraph is only valid for Scala < 2.12 #3

Open loicdescotte opened 6 years ago

loicdescotte commented 6 years ago

The book says that it does not work in for comprehension without .right projections, and that Either can lead to mistake if you don't remember that left is for errors and right for successes, by convention.

It's no longer true as Either is right biased since Scala 2.12.

loicdescotte commented 6 years ago

Personal opinion : Either is now very convenient to use, and different from Try as it can have custom error types (ADT for instance) for errors, not only exceptions - for example it's nice for functional (non technical) errors.