@@ -67,7 +67,7 @@ module Streamly.FileSystem.Handle
67 -- , readArrayUpto
67 -- , readArrayUpto
68 -- , readArrayOf
68 -- , readArrayOf
70− , readArraysOfUpto
70+ , readArraysOf
71 -- , readArraysOf
71 -- , readArraysOf
72 , readArrays
72 , readArrays
@@ -187,13 +187,13 @@ writeArray h Array{..} = withForeignPtr aStart $ \p -> hPutBuf h p aLen
187-- Stream of Arrays IO
187-- Stream of Arrays IO
188-------------------------------------------------------------------------------
188-------------------------------------------------------------------------------
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@.
191-- The maximum size of a single array is specified by @size@. The actual size
191-- The maximum size of a single array is specified by @size@. The actual size
192-- read may be less than or equal to @size@.
192-- read may be less than or equal to @size@.
193−{-# INLINABLE _readArraysOfUpto #-}
193+{-# INLINABLE _readArraysOf #-}
194−_readArraysOfUpto :: (IsStream t, MonadIO m)
194+_readArraysOf :: (IsStream t, MonadIO m)
195 => Int -> Handle -> t m (Array Word8)
195 => Int -> Handle -> t m (Array Word8)
196−_readArraysOfUpto size h = go
196+_readArraysOf size h = go
198 -- XXX use cons/nil instead
198 -- XXX use cons/nil instead
199 go = mkStream $ \_ yld _ stp -> do
199 go = mkStream $ \_ yld _ stp -> do
@@ -202,13 +202,14 @@ _readArraysOfUpto size h = go
203 else yld arr go
203 else yld arr go
205−-- | @readArraysOfUpto size handle@ reads a stream of arrays from the file
205+-- | @readArraysOf size handle@ reads a stream of arrays from the file
206-- handle @handle@. The maximum size of a single array is limited to @size@.
206-- 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@.
208-- @since 0.7.0
209-- @since 0.7.0
209−{-# INLINE_NORMAL readArraysOfUpto #-}
210+{-# INLINE_NORMAL readArraysOf #-}
210−readArraysOfUpto :: (IsStream t, MonadIO m) => Int -> Handle -> t m (Array Word8)
211+readArraysOf :: (IsStream t, MonadIO m) => Int -> Handle -> t m (Array Word8)
211−readArraysOfUpto size h = D.fromStreamD (D.Stream step ())
212+readArraysOf size h = D.fromStreamD (D.Stream step ())
213 {-# INLINE_LATE step #-}
214 {-# INLINE_LATE step #-}
214 step _ _ = do
215 step _ _ = do
@@ -222,14 +223,15 @@ readArraysOfUpto size h = D.fromStreamD (D.Stream step ())
223-- | @readArrays handle@ reads a stream of arrays from the specified file
224-- | @readArrays handle@ reads a stream of arrays from the specified file
224-- handle. The maximum size of a single array is limited to
225-- handle. The maximum size of a single array is limited to
226+-- @defaultChunkSize@. The actual size read may be less than or equal to
225-- @defaultChunkSize@.
227-- @defaultChunkSize@.
227−-- > readArrays = readArraysOfUpto defaultChunkSize
229+-- > readArrays = readArraysOf defaultChunkSize
229-- @since 0.7.0
231-- @since 0.7.0
230{-# INLINE readArrays #-}
232{-# INLINE readArrays #-}
231readArrays :: (IsStream t, MonadIO m) => Handle -> t m (Array Word8)
233readArrays :: (IsStream t, MonadIO m) => Handle -> t m (Array Word8)
232−readArrays = readArraysOfUpto defaultChunkSize
234+readArrays = readArraysOf defaultChunkSize
234-------------------------------------------------------------------------------
236-------------------------------------------------------------------------------
235-- Read File to Stream
237-- Read File to Stream
@@ -245,7 +247,7 @@ readArrays = readArraysOfUpto defaultChunkSize
245-- @since 0.7.0
247-- @since 0.7.0
246{-# INLINE readByChunksUpto #-}
248{-# INLINE readByChunksUpto #-}
247readByChunksUpto :: (IsStream t, MonadIO m) => Int -> Handle -> t m Word8
249readByChunksUpto :: (IsStream t, MonadIO m) => Int -> Handle -> t m Word8
248−readByChunksUpto chunkSize h = AS.flatten $ readArraysOfUpto chunkSize h
250+readByChunksUpto chunkSize h = AS.flatten $ readArraysOf chunkSize h
251-- Generate a stream of elements of the given type from a file 'Handle'.
253-- Generate a stream of elements of the given type from a file 'Handle'.