Created
June 15, 2017 06:55
-
-
Save anonymous/c20ef136fa1649fb577475da6bfb75a4 to your computer and use it in GitHub Desktop.
the description for this gist
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
// successful | |
stringToPercent.modifyOption(p => p.copy(p.value * 2))("20") | |
// res: Option[String] = Some(40) | |
// String => Int conversion fails | |
stringToPercent.modifyOption(p => p.copy(p.value * 2))("abc") | |
// res: Option[String] = None | |
// Int => Percent conversion fails | |
stringToPercent.modifyOption(p => p.copy(p.value * 2))("200") | |
// res: Option[String] = None |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment