[Haskell-cafe] Re: [Haskell] ANNOUNCE: binary: high performance, pure binary serialisation

Donald Bruce Stewart dons at cse.unsw.edu.au
Thu Jan 25 22:39:18 EST 2007

> On Thu, Jan 25, 2007 at 07:11:55PM -0800, John Meacham wrote:
> > Is the binary format portable? I need the produced files to work on both
> > 32 and 64 bit architectures and with big and little endian machines. And
> > of course, between different versions of a compiler or different
> > compilers.
> Sorry to reply to myself, looking at the code, I see that it is.
> however, Ints appear to be stored as 64 bits always, this seems like a
> mistake. The Haskell standard only specifies Ints must have at least 30
> bits of precision so programs that rely on more than that are not
> portable anyway. Plus, it is unlikely that any compilers ever will have
> Ints > 32 bits, ghc does at the moment by accident of design and it is
> considered a misfeature that will be fixed at some point. It would be an
> ugly wart to be stuck with going forward...

This was perhaps the only issue of contention during development. It was
felt that those wishing to serialise precisely would use an explicit
word sized type, such as Int64 or Word32, and that having things work
correctly on ghc/amd64 right now was critical.

If the Int/Int64 issue is resolved in the future, we can revisit this.
Its fairly painless to upgrade files from one version of a Binary
instance to another too (you just read in using the old 'get' method,
and write back out using the new 'put' method).

-- Don

More information about the Haskell-Cafe mailing list