argonaut icon indicating copy to clipboard operation
argonaut copied to clipboard

.withNumber(_ + 10) broken in master

Open aryairani opened this issue 10 years ago • 2 comments

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"

aryairani avatar Jan 11 '15 02:01 aryairani

I'm thinking we might bin this example as it doesn't really apply to the current code.

seanparsons avatar Mar 15 '15 23:03 seanparsons

you can achieve the same result using with Prism, e.g.

jIntPrism.modify(_ + 10)(jNumber(10)) == jNumber(20)

julien-truffaut avatar Apr 01 '15 06:04 julien-truffaut