on master help sign in
Refactor readByChunksUpto to readInChunksOf.
4d85ca3Pranay Sashank
src/Streamly/FileSystem/FD.hs+5−5
@@ -75,7 +75,7 @@ module Streamly.FileSystem.FD
75 -- , readUtf8
75 -- , readUtf8
76 -- , readLines
76 -- , readLines
77 -- , readFrames
77 -- , readFrames
78− , readByChunksUpto
78+ , readInChunksOf
79
79
80 -- -- * Array Read
80 -- -- * Array Read
81 -- , readArrayUpto
81 -- , readArrayUpto
@@ -321,13 +321,13 @@ readArrays = readArraysOfUpto defaultChunkSize
321-- read requests at the same time. For serial case we can use async IO. We can
321-- read requests at the same time. For serial case we can use async IO. We can
322-- also control the read throughput in mbps or IOPS.
322-- also control the read throughput in mbps or IOPS.
323
323
324−-- | @readByChunksUpto chunkSize handle@ reads a byte stream from a file handle,
324+-- | @readInChunksOf chunkSize handle@ reads a byte stream from a file handle,
325-- reads are performed in chunks of up to @chunkSize@. The stream ends as soon
325-- reads are performed in chunks of up to @chunkSize@. The stream ends as soon
326-- as EOF is encountered.
326-- as EOF is encountered.
327--
327--
328−{-# INLINE readByChunksUpto #-}
328+{-# INLINE readInChunksOf #-}
329−readByChunksUpto :: (IsStream t, MonadIO m) => Int -> Handle -> t m Word8
329+readInChunksOf :: (IsStream t, MonadIO m) => Int -> Handle -> t m Word8
330−readByChunksUpto chunkSize h = AS.flatten $ readArraysOfUpto chunkSize h
330+readInChunksOf chunkSize h = AS.flatten $ readArraysOfUpto chunkSize h
331
331
332-- TODO
332-- TODO
333-- read :: (IsStream t, MonadIO m, Storable a) => Handle -> t m a
333-- read :: (IsStream t, MonadIO m, Storable a) => Handle -> t m a
src/Streamly/FileSystem/File.hs+4−4
@@ -214,13 +214,13 @@ readArrays = readArraysOf A.defaultChunkSize
214-- also control the read throughput in mbps or IOPS.
214-- also control the read throughput in mbps or IOPS.
215
215
216{-
216{-
217−-- | @readByChunksUpto chunkSize handle@ reads a byte stream from a file
217+-- | @readInChunksOf chunkSize handle@ reads a byte stream from a file
218-- handle, reads are performed in chunks of up to @chunkSize@. The stream ends
218-- handle, reads are performed in chunks of up to @chunkSize@. The stream ends
219-- as soon as EOF is encountered.
219-- as soon as EOF is encountered.
220--
220--
221−{-# INLINE readByChunksUpto #-}
221+{-# INLINE readInChunksOf #-}
222−readByChunksUpto :: (IsStream t, MonadIO m) => Int -> Handle -> t m Word8
222+readInChunksOf :: (IsStream t, MonadIO m) => Int -> Handle -> t m Word8
223−readByChunksUpto chunkSize h = A.flattenArrays $ readArraysOf chunkSize h
223+readInChunksOf chunkSize h = A.flattenArrays $ readArraysOf chunkSize h
224-}
224-}
225
225
226-- TODO
226-- TODO
src/Streamly/FileSystem/Handle.hs+5−5
@@ -61,7 +61,7 @@ module Streamly.FileSystem.Handle
61 -- , readUtf8
61 -- , readUtf8
62 -- , readLines
62 -- , readLines
63 -- , readFrames
63 -- , readFrames
64− , readByChunksUpto
64+ , readInChunksOf
65
65
66 -- -- * Array Read
66 -- -- * Array Read
67 -- , readArrayUpto
67 -- , readArrayUpto
@@ -241,13 +241,13 @@ readArrays = readArraysOf defaultChunkSize
241-- read requests at the same time. For serial case we can use async IO. We can
241-- read requests at the same time. For serial case we can use async IO. We can
242-- also control the read throughput in mbps or IOPS.
242-- also control the read throughput in mbps or IOPS.
243
243
244−-- | @readByChunksUpto chunkSize handle@ reads a byte stream from a file
244+-- | @readInChunksOf chunkSize handle@ reads a byte stream from a file
245-- handle, reads are performed in chunks of up to @chunkSize@.
245-- handle, reads are performed in chunks of up to @chunkSize@.
246--
246--
247-- @since 0.7.0
247-- @since 0.7.0
248−{-# INLINE readByChunksUpto #-}
248+{-# INLINE readInChunksOf #-}
249−readByChunksUpto :: (IsStream t, MonadIO m) => Int -> Handle -> t m Word8
249+readInChunksOf :: (IsStream t, MonadIO m) => Int -> Handle -> t m Word8
250−readByChunksUpto chunkSize h = AS.flatten $ readArraysOf chunkSize h
250+readInChunksOf chunkSize h = AS.flatten $ readArraysOf chunkSize h
251
251
252-- TODO
252-- TODO
253-- 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'.
src/Streamly/Network/Socket.hs+4−4
@@ -247,13 +247,13 @@ readArrays = readArraysOf A.defaultChunkSize
247-- also control the read throughput in mbps or IOPS.
247-- also control the read throughput in mbps or IOPS.
248
248
249{-
249{-
250−-- | @readByChunksUpto chunkSize handle@ reads a byte stream from a file
250+-- | @readInChunksOf chunkSize handle@ reads a byte stream from a file
251-- handle, reads are performed in chunks of up to @chunkSize@. The stream ends
251-- handle, reads are performed in chunks of up to @chunkSize@. The stream ends
252-- as soon as EOF is encountered.
252-- as soon as EOF is encountered.
253--
253--
254−{-# INLINE readByChunksUpto #-}
254+{-# INLINE readInChunksOf #-}
255−readByChunksUpto :: (IsStream t, MonadIO m) => Int -> Handle -> t m Word8
255+readInChunksOf :: (IsStream t, MonadIO m) => Int -> Handle -> t m Word8
256−readByChunksUpto chunkSize h = A.flattenArrays $ readArraysUpto chunkSize h
256+readInChunksOf chunkSize h = A.flattenArrays $ readArraysUpto chunkSize h
257-}
257-}
258
258
259-- TODO
259-- TODO