[Haskell-cafe] The state of binary (de)serialization

Nicolas Trangez nicolas at incubaid.com
Mon Feb 25 13:30:40 CET 2013


All,

In order to implement some network protocol clients recently, I needed
binary serialization of commands and deserialization of responses
('Command -> ByteString' and 'ByteString -> Response' functions,
preferably for both strict as well as lazy ByteStrings).

My go-to packages have always been 'binary' and 'cereal', but I was
wondering about the current (and future) state/goals:

- cereal supports chunk-based 'partial' parsing (runGetPartial). It
looks like support for this is introduced in recent versions of 'binary'
as well (runGetIncremental)
- cereal can output a strict bytestring (runPut) or a lazy one
(runPutLazy), whilst binary only outputs lazy ones (runPut)
- Next to binary and cereal, there's bytestring's Builder interface for
serialization, and Simon Meier's "blaze-binary" prototype

There are some blog posts and comments out there about merging cereal
and binary, is this what's the goal/going on (cfr runGetIncremental)?

In my use-case I think using Builder instead of binary/cereal's PutM
monad shouldn't be a major problem. Is this advisable performance-wise?

Overall: what's the advised future-proof strategy of handling binary
(de)serialization?

Thanks,

Nicolas




More information about the Haskell-Cafe mailing list