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
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> System.getProperty("user.timezone") | |
res0: String = "" | |
scala> new java.util.Date() | |
res1: java.util.Date = Mon May 12 12:49:35 CEST 2014 |
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
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._ |
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> import formatters.humanReadable | |
import formatters.humanReadable | |
scala> Json.format(json"""{ "foo": ["bar", "baz", 42] }""") | |
res0: String = | |
{ | |
"foo": [ | |
"bar", | |
"baz", | |
42 |
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
Welcome to Scala version 2.10.4 (OpenJDK 64-Bit Server VM, Java 1.6.0_27). | |
Type in expressions to have them evaluated. | |
Type :help for more information. | |
scala> import rapture.json._ | |
import rapture.json._ | |
scala> import jsonBackends.scalaJson._ | |
import jsonBackends.scalaJson._ |
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> case class Bar(file: java.io.File) // We can't extract a File | |
defined class Bar | |
scala> case class Foo(bar: Bar) // therefore we can't extract a Bar | |
defined class Foo | |
scala> json""{ "bar": { "file": "..." } }""".as[Foo] | |
Could not generate a Json extractor for case class Bar because a Json extractor for parameter `file' of type java.io.File could not be found | |
Could not generate a Json extractor for case class Foo because a Json extractor for parameter `bar' of type Bar could not be found | |
<console>:21: error: cannot extract type Foo from rapture.json.Json. |
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
> sbt benchmark/run | |
<snip> | |
[info] Compiling 4 Scala sources to /home/jpretty/dev/github.com/non/jawn/benchmark/target/scala-2.11/classes... | |
[error] /home/jpretty/dev/github.com/non/jawn/benchmark/src/main/scala/jawn/Parboiled.scala:27: reference to ParserInput is ambiguous; | |
[error] it is imported twice in the same scope by | |
[error] import spray.json._ | |
[error] and import org.parboiled2._ | |
[error] class ParboiledParser(val input: ParserInput) extends Parser with StringBuilding { |
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
package interpolate | |
import rapture.json._ | |
import jsonBackends.jawn._ | |
object Interpolation { | |
case class Forced(json: Json) | |
implicit def toForced[T: JsonSerializer](t: T): Forced = Forced(Json(t)) |
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
case class Instantiator[T]() | |
def instantiate[T](implicit inst: Instantiator[T]): T = null.asInstanceOf[T] | |
val x: String = instantiate | |
// error: could not find implicit for Instantiator[T] | |
implicit def inst1: Instantiator[String] = Instantiator[String] | |
implicit def inst2: Instantiator[Int] = Instantiator[Int] | |
val x: String = instantiate | |
// error: ambiguous implicits |
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
Welcome to Scala version 2.10.4 (OpenJDK 64-Bit Server VM, Java 1.6.0_27). | |
Type in expressions to have them evaluated. | |
Type :help for more information. | |
scala> import rapture.core._ | |
import rapture.core._ | |
scala> List.strap(1, Some(2), None) | |
res0: List[Int] = List(1, 2) |
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
Welcome to Scala version 2.11.4 (OpenJDK 64-Bit Server VM, Java 1.6.0_27). | |
Type in expressions to have them evaluated. | |
Type :help for more information. | |
scala> case class Foo[T](name: String) | |
defined class Foo | |
scala> implicit val stringFoo = Foo[String]("String") | |
stringFoo: Foo[String] = Foo(String) |
OlderNewer