Created
July 16, 2014 17:22
-
-
Save seanparsons/f05e5b657a8197986dfa to your computer and use it in GitHub Desktop.
List of failures or successes to a failure or list of successes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scala> val list = List(1.right[String], "Fail".left[Int], 3.right[String]) | |
list: List[scalaz.\/[String,Int]] = List(\/-(1), -\/(Fail), \/-(3)) | |
scala> list.sequenceU | |
res1: scalaz.\/[String,List[Int]] = -\/(Fail) | |
scala> val list = List(1.right[String], 2.right[String], 3.right[String]) | |
list: List[scalaz.\/[String,Int]] = List(\/-(1), \/-(2), \/-(3)) | |
scala> list.sequenceU | |
res2: scalaz.\/[String,List[Int]] = \/-(List(1, 2, 3)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment