Created
May 17, 2017 16:14
-
-
Save BenFradet/414e31933471316e7b7a2424d2a2efd0 to your computer and use it in GitHub Desktop.
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
val l = List(Success(true), Success(false), Failure(new Exception("a"))) | |
val good = l.filter { result: Validation[Exception, Boolean] => | |
result match { | |
case Success(r) => r | |
case Failure(_) => false | |
} | |
} | |
// List(Success(true)) | |
val bad = good.flatMap { r => | |
r match { | |
case Failure(m) => Some(m) | |
case _ => None | |
} | |
} | |
// always empty |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment