@@ -17,7 +17,12 @@ import Foreign.C.Types
1717import Foreign.ForeignPtr (withForeignPtr)
1818import Foreign.Ptr (Ptr, castPtr, plusPtr)
1919import GHC.Conc (threadWaitRead)
20−import Network.Socket (Socket, fdSocket)
20+import Network.Socket (Socket)
21+#if MIN_VERSION_network(3,1,0)
22+import Network.Socket (withFdSocket)
23+#else
24+import Network.Socket (fdSocket)
25+#endif
2126import System.Posix.Types (Fd(..))
2227
2328import Network.Wai.Handler.Warp.Buffer
@@ -91,7 +96,9 @@ spell init0 siz0 recv recvBuf
9196
9297receive :: Socket -> BufferPool -> Recv
9398receive sock pool = withBufferPool pool $ \ (ptr, size) -> do
94−#if MIN_VERSION_network(3,0,0)
99+#if MIN_VERSION_network(3,1,0)
100+ withFdSocket sock $ \fd -> do
101+#elif MIN_VERSION_network(3,0,0)
95102 fd <- fdSocket sock
96103#else
97104 let fd = fdSocket sock
@@ -101,7 +108,9 @@ receive sock pool = withBufferPool pool $ \ (ptr, size) -> do
101108
102109receiveBuf :: Socket -> RecvBuf
103110receiveBuf sock buf0 siz0 = do
104−#if MIN_VERSION_network(3,0,0)
111+#if MIN_VERSION_network(3,1,0)
112+ withFdSocket sock $ \fd -> do
113+#elif MIN_VERSION_network(3,0,0)
105114 fd <- fdSocket sock
106115#else
107116 let fd = fdSocket sock