[Haskell-cafe] Endian conversion

Marc Ziegert coeus at gmx.de
Mon Oct 3 05:54:19 EDT 2005


for just making IO and a little bit-conversion, i would use c++ or even c. for such a problem you have to be near the machine, not necessarily near mathematical abstraction.
there exist assembler-commands to flip endians of register-values, so i would just search in /usr/include/*/* for a platform independent c-function, and either pipe a proxy through such a little prog, or patch an existing proxy, like "tinyproxy".
of course, if you want to make more than just a proxy, or if you want to play with different languages, be welcome to use haskell. but remind, it is not easy to use high-developed-mars-rover-technology to replace a shovel for playing with sand at the beach.

- marc

Joel Reymont wrote:
> Well, I'm looking for suggestions on how to implement this. I'll  
> basically get a chunk of data from the socket that will have things  
> little-endian and will need to send out a chunk that will have the  
> numbers big-endian.
> 
> This is a proxy server that does binary protocol conversion. It's a  
> breeze to implement in Erlang but I'm partial to Haskell and trying  
> to apply it to all sorts of problems. Please, let me know if this is  
> not the type of problem to apply Haskell to ;-).
> 
>      Thanks, Joel
> 
> On Oct 3, 2005, at 8:35 AM, Tomasz Zielonka wrote:
> 
> > Having htonl/ntohl as pure functions in Haskell would be a bit  
> > ugly, because
> > they would be defined differently on different platforms, and  
> > putting them in the
> > IO monad would make them barely usable.
> 
> --
> http://wagerlabs.com/idealab
> 
> 
> 
> 
> 
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
> 



More information about the Haskell-Cafe mailing list