How haskell/network works
network is a Haskell library for creating and using network sockets. Its user-facing workflow is to resolve or construct an address, create and configure a socket, then exchange data through socket, Handle, or ByteString APIs. The tree also shows platform-specific POSIX and Windows support, ancillary-message handling, and STM operations. The README describes package support and coding conventions, not runtime wiring; most Haskell sources were not excerpted, so uncertain links are shown as unverified rather than asserted calls.
Main entry points: HsNet.h Native declarations · Socket.hs Socket operations · cmsg.c Control messages · MsgHdr.hsc POSIX messages
Components 21
Socket APIs
- Socket operations
Network/Socket.hs - Socket handles
Network/Socket/Handle.hs - Strict bytes
Network/Socket/ByteString/IO.hsc - Lazy bytes
Network/Socket/ByteString/Lazy.hs - STM operations
Network/Socket/STM.hs - Shutdown
Network/Socket/Shutdown.hs
Addressing
- Address types
Network/Socket/Address.hs - Socket addresses
Network/Socket/SockAddr.hs - Name services
Network/Socket/Name.hs - Interfaces
Network/Socket/If.hs
Platform Support
- Socket options
Network/Socket/Options.hsc - Unix sockets
Network/Socket/Unix.hsc - POSIX messages
Network/Socket/Posix/MsgHdr.hsc - Windows messages
Network/Socket/Win32/MsgHdr.hsc - Winsock setup
cbits/initWinSock.c
Native Interop
- Async accept shim
cbits/asyncAccept.c - Control messages
cbits/cmsg.c - Native declarations
include/HsNet.h - Platform definitions
include/HsNetDef.h - Unix compatibility
include/afunix_compat.h
Other components
- Haskell application
Connections 22
- Haskell application → Socket operations: uses
- Haskell application → Name services: resolves names
- Haskell application → Socket handles: uses
- Haskell application → Strict bytes: exchanges bytes
- Haskell application → Lazy bytes: exchanges bytes
- Haskell application → STM operations: uses
- Haskell application → Shutdown: shuts down
- Haskell application → Socket options: configures
- Haskell application → Interfaces: queries
- Haskell application → Unix sockets: uses
- Haskell application → POSIX messages: uses
- Haskell application → Windows messages: uses
- Address types → Socket addresses: uses
- Socket operations → Async accept shim: delegates
- Socket operations → Winsock setup: initializes
- POSIX messages → Control messages: uses
- Windows messages → Control messages: uses
- Native declarations → Platform definitions: includes
include/HsNet.h - Native declarations → Unix compatibility: includes
include/HsNet.h - Async accept shim → Native declarations: includes
cbits/asyncAccept.c - Control messages → Native declarations: includes
cbits/cmsg.c - Winsock setup → Native declarations: includes
cbits/initWinSock.c