Browse Source

Generalized mapOverInput to work on IO

Marcos Dumay de Medeiros 8 years ago
parent
commit
658b670846
1 changed files with 2 additions and 1 deletions
  1. 2 1
      src/System/IO/Uniform/Targets.hs

+ 2 - 1
src/System/IO/Uniform/Targets.hs

@@ -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)