Slide 33
Slide 33 text
EitherT *Example:
unwrap second stack
* from cats.data.EitherT.scala
final case class EitherT[F[_], A, B](value: F[Either[A, B]]) {
def flatMap[AA >: A, D](
f: B => EitherT[F, AA, D])(
implicit F: Monad[F]): EitherT[F, AA, D] =
EitherT(F.flatMap(value) {
case l @ Left(_) => F.pure(l.rightCast)
case Right(b) => f(b).value
})
}