an example use case:
def div2(i: Int): Validation[String, Int] =
if (i%2 == 0) Validation.success(i/2)
else Validation.failure(\"odd\")
def div4(i:
The issue is that the applicative functor as implied by the monad does not equal the actual applicative functor
As discussed in the Scalaz group, the problem seems to be that ap
would accumulate errors whereas (pseudo-)monadic composition would only operate on the value part of Validation
.
Therefore, one cannot be expressed in terms of the other and thus no monad instance exists for Validation
.