Fixed Validation's Monoid instance. #130

Merged
merged 1 commit into from Aug 11, 2012

2 participants

@folone
Scalaz member

Followup to #129.
I've added a check for monoid laws to Validation's tests, and found out, the identity element is wrong. Which resulted in things like:

scala> List(1.success[String], 2.success[String]).suml
res12: scalaz.Validation[String,Int] = Failure()

scala> List(1.success[String], 2.success[String]).concatenate
res13: scalaz.Validation[String,Int] = Failure()

So, I've fixed it. This is how it is now:

scala> List(1.success[String], 2.success[String]).suml
res0: scalaz.Validation[String,Int] = Success(3)

scala> List(1.success[String], 2.success[String]).concatenate
res1: scalaz.Validation[String,Int] = Success(3)
@purefn purefn merged commit a6ae78b into scalaz:scalaz-seven Aug 11, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment