You seem to be using validation for a side effect. This is not what it is for. You use return values ββin functional programming.
Validation for understanding continues with success, but is interrupted by an error and returns a failure.
scala> def g(i: Int): Validation[String, Int] = { println(i); if(i % 2 == 0) i.success else "odd".fail } g: (i: Int)scalaz.Validation[String,Int] scala> val result = for { | i <- g(1) | j <- g(2) | } yield (i,j) 1 result: scalaz.Validation[String,(Int, Int)] = Failure(odd) scala> val result = for { | i <- g(2) | j <- g(1) | } yield (i,j) 2 1 result: scalaz.Validation[String,(Int, Int)] = Failure(odd) scala> val result = for { | i <- g(2) | j <- g(2) | } yield (i,j) 2 2 result: scalaz.Validation[String,(Int, Int)] = Success((2,2)) scala> val result = for { | i <- g(1) | j <- g(1) | } yield (i,j) 1 result: scalaz.Validation[String,(Int, Int)] = Failure(odd)
source share