You can use the functionality in Data.IP[1] (from iproutes) to accomplish this. You'd first use `read` (or a safer version thereof, like Safe.readMay) to convert a String to an IPv4, and then toHostAddress to convert that to a HostAddress.

[1] http://hackage.haskell.org/package/iproute-1.2.11/docs/Data-IP.html


On Sun, Feb 2, 2014 at 11:01 PM, harry <voldermort@hotmail.com> wrote:
I need to convert a numeric IP (such as 1.2.3.4) to a HostAddress for
consumption by SockAddrInet. The only function I can find to do this is
inet_addr, which is impure (can do DNS lookups). Is there a pure conversion?

_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners