on master help sign in
Refactor readByChunksUpto to readInChunksOf.
commit4d85ca39799c3528035a0bdd5f1ed87c134f227c authorPranay Sashank <pranaysashank@gmail.com> dateTue 6 Aug 2019, 23:51 (7 years ago) parent07e9548
4 files changed+18−18
src/Streamly/FileSystem/FD.hs+5−5 src/Streamly/FileSystem/File.hs+4−4 src/Streamly/FileSystem/Handle.hs+5−5 src/Streamly/Network/Socket.hs+4−4
src/Streamly/FileSystem/FD.hs+5−5
@@ -75,7 +75,7 @@ module Streamly.FileSystem.FD
7575 -- , readUtf8
7676 -- , readLines
7777 -- , readFrames
78− , readByChunksUpto
78+ , readInChunksOf
7979
8080 -- -- * Array Read
8181 -- , readArrayUpto
@@ -321,13 +321,13 @@ readArrays = readArraysOfUpto defaultChunkSize
321321-- read requests at the same time. For serial case we can use async IO. We can
322322-- also control the read throughput in mbps or IOPS.
323323
324−-- | @readByChunksUpto chunkSize handle@ reads a byte stream from a file handle,
324+-- | @readInChunksOf chunkSize handle@ reads a byte stream from a file handle,
325325-- reads are performed in chunks of up to @chunkSize@. The stream ends as soon
326326-- as EOF is encountered.
327327--
328−{-# INLINE readByChunksUpto #-}
329−readByChunksUpto :: (IsStream t, MonadIO m) => Int -> Handle -> t m Word8
330−readByChunksUpto chunkSize h = AS.flatten $ readArraysOfUpto chunkSize h
328+{-# INLINE readInChunksOf #-}
329+readInChunksOf :: (IsStream t, MonadIO m) => Int -> Handle -> t m Word8
330+readInChunksOf chunkSize h = AS.flatten $ readArraysOfUpto chunkSize h
331331
332332-- TODO
333333-- 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
214214-- also control the read throughput in mbps or IOPS.
215215
216216{-
217−-- | @readByChunksUpto chunkSize handle@ reads a byte stream from a file
217+-- | @readInChunksOf chunkSize handle@ reads a byte stream from a file
218218-- handle, reads are performed in chunks of up to @chunkSize@. The stream ends
219219-- as soon as EOF is encountered.
220220--
221−{-# INLINE readByChunksUpto #-}
222−readByChunksUpto :: (IsStream t, MonadIO m) => Int -> Handle -> t m Word8
223−readByChunksUpto chunkSize h = A.flattenArrays $ readArraysOf chunkSize h
221+{-# INLINE readInChunksOf #-}
222+readInChunksOf :: (IsStream t, MonadIO m) => Int -> Handle -> t m Word8
223+readInChunksOf chunkSize h = A.flattenArrays $ readArraysOf chunkSize h
224224-}
225225
226226-- TODO
src/Streamly/FileSystem/Handle.hs+5−5
@@ -61,7 +61,7 @@ module Streamly.FileSystem.Handle
6161 -- , readUtf8
6262 -- , readLines
6363 -- , readFrames
64− , readByChunksUpto
64+ , readInChunksOf
6565
6666 -- -- * Array Read
6767 -- , readArrayUpto
@@ -241,13 +241,13 @@ readArrays = readArraysOf defaultChunkSize
241241-- read requests at the same time. For serial case we can use async IO. We can
242242-- also control the read throughput in mbps or IOPS.
243243
244−-- | @readByChunksUpto chunkSize handle@ reads a byte stream from a file
244+-- | @readInChunksOf chunkSize handle@ reads a byte stream from a file
245245-- handle, reads are performed in chunks of up to @chunkSize@.
246246--
247247-- @since 0.7.0
248−{-# INLINE readByChunksUpto #-}
249−readByChunksUpto :: (IsStream t, MonadIO m) => Int -> Handle -> t m Word8
250−readByChunksUpto chunkSize h = AS.flatten $ readArraysOf 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
251251
252252-- TODO
253253-- 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
247247-- also control the read throughput in mbps or IOPS.
248248
249249{-
250−-- | @readByChunksUpto chunkSize handle@ reads a byte stream from a file
250+-- | @readInChunksOf chunkSize handle@ reads a byte stream from a file
251251-- handle, reads are performed in chunks of up to @chunkSize@. The stream ends
252252-- as soon as EOF is encountered.
253253--
254−{-# INLINE readByChunksUpto #-}
255−readByChunksUpto :: (IsStream t, MonadIO m) => Int -> Handle -> t m Word8
256−readByChunksUpto chunkSize h = A.flattenArrays $ readArraysUpto chunkSize h
254+{-# INLINE readInChunksOf #-}
255+readInChunksOf :: (IsStream t, MonadIO m) => Int -> Handle -> t m Word8
256+readInChunksOf chunkSize h = A.flattenArrays $ readArraysUpto chunkSize h
257257-}
258258
259259-- TODO