|
@@ -304,13 +304,14 @@ closePort p = c_closePort (lis p)
|
|
|
-- where a(0) = initial and the last value after io reaches EOF is returned.
|
|
|
--
|
|
|
-- Notice that the length of read_data might not be equal block_size.
|
|
|
-mapOverInput :: UniformIO io => io -> Int -> (a -> ByteString -> a) -> a -> IO a
|
|
|
+mapOverInput :: UniformIO io => io -> Int -> (a -> ByteString -> IO a) -> a -> IO a
|
|
|
mapOverInput io block f initial = do
|
|
|
a <- tryIOError $ uRead io block
|
|
|
case a of
|
|
|
Left e -> if isEOFError e then return initial else throw e -- EOF
|
|
|
Right dt -> mapOverInput io block f (f initial dt)
|
|
|
|
|
|
+
|
|
|
foreign import ccall interruptible "getPort" c_getPort :: CInt -> IO (Ptr Nethandler)
|
|
|
foreign import ccall interruptible "createFromHandler" c_accept :: Ptr Nethandler -> IO (Ptr Ds)
|
|
|
foreign import ccall safe "createFromFileName" c_createFile :: CString -> IO (Ptr Ds)
|