Peter Simons <[EMAIL PROTECTED]> writes: > Judging from a quick glance, the code seems to marshal the > POSIX API: > > type SockAddrLen = Int > data SockAddrT > type SockAddr = ForeignPtr SockAddrT > data SocketAddress = SA !SockAddr !SockAddrLen > > I'm not sure whether that's a useful representation. It > works, of course, but it appears that an address is > essentially opaque (unless you want to do more FFI things). > It doesn't really unify different types of network addresses > either. Note, for example, that you can't pass such an > address to the 'connectTCP' function.
That is one of the few working representations. The user of the library is not aware how the socket addresses are represented internally, so it is not a problem. Lifting the information to Haskell level seems quite pointless, as it is usually just fed back to the C functions. Also IPv6 addresses sometimes need scopes - lifting this would make things even more messy. The current way is to ignore adress families as much as possible while still supporting multiple ones. E.g. the following works with both IPv4 and IPv6 in network-alt: googleMainPage = do h <- connectTCP "www.google.com" "http" hPutStr h "GET / HTTP/1.0\r\n\r\n" hFlush h hGetContents h >>= print hClose h - Einar Karttunen _______________________________________________ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell