0

Working with the Play Framework's JSON Library, I'm creating a Format[T] for some class T.

val a: JsPath = (JsPath \ "age")
val b: Format[Int] = (JsPath \ "age").format[Int]
val x: FunctionalBuilder[OFormat]#CanBuild2[Int, String] = ( 
           (JsPath \ "age").format[Int] and 
           (JsPath \ "location").format[String]
       )

Looking at the explicit types, we see that (in x) calling Format[Int] and Format[String] returns a type of FunctionalBuilder[OFormat]#CanBuild2[Int, String].

How does this conversion occur in the Play Framework JSON Library source?

3
  • possible duplicate of Syntax and meaning of a Scala/Play! code sample Commented Feb 23, 2014 at 5:46
  • try val r1 = (JsPath \ "age").format[Int]; val r2 = (JsPath \ "location").format[String]; import scala.reflect.runtime.{universe => u}; u.show{ u.reify{ r1 and r2 }.tree }. Commented Feb 23, 2014 at 5:48
  • thanks, @senia. I voted to close given that you already answered it at the above link. Commented Feb 24, 2014 at 13:26

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.