How to 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) .
from.fold(Failure(_), identity)
In general, flatMap (identity) or .join works for any Monad to convert F [F [A]] to F [A], however validation is not a monode and flatMap / join methods for Validation are deprecated.
Just flatMap that ValidationNel :
flatMap
ValidationNel
from.flatMap(identity)