I am trying to better understand the design decision made in the network library. Reputation sources mention in the github question and the mailing list answer that network uses non-blocking sockets. Instead of using the default locking behavior, they use select to lock until the socket is ready to read. Why is it better? In any case, it ends with a lock, and network provides only a blocking API for end users. I assume this is bad for calling FFI to lock and that there is some kind of GHC magic around select , but I couldn’t confirm this.
As a secondary, I cannot find where select in the network call. Code base grabbing failed. I just discovered GHC.Event , which seems to provide functions that will be used instead of directly calling select , but grepping shows network does not use this.
haskell ghc
Andrew Thaddeus Martin
source share