Socket operations on Windows check errno instead of calling WSAGetLastError()
Winsock doesn't set errno, but it is checked in
blockingWriteRawBufferPtr (both are in
GHC.IO.FD). I the same thing happens in the non threaded RTS too, but that's in terms of primops and I don't understand it very well.
The upshot here is that every error message originating from Winsock is wrong. Nobody noticed since any error used to just crash your program (#12010 (closed)).
Here's some MinGW documentation http://oldwiki.mingw.org/index.php/sockets and something from MSDN https://msdn.microsoft.com/en-us/library/windows/desktop/ms740121%28v=vs.85%29.aspx