@@ -61,13 +61,13 @@ module Streamly.FileSystem.Handle
6161 -- , readUtf8
6262 -- , readLines
6363 -- , readFrames
64− , readByChunksUpto
64+ , readInChunksOf
6565
6666 -- -- * Array Read
6767 -- , readArrayUpto
6868 -- , readArrayOf
6969
70− , readArraysOfUpto
70+ , readArraysOf
7171 -- , readArraysOf
7272 , readArrays
7373
@@ -81,7 +81,7 @@ module Streamly.FileSystem.Handle
8181 -- , writeUtf8
8282 -- , writeUtf8ByLines
8383 -- , writeByFrames
84− , writeByChunksOf
84+ , writeInChunksOf
8585
8686 -- -- * Array Write
8787 , writeArray
@@ -187,13 +187,13 @@ writeArray h Array{..} = withForeignPtr aStart $ \p -> hPutBuf h p aLen
187187-- Stream of Arrays IO
188188-------------------------------------------------------------------------------
189189
190−-- | @readArraysOfUpto size h@ reads a stream of arrays from file handle @h@.
190+-- | @readArraysOf size h@ reads a stream of arrays from file handle @h@.
191191-- The maximum size of a single array is specified by @size@. The actual size
192192-- read may be less than or equal to @size@.
193−{-# INLINABLE _readArraysOfUpto #-}
194−_readArraysOfUpto :: (IsStream t, MonadIO m)
193+{-# INLINABLE _readArraysOf #-}
194+_readArraysOf :: (IsStream t, MonadIO m)
195195 => Int -> Handle -> t m (Array Word8)
196−_readArraysOfUpto size h = go
196+_readArraysOf size h = go
197197 where
198198 -- XXX use cons/nil instead
199199 go = mkStream $ \_ yld _ stp -> do
@@ -202,13 +202,14 @@ _readArraysOfUpto size h = go
202202 then stp
203203 else yld arr go
204204
205−-- | @readArraysOfUpto size handle@ reads a stream of arrays from the file
205+-- | @readArraysOf size handle@ reads a stream of arrays from the file
206206-- handle @handle@. The maximum size of a single array is limited to @size@.
207+-- The actual size read may be less than or equal to @size@.
207208--
208209-- @since 0.7.0
209−{-# INLINE_NORMAL readArraysOfUpto #-}
210−readArraysOfUpto :: (IsStream t, MonadIO m) => Int -> Handle -> t m (Array Word8)
211−readArraysOfUpto size h = D.fromStreamD (D.Stream step ())
210+{-# INLINE_NORMAL readArraysOf #-}
211+readArraysOf :: (IsStream t, MonadIO m) => Int -> Handle -> t m (Array Word8)
212+readArraysOf size h = D.fromStreamD (D.Stream step ())
212213 where
213214 {-# INLINE_LATE step #-}
214215 step _ _ = do
@@ -222,14 +223,15 @@ readArraysOfUpto size h = D.fromStreamD (D.Stream step ())
222223--
223224-- | @readArrays handle@ reads a stream of arrays from the specified file
224225-- handle. The maximum size of a single array is limited to
226+-- @defaultChunkSize@. The actual size read may be less than or equal to
225227-- @defaultChunkSize@.
226228--
227−-- > readArrays = readArraysOfUpto defaultChunkSize
229+-- > readArrays = readArraysOf defaultChunkSize
228230--
229231-- @since 0.7.0
230232{-# INLINE readArrays #-}
231233readArrays :: (IsStream t, MonadIO m) => Handle -> t m (Array Word8)
232−readArrays = readArraysOfUpto defaultChunkSize
234+readArrays = readArraysOf defaultChunkSize
233235
234236-------------------------------------------------------------------------------
235237-- Read File to Stream
@@ -239,13 +241,13 @@ readArrays = readArraysOfUpto defaultChunkSize
239241-- read requests at the same time. For serial case we can use async IO. We can
240242-- also control the read throughput in mbps or IOPS.
241243
242−-- | @readByChunksUpto chunkSize handle@ reads a byte stream from a file
244+-- | @readInChunksOf chunkSize handle@ reads a byte stream from a file
243245-- handle, reads are performed in chunks of up to @chunkSize@.
244246--
245247-- @since 0.7.0
246−{-# INLINE readByChunksUpto #-}
247−readByChunksUpto :: (IsStream t, MonadIO m) => Int -> Handle -> t m Word8
248−readByChunksUpto chunkSize h = AS.flatten $ readArraysOfUpto chunkSize h
248+{-# INLINE readInChunksOf #-}
249+readInChunksOf :: (IsStream t, MonadIO m) => Int -> Handle -> t m Word8
250+readInChunksOf chunkSize h = AS.flatten $ readArraysOf chunkSize h
249251
250252-- TODO
251253-- Generate a stream of elements of the given type from a file 'Handle'.
@@ -289,16 +291,16 @@ writeArraysPackedUpto n h xs = writeArrays h $ AS.compact n xs
289291-- do not want buffering to occur at GHC level as well. Same thing applies to
290292-- writes as well.
291293
292−-- | @writeByChunksOf chunkSize handle stream@ writes @stream@ to @handle@ in
294+-- | @writeInChunksOf chunkSize handle stream@ writes @stream@ to @handle@ in
293295-- chunks of @chunkSize@. A write is performed to the IO device as soon as we
294296-- collect the required input size.
295297--
296298-- @since 0.7.0
297−{-# INLINE writeByChunksOf #-}
298−writeByChunksOf :: MonadIO m => Int -> Handle -> SerialT m Word8 -> m ()
299−writeByChunksOf n h m = writeArrays h $ AS.arraysOf n m
299+{-# INLINE writeInChunksOf #-}
300+writeInChunksOf :: MonadIO m => Int -> Handle -> SerialT m Word8 -> m ()
301+writeInChunksOf n h m = writeArrays h $ AS.arraysOf n m
300302
301−-- > write = 'writeByChunksOf' A.defaultChunkSize
303+-- > write = 'writeInChunksOf' A.defaultChunkSize
302304--
303305-- | Write a byte stream to a file handle. Combines the bytes in chunks of
304306-- up to 'A.defaultChunkSize' before writing.
@@ -306,7 +308,7 @@ writeByChunksOf n h m = writeArrays h $ AS.arraysOf n m
306308-- @since 0.7.0
307309{-# INLINE write #-}
308310write :: MonadIO m => Handle -> SerialT m Word8 -> m ()
309−write = writeByChunksOf defaultChunkSize
311+write = writeInChunksOf defaultChunkSize
310312
311313{-
312314{-# INLINE write #-}