I'm starting to play with Scala and while doing some examples from play framework page, I've found problem which I can't resolve. I'm pretty new in Scala so I please to be forgiving.
Why this one compiles without errors:
case class Location(lat: Double, long: Double)
implicit val locationReads: Reads[Location] = (
(JsPath \ "lat").read[Double] and
(JsPath \ "long").read[Double]
)(Location.apply _)
but this one won't compile:
case class Location(lat: Double)
implicit val locationReads: Reads[Location] = (
(JsPath \ "lat").read[Double]
)(Location.apply _)
and displaying error:
overloaded method value read with alternatives: [error] (t: Double)play.api.libs.json.Reads[Double] [error] (implicit r: play.api.libs.json.Reads[Double])play.api.libs.json.Reads[Double] [error] cannot be applied to (Double => biz.JsonProtocol.Location) [error] (JsPath \ "lat").read[Double]