json - Encoding/Decode shapeless records with circe -


upgrading circe 0.4.1 0.7.0 broke following code:

import shapeless._ import syntax.singleton._ import io.circe.generic.auto._  .run[record.`'transaction_id -> int`.t](transport)  def run[a](transport: json => future[json])(implicit decoder: decoder[a], exec: executioncontext): future[a] 

with following error:

 not find implicit value parameter decoder: io.circe.decoder[shapeless.::[int shapeless.labelled.keytag[symbol shapeless.tag.tagged[string("transaction_id")],int],shapeless.hnil]] [error]       .run[record.`'transaction_id -> int`.t](transport) [error]                                              ^ 

am missing import here or these encoders/decoders not available in circe anymore?

instances shapeless's hlists, records, etc. moved separate circe-shapes module in circe 0.6.0 release. if add module build, following should work:

import io.circe.jawn.decode, io.circe.shapes._ import shapeless._, record.record, syntax.singleton._  val doc = """{ "transaction_id": 1 }"""  val res = decode[record.`'transaction_id -> int`.t](doc) 

the motivation moving these instances improved generic derivation introduced in 0.6 meant no longer necessary, , keeping them out of implicit scope when they're not needed both cleaner , potentially supports faster compile times. new circe-shapes module includes features not available in circe-generic, such instances coproducts.


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -