[Haskell-cafe] how to listen on a specific IP using the network library

Alexander Solla ajs at 2piix.com
Tue Mar 16 04:04:01 EDT 2010


On Mar 15, 2010, at 12:09 PM, Jeremy Shaw wrote:

> In happstack we use a really horrible trick involving template  
> haskell where we see if the  SockAddrInet6 constructor exists at  
> compile time and conditionally compile different versions of the  
> code that way. But it is really ugly.

Maybe a simpler code generator would be a better fit, since this task  
isn't really parametrized over types?  I'm not familiar with cabal  
really -- can you drop down to bash?  Can you run an arbitrary  
program?  Or at least one in the cwd?  Or at the very least, one you  
just built?  If so, a simple bash script (or Haskell program) can emit  
valid Haskell to compile.  It can (potentially) be as simple as  
concatenating your IPv6 instances/data to the end of the "default"  
IPv4 code.


More information about the Haskell-Cafe mailing list