[Haskell-cafe] Re: Data.Binary and little endian encoding

Don Stewart dons at galois.com
Thu May 28 12:39:37 EDT 2009

> encode/decode do Big Endian, and 9P does little endian. 
> From the man page:
> "Each message consists of a sequence of bytes. Two , four , and eight byte
> fields hold unsigned integers represented in little endian order (least
> significant byte first)."
> encode/decode just won't work for me as a result, as they assume the
> not-so-aptly-named (at least in this case) "network" byte order.  Since I'm not
> Rob Pike, or Ken Thompson or any of the Plan 9 guys, I can't tell you why they
> chose little endian for this. 

I think you misunderstand the API: encode and decode *use whatever the
underlying instance for your data type uses*. If you write an instance
that uses the little endian primitives, that is what I will use.

-- Don

More information about the Haskell-Cafe mailing list