@@ -115,7 +115,7 @@ import Prelude hiding (read)
115115
116116import qualified System.IO as SIO
117117
118−import Streamly.Memory.Array.Types (Array(..))
118+import Streamly.Memory.Array.Types (Array(..), defaultChunkSize)
119119import Streamly.Streams.Serial (SerialT)
120120import Streamly.Streams.StreamK.Type (IsStream)
121121import Streamly.SVar (MonadAsync)
@@ -123,8 +123,7 @@ import Streamly.SVar (MonadAsync)
123123-- import Streamly.String (encodeUtf8, decodeUtf8, foldLines)
124124
125125import qualified Streamly.FileSystem.Handle as FH
126−import qualified Streamly.Memory.ArrayStream as AS
127−import qualified Streamly.Memory.Array.Types as A hiding (flattenArrays)
126+import qualified Streamly.Memory.Array as A
128127import qualified Streamly.Prelude as S
129128
130129-------------------------------------------------------------------------------
@@ -203,7 +202,7 @@ readArraysOf size file = withFile file ReadMode (FH.readArraysOf size)
203202{-# INLINE readArrays #-}
204203readArrays :: (IsStream t, MonadCatch m, MonadIO m)
205204 => FilePath -> t m (Array Word8)
206−readArrays = readArraysOf A.defaultChunkSize
205+readArrays = readArraysOf defaultChunkSize
207206
208207-------------------------------------------------------------------------------
209208-- Read File to Stream
@@ -226,7 +225,7 @@ readInChunksOf chunkSize h = A.flattenArrays $ readArraysOf chunkSize h
226225-- TODO
227226-- read :: (IsStream t, MonadIO m, Storable a) => Handle -> t m a
228227--
229−-- > read = 'readByChunks' A.defaultChunkSize
228+-- > read = 'readByChunks' defaultChunkSize
230229-- | Generate a stream of elements of the given type from a file specified by
231230-- path. The stream ends when EOF is encountered. File is locked using multiple
232231-- reader and single writer locking mode.
@@ -234,7 +233,7 @@ readInChunksOf chunkSize h = A.flattenArrays $ readArraysOf chunkSize h
234233-- @since 0.7.0
235234{-# INLINE read #-}
236235read :: (IsStream t, MonadCatch m, MonadIO m) => FilePath -> t m Word8
237−read file = AS.flatten $ withFile file ReadMode FH.readArrays
236+read file = A.concat $ withFile file ReadMode FH.readArrays
238237
239238{-
240239-- | Generate a stream of elements of the given type from a file 'Handle'. The
@@ -290,9 +289,9 @@ writeArrays = writeArraysMode WriteMode
290289{-# INLINE writeInChunksOf #-}
291290writeInChunksOf :: (MonadAsync m, MonadCatch m)
292291 => Int -> FilePath -> SerialT m Word8 -> m ()
293−writeInChunksOf n file xs = writeArrays file $ AS.arraysOf n xs
292+writeInChunksOf n file xs = writeArrays file $ A.arraysOf n xs
294293
295−-- > write = 'writeInChunksOf' A.defaultChunkSize
294+-- > write = 'writeInChunksOf' defaultChunkSize
296295--
297296-- | Write a byte stream to a file. Combines the bytes in chunks of size
298297-- up to 'A.defaultChunkSize' before writing. If the file exists it is
@@ -302,7 +301,7 @@ writeInChunksOf n file xs = writeArrays file $ AS.arraysOf n xs
302301-- @since 0.7.0
303302{-# INLINE write #-}
304303write :: (MonadAsync m, MonadCatch m) => FilePath -> SerialT m Word8 -> m ()
305−write = writeInChunksOf A.defaultChunkSize
304+write = writeInChunksOf defaultChunkSize
306305
307306{-
308307{-# INLINE write #-}
@@ -326,7 +325,7 @@ appendArrays = writeArraysMode AppendMode
326325{-# INLINE appendByChunks #-}
327326appendByChunks :: (MonadAsync m, MonadCatch m)
328327 => Int -> FilePath -> SerialT m Word8 -> m ()
329−appendByChunks n file xs = appendArrays file $ AS.arraysOf n xs
328+appendByChunks n file xs = appendArrays file $ A.arraysOf n xs
330329
331330-- | Append a byte stream to a file. Combines the bytes in chunks of size up to
332331-- 'A.defaultChunkSize' before writing. If the file exists then the new data
@@ -336,7 +335,7 @@ appendByChunks n file xs = appendArrays file $ AS.arraysOf n xs
336335-- @since 0.7.0
337336{-# INLINE append #-}
338337append :: (MonadAsync m, MonadCatch m) => FilePath -> SerialT m Word8 -> m ()
339−append = appendByChunks A.defaultChunkSize
338+append = appendByChunks defaultChunkSize
340339
341340{-
342341-- | Like 'append' but the file is not locked for exclusive writes.
@@ -461,7 +460,7 @@ readSliceWith chunkSize h pos len = undefined
461460{-# INLINE readSlice #-}
462461readSlice :: (IsStream t, MonadIO m, Storable a)
463462 => Handle -> Int -> Int -> t m a
464−readSlice = readSliceWith A.defaultChunkSize
463+readSlice = readSliceWith defaultChunkSize
465464
466465-- | @readSliceRev h i count@ streams a slice from the file handle @h@ starting
467466-- at index @i@ and reading up to @count@ elements in the reverse direction