argonaut
argonaut copied to clipboard
.withNumber(_ + 10) broken in master
This expression comes from the docs at http://argonaut.io/doc/json/
// v6.0.4
scala> jNumber(100).withNumber(_ + 10)
res0: argonaut.Json = 110
vs (depending on the exact revision)
scala> jNumber(100).withNumber(_ + 10)
<console>:20: error: type mismatch;
found : Int(10)
required: String
jNumber(100).get.withNumber(_ + 10)
or in versions where jNumber(100) returns Option[Json]:
scala> jNumber(100).get.withNumber(_ + 10)
<console>:20: error: type mismatch;
found : Int(10)
required: String
jNumber(100).get.withNumber(_ + 10)
git bisect says b405f239e66f15e84433d96bdfd0a386ac3a6e18 is the first bad commit: "Added JsonLong and JsonDouble cases for JsonNumber #116"
I'm thinking we might bin this example as it doesn't really apply to the current code.
you can achieve the same result using with Prism
, e.g.
jIntPrism.modify(_ + 10)(jNumber(10)) == jNumber(20)