alphaHeavy / protobuf

An implementation of Google's Protocol Buffers in Haskell.
http://hackage.haskell.org/package/protobuf
BSD 3-Clause "New" or "Revised" License
96 stars 18 forks source link

Applying type approach to other encodings? #28

Closed istathar closed 6 years ago

istathar commented 8 years ago

Off topic: do you think the approach used in this library would be suitable for managing describing formats to be encoded with CBOR? If you look at Duncan et al's work on a new binary using cbor in the back-end binary-serialize-cbor they mention that no work has been done on specifying arbitrary formats. Could your type description techniques be used?

NathanHowell commented 8 years ago

From a quick scan through the CBOR spec, it looks like it would work as-is (more or less) for a subset of CBOR. The complication would be for types that are not naturally key/value pairs like the encoding used by Protocol Buffers. Do you have any thoughts on the matter?

istathar commented 8 years ago

@NathanHowell from what I can see, Duncan's work is heavily focused on serializing Haskell data types in a custom way, ie, some tags for which constructor in a type was used, etc. But CBOR by itself seems pretty awesome at short numbers, etc; ie, it exposes the wire encoding which was an implementation detail in protobuf. Anyway, just food for thought.

AfC