<div dir="ltr">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.<div>

<br></div><div>[1] <a href="http://hackage.haskell.org/package/iproute-1.2.11/docs/Data-IP.html">http://hackage.haskell.org/package/iproute-1.2.11/docs/Data-IP.html</a></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">

On Sun, Feb 2, 2014 at 11:01 PM, harry <span dir="ltr"><<a href="mailto:voldermort@hotmail.com" target="_blank">voldermort@hotmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

I need to convert a numeric IP (such as 1.2.3.4) to a HostAddress for<br>
consumption by SockAddrInet. The only function I can find to do this is<br>
inet_addr, which is impure (can do DNS lookups). Is there a pure conversion?<br>
<br>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/mailman/listinfo/beginners</a><br>
</blockquote></div><br></div>