Override mapJson in CodecJson
enzief opened this issue · 2 comments
enzief commented
Does it make sense to
sealed abstract class CodecJson[A] ... {
override def mapJson(f: Json => Json): CodecJson[A] =
CodecJson.derived(
Encoder.mapJson(f),
Decoder
)
}
?
seanparsons commented
Surely it would need an inverse for the decoder?
enzief commented
Right. As there's no contramapJson
for Decoder
would it be correct to add
trait Decoder[A] {
def contramapJson(f: Json => Json): Decoder[A] // not sure about this signature
}
abstract class CodecJson[A] {
def xmapJson(f: Json => Json): CodecJson[A]
}