awakesecurity / proto3-suite

Haskell Protobuf Implementation
https://hackage.haskell.org/package/proto3-suite
Other
81 stars 56 forks source link

Support unrecognized enum codes and delegate to a polymorphic wrapper type for wrapped fields #203

Closed j6carey closed 2 years ago

j6carey commented 2 years ago

...instead of delegating to code generated from the .proto definitions of the standard Google protobuf wrapper types.

By avoiding delegation to wrapper implementations generated from .proto definitions we avoid the need to generate such implementations and link against them.

More importantly, by coercing between "Maybe Text" and a polymorphic wrapper instead of a single fixed Haskell representation of "StringValue", we enable a future per-module choice between strict and lazy "Text" types, rather than restricting ourselves to a uniform decision. In fact, "Text" could be replaced by any string type that provides the required type class instances for protobuf serialization. The same could be done for "BytesValue".

Supporting changes:

Changes we could perhaps postpone, but seem natural in this context: