I'm working with Scalaz validations and I've run into a situation like this (note this is heavily simplified from my actual code, but the idea is the same)
Given:
case class Foo(bar: Int)
val x1: Validation[String, Foo] = Foo(1).success
val x2: Validation[String, Foo] = Foo(2).success
val x3: Validation[String, Foo] = Foo(3).success
val l1 = List(x1, x2)
I would like to be able to do something along the lines this:
(x3 |@| l1) { (x1, x2, x3) => /*do something with all of my Foo's*/ }
Of course if there were any errors, either in the list or outside of the list I'd like them to accumulate as they normally would.
I know the above syntax does not work, but any advice on how to achieve the result I'm looking for would be appreciated.
l1.sequenceUwill give you a validation containing a list ofx1andx2? - Travis Brown