How do I convert
val from: ValidationNel[E, ValidationNel[E, T]]
to
val to: ValidationNel[E, T]
while capturing all validation errors?
you can use from.fold(Failure(_), identity).
In general, flatMap(identity) or .join works for any Monad for turning F[F[A]] into F[A], however, Validation is not a Monad, and the flatMap / join methods for Validation are deprecated.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With