-
-
Save Softsapiens/bf881cdec7534bf83683 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| Welcome to Scala version 2.10.4 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_51). | |
| Type in expressions to have them evaluated. | |
| Type :help for more information. | |
| scala> import rapture.core._; import rapture.data._; import rapture.json._ | |
| import rapture.core._ | |
| import rapture.data._ | |
| import rapture.json._ | |
| scala> import jsonBackends.scalaJson._ | |
| import jsonBackends.scalaJson._ | |
| scala> json"""{ "foo": ["bar", "baz"] }""" match { case json"""{ "foo": ["bar", "baz"] }""" => "Matched!"; case _ => "No match!" } | |
| res0: String = Matched! | |
| scala> json"""{ "foo": ["bar", "baz"] }""" match { case json"""{ "foo": ["bar"] }""" => "Matched!"; case _ => "No match!" } | |
| res1: String = Matched! | |
| scala> json"""{ "foo": ["bar", "baz"] }""" match { case json"""{ }""" => "Matched!"; case _ => "No match!" } | |
| res2: String = Matched! | |
| scala> import patternMatching.exactArrays | |
| import patternMatching.exactArrays | |
| scala> json"""{ "foo": ["bar", "baz"] }""" match { case json"""{ "foo": ["bar"] }""" => "Matched!"; case _ => "No match!" } | |
| res3: String = No match! | |
| scala> import patternMatching.exactObjects | |
| import patternMatching.exactObjects | |
| scala> json"""{ "foo": ["bar", "baz"] }""" match { case json"""{ }""" => "Matched!"; case _ => "No match!" } | |
| res4: String = No match! | |
| scala> json"""{ "foo": ["bar", "baz"] }""" match { case json"""{ "foo": ["bar", "baz"] }""" => "Matched!"; case _ => "No match!" } | |
| res5: String = Matched! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment