[Haskell-cafe] Re: Haskell not ready for Foo [was: Re: Hypothetical Haskell job in New York]

Tim Newsham newsham at lava.net
Fri Jan 9 20:51:55 EST 2009


> 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/


More information about the Haskell-Cafe mailing list