Scala 2.12: Either is biased, implements map and flatMap

While reading the excellent Scala/FP book, Advanced Scala with Cats, I was just reminded that Scala’s Either class was redesigned in Scala 2.12. Prior to 2.12, Either was not biased, and didn’t implement map and flatMap methods. As the image from the book shows, Either is redesigned in 2.12 to include those methods, so it can now be used in Scala for-expressions as shown.

(I write about biasing in my book, Learning Functional Programming in Scala.)

Photo D8
Scala 2.12: Either is biased, implements map and flatMap