
On Fri, Apr 29, 2011 at 10:25 AM, Evan Laforge
Indeed, and I was starting to do that... well, I would make my own project specific Serialize class, since the type dispatch is useful. But copy pasting a UTF8 encoder, or the variable length Integer encoder, or whatever seemed kinda unpleasant. Surely we could expose that stuff in a library, whose explicit goal was that they *would* remain compatible ways to serialize various basic types, and then just reuse those functions? E.g. that is already done for words with the putWordN{be,le} functions, and is available separately for UTF8.
I intend to add support for different UTF encodings to Data.Binary.Builder for this very reason. I also intend to add two functions to Data.Binary.Builder.Internal that lets you implement variable length encoding as efficiently as possible. I'm a bit skeptical of adding builders for different variable length encodings to the library, simply because there are so many possibilities. I think creating a binary-vle (for variable length encoding) package would be worthwhile. I have an implementation of the VLE used in protocol buffers. Johan