我正在使用
cats,想知道如何使用它来转换数据.
从
val data = Either[Error,Option[Either[Error,Account]]]
至
val target: Either[Error,Option[Account]] = howToConvert(data)
我现在可以用:
data match { case Left(e) => Left(e) case Right(Some(Right(y))) => Right(Some(y)) case Right(Some(Left(e))) => Left(e) case Right(None) => Right(None) }
但我正在寻找一些简单的方法