Non-exhaustive pattern in Socket.hsc

Einar Karttunen ekarttun at cs.helsinki.fi
Wed May 3 05:34:35 EDT 2006


On 02.05 13:05, Ashley Yakeley wrote:
> That's a good question. C/C++ uses this address-family-based approach to 
> handle different protocols, but I think Haskell would do better with a 
> static approach that typed sockets by network. For instance:
> 
>   newtype IP4Address = IP4Address Word32
>   newtype IP6Address = IP6Address Word128
> 
>   openTCP4 :: IP4Address -> Word16 -> IO (TCPConnection IP4Address)
>     -- or use classes

This is going to be painfull for applications that want to support
multiple protocols. Why should most applications care whether
it is an IPv4 or an IPv6 address if everything just works?

Of course one can force the app to just use a specific address family,
but is that required most of the time?

- Einar Karttunen


More information about the Libraries mailing list