September 2018
Intermediate to advanced
398 pages
9h 43m
English
The cats.data.Validated[E, A]type is very similar to Either[E, A]. It is an ADT that represents a value of either an Invalid type or a Valid type. A simplified definition would be the following:
sealed trait Validated[+E, +A]case class Valid[+A](a: A) extends Validated[Nothing, A]case class Invalid[+E](e: E) extends Validated[E, Nothing]
We will see what the + sign in front of a type parameter means in the section on covariance and contravariance in Chapter 4, Advanced Features. For now, though, do not worry about it.
Read now
Unlock full access