[Haskell] Re: Should inet_ntoa Be Pure?

Peter Simons simons at cryp.to
Mon May 9 11:47:26 EDT 2005


Dominic Steinitz writes:

 > inet_addr' :: (Octet,Octet,Octet,Octet) -> HostAddress
 > inet_ntoa' :: HostAddress -> (Octet,Octet,Octet,Octet)
 >
 > I see Peter Simons has already written something:
 >
 > http://cryp.to/hsdns/docs/Network.IP.Address.html#v%3Aha2tpl

As usual, I didn't write as much as I would have liked, and
I really don't know whether to place a ':-)' or a ':-('
after that statement.

Anyway, in my humble opinion aiming for better IPv4 address
support would be aiming too low in this day and age.
HostAddress really ought to be an abstract data type which
represents a "network address" in general. We have quite a
few of them already: there is HostAddress, SockAddr, and
PortID; and each of them may represent the exact same thing
or an entirely different thing, depending on how it was
initialized. Consequently, we have all kinds of variants in
the API too: connectTo vs. connect, Network.accept vs.
Network.Socket.accept, listen vs. listenOn, etc.

Considering that as of today _none_ of these variations has
the slightest idea what IPv6 is, it might be worth trying to
unify that.

I would be curious to know how other programming languages
have solved this problem. C's solution is the one we all
know and love, and C++ added pretty much nothing to that in
the last 10 years or so. How about others?

Peter



More information about the Haskell mailing list