Non-exhaustive pattern in Socket.hsc

Ashley Yakeley ashley at semantic.org
Tue May 2 16:05:45 EDT 2006


Dominic Steinitz wrote:

> data Family
>   = AF_UNSPEC
>     | AF_UNIX
>     | AF_INET
>     | AF_INET6
>     | AF_SNA
>     | AF_DECnet
>     | AF_APPLETALK
>     | AF_ROUTE
>     | AF_X25
>     | AF_AX25
>     | AF_IPX
>         -- Imported from Network.Socket

> What is the long term plan for Network anyway?

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

etc.

-- 
Ashley Yakeley, Seattle WA
WWEWDD? http://www.cs.utexas.edu/users/EWD/



More information about the Libraries mailing list