On Thu, Jan 08, 2009 at 10:37:55PM +0100, Bardur Arantsson wrote:
> 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).
Look at Haddock for PortNumber:
newtype PortNumber
Constructors
PortNum Word16
Instances
Enum PortNumber
Eq PortNumber
Integral PortNumber
Num PortNumber
Ord PortNumber
Real PortNumber
Show PortNumber
Typeable PortNumber
Storable PortNumber
Try it in ghci:
Prelude Network.Socket> 15 :: PortNumber
15
Prelude Network.Socket> PortNum 15
3840
Prelude Network.Socket> (fromIntegral (15::Int))::PortNumber
15
So, in essence, there are *many* functions that let you do this. You
should not be needing to construct PortNum by hand.
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe