Open aryairani opened 9 years ago
The derivation provided by argonaut does seem work though, whereas I can't seem to get argonaut-shapeless's to:
implicit val encodeBar: EncodeJson[Bar] = EncodeJson.derive[Bar]
implicitly[EncodeJson[Bar]] // ok!
This is related to https://github.com/milessabin/shapeless/issues/309. Scalaz tagged types and shapeless records don't deal well together. https://github.com/milessabin/shapeless/issues/309 gives a workaround, which would involve writing alternatives to hconsEncodeJson
and hconsDecodeJson
methods specifically taillored for scalaz tagged types. It should be possible fto write these manually, and put them in scope when deriving these codecs.
I wonder if it’s any different with shapeless tags instead of scalaz tags. I’m not really tied to the latter. Won’t have a chance to give it a try until next week though.
I have an example where I can't derive an instance for a case class even though I do have instances for all the members of the case class:
above code is reproduced at http://scastie.org/12249