On 10/3/05, Udo Stenzel <u.stenzel@web.de> wrote:
Joel Reymont wrote:
> Are there any endian conversion routines for Haskell? I'm looking to
> build binary packets on top of NewBinary.Binary but my data is coming
> in little-endian whereas I'll need to send it out big endian.

Why don't you pull out 4 bytes and assemble them manually?  Three
shifts, logical ors and fromIntegrals aren't that much of a burden after
all.

Exactly! Network encodings for integers are precisely, mathematically
defined. Surprisingly, it is very difficult to see (it was a revelation for me
too). Perhaps the reason is that people get used to the mess in C
networking code.

Best regards
Tomasz