Refactor ProtobufCodec
Currently the implementation of Transformer
(from scodec
, to allow .as[X]
syntax as well as .exmap
and friends is very clunky - you create a new class ProtobufCodec(_, _, _)
, but have to override the decode/encode members (see invariantInstance
in companion). This is very counter-intuitive and has lead to bugs, for instance, previously this lead to missing error context, and this was very hard to track down.
One of the reasons it's implemented as a class is to allow payload
argument to be by-name, to allow lazy, recursive, structures.
But worth investigating if it can be simplified somehow.