Created
June 15, 2017 06:51
-
-
Save patryk-scalac-io/e893e29f8d4ade512f0eaf6800308d04 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
// Based directly on definition: | |
val stringPrism = Prism[Json, String]{ | |
case JStr(v) => Some(v) | |
case _ => None | |
}(str => JStr(str)) | |
// The same prism but defined using `partial` helper and succinct syntax for second argument: | |
val stringPrism = Prism.partial[Json, String]{case JStr(v) => v}(JStr) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment