Skip to content

Instantly share code, notes, and snippets.

@debasishg
Created February 6, 2011 09:01
Show Gist options
  • Save debasishg/813243 to your computer and use it in GitHub Desktop.
Save debasishg/813243 to your computer and use it in GitHub Desktop.
scala> val d: Validation[String, Int] = 12.success
d: scalaz.Validation[String,Int] = Success(12)
scala> val e: Validation[String, String] = "ghosh".success
e: scalaz.Validation[String,String] = Success(ghosh)
scala> (d, e)
res18: (scalaz.Validation[String,Int], scalaz.Validation[String,String]) = (Success(12),Success(ghosh))
// I want to get Validation[String, (Int, Int)] out of this. The closest I could get is ..
scala> (d, e).sequence[({type λ[α]=Validation[java.lang.String, α]})#λ, String]
res38: scalaz.Validation[java.lang.String,(scalaz.Validation[String,Int], String)] = Success((Success(12),ghosh))
@debasishg
Copy link
Author

Thanks .. I was tricked into thinking in terms of sequence .. Alexey also suggested the same on the ML ..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment