[Haskell-cafe] binary IO
joelr1 at gmail.com
Tue Dec 27 03:37:27 EST 2005
This is what I spent the past 3 months on. Pickling code that
interoperates with a C++ server that sends things to me little-
endian. And sends other wierd data like unicode strings that are zero-
SerTH does not handle things like that since it cannot divine the
wire format for you. I used the pickler combinators approach which
worked great in theory since I could specify the wire format and have
a single spec for pickling and unpickling. In practice this turned
out to be too slow and I still don't know why.
I'm still waiting to see how this should really be done.
On Dec 27, 2005, at 7:35 AM, Jeremy Shaw wrote:
> There is one important difference in my mind. Most of the pickling
> is concerned with turning haskell data into a binary stream that can
> later be turned back into haskell data. There is no interoperability
> required -- the thing that writes it is the thing that will read it.
> For parsing arbitrary binary data formats a few other important
> issues arise that you can sometimes forget about with pickling such
> ~ byte-alignment
> ~ big-endian vs little endian
> ~ size of data types (for example is Char one byte or four)
> ~ bitwise parsing
> Both pickling and binary format parsing can be built on the same
> underlying low-level binary access methods.
More information about the Haskell-Cafe