Repository navigation
Split platform code into Posix and Win32 modules - #647
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each platform defines the same functions in a module of its own, and Network.Socket.Buffer keeps their types and documentation, the argument checks, and a single conditional import. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The error guards, the readiness waits and withSocketsDo are defined per platform; Network.Socket.Internal keeps their documentation and what is shared. The POSIX definitions no longer sit under each other's types. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Preparing a new or an accepted socket, accepting, telling what a failed connect means, and reportConnReset are defined per platform; socket, bind, connect, listen and accept themselves stay shared. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The gathering writes of Network.Socket.ByteString with their foreign imports, Network.Socket.Fcntl, and socketPair. The lazy sendWith no longer goes its own way on Windows: that was for the MIO give-ups. c_recvmsg in Network.Socket.ByteString.Internal was unused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Network.Socket.ByteString.Lazy.Posix and .Windows become Network.Socket.Posix.ByteString.Lazy and Network.Socket.Win32.ByteString.Lazy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kazu-yamamoto
added a commit
that referenced
this pull request
Nov 15, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fewer
#if defined(mingw32_HOST_OS): where a module had POSIX and Windows versions of the same functions side by side, each platform now defines them inNetwork.Socket.Posix.*orNetwork.Socket.Win32.*, asCmsg,MsgHdrandHostNamealready did, and the shared module imports one of them under a single conditional. The conditionals onmingw32_HOST_OSgo from 90 to 36. No behaviour changes.Join two adjacent conditionals in
Network/Socket/ByteString/IO.hscinto one.Network.Socket.Buffer:sendBufTo,sendBuf,recvBufFrom,recvBuf,recvBufNoWaitOr,sendBufMsgandrecvBufMsgmove toPosix.BufferandWin32.Buffer.Network.Socket.Bufferkeeps their types and documentation, the length checks andrecvBufNoWait, and calls them qualified, so the documentation is not duplicated.Network.Socket.Internal: the error guards, the readiness waits andwithSocketsDomove toPosix.InternalandWin32.Internal, which also holds the Windows-only functions;Network.Socket.Internalkeeps the documentation and what is shared. On POSIX, two definitions used to sit under each other's type signatures; they no longer do.Network.Socket.Syscall: only the platform parts move (Posix.Syscall,Win32.Syscall): preparing a new or an accepted socket, accepting, telling what a failedconnectmeans, andreportConnReset.socket,bind,connect,listenandacceptstay shared.The rest: the gathering writes of
Network.Socket.ByteString(sendManyOnce, and onesendmsgforsendManyTo) with their foreign imports (Posix.ByteString,Win32.ByteString),Network.Socket.Fcntl(Posix.Fcntl,Win32.Fcntl), andsocketPair(Posix.Unix,Win32.Unix).Network.Socket.ByteString.Internalno longer has conditionals; its unusedc_recvmsgis gone. The lazysendWithno longer goes its own way on Windows: that was for the No IO Manager give-ups removed in Windows needs WinIO: remove the No IO Manager code #644.Network.Socket.ByteString.Lazy.Posixand.Windowsare renamedNetwork.Socket.Posix.ByteString.LazyandNetwork.Socket.Win32.ByteString.Lazy, like the other platform modules. Both are internal.What is left is either the base types (
Types,Cbits), imports of these modules, or a line or two inside shared code (Wait,STM,Info,Handle,Options).Each commit was built and tested on macOS (127 examples, 0 failures) and on Windows 11 with GHC 9.12.4.20260713 (124 examples, 0 failures), with no compiler warnings beyond those master already has.
🤖 Generated with Claude Code