Don't get me wrong -- the socket support is pretty decent, but there are also some weird idiosyncrasies, for example requiring that the PortNum is specified in network byte order and lacking a function to convert host->network byte order (hton).

PortNum is indeed strange, but it does allow yo to specify the
value in your local endian without swapping:

   > print (toEnum 0x0102 :: PortNumber)
   258

what is misleading you is that the obvious construction doesn't:

   > print (PortNum 0x0102)
   513

I'm suprised htonl comes up so often. You can unmarshall data directly from a byte stream to an Int type without caring about the underlying representation of your Int. Why do people want the htonl function?

Bardur Arantsson

Tim Newsham
http://www.thenewsh.com/~newsham/
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to