Should inet_ntoa Be Pure?

Simon Marlow simonmar at microsoft.com
Mon May 9 06:45:55 EDT 2005


On 07 May 2005 11:59, Dominic Steinitz wrote:

> Does anyone know why these are in the IO monad? Aren't they pure
> functions converting between dotted-decimal strings and a 32-bit
> network byte ordered binary value?
> 
> Dominic.
> 
>
http://www.haskell.org/ghc/docs/latest/html/libraries/network/Network.So
cket.html#v%3Ainet_addr
>
http://www.haskell.org/ghc/docs/latest/html/libraries/network/Network.So
cket.html#v%3Ainet_ntoa

Clearly it should be pure.  To avoid breaking the interface, we could
add:

  showHostAddress :: HostAddress -> String

and deprecate inet_ntoa?

Cheers,
	Simon


More information about the Libraries mailing list