@@ -8,14 +8,21 @@
88--
99-- Combinators to efficiently manipulate streams of immutable arrays.
1010--
11+-- We can either push these in the MutArray module with a "chunks" prefix or
12+-- keep this as a separate module and release it.
13+--
1114module Streamly.Internal.Data.Array.Stream
1215 (
1316 -- * Creation
14− chunksOf
17+ Array.chunksOf
18+ , Array.pinnedChunksOf
19+ , Array.bufferChunks
1520
1621 -- * Flattening to elements
1722 , concat
23+ , Array.flattenArrays
1824 , concatRev
25+ , Array.flattenArraysRev
1926 , interpose
2027 , interposeSuffix
2128 , intercalateSuffix
@@ -27,7 +34,7 @@ module Streamly.Internal.Data.Array.Stream
2734 -- can flatten the stream to byte stream and use that. But if we want the
2835 -- remaining stream to be a chunk stream then this could be handy. But it
2936 -- could also be implemented using parseBreak.
30− , foldBreak -- StreamK.foldBreakChunks
37+ , foldBreak
3138 , foldBreakD
3239 -- The byte level parseBreak cannot work efficiently. Because the stream
3340 -- will have to be a StreamK for backtracking, StreamK at byte level would
@@ -36,15 +43,17 @@ module Streamly.Internal.Data.Array.Stream
3643 -- , parseBreakD
3744 -- , foldManyChunks
3845 -- , parseManyChunks
46+ , K.parseBreakChunks
47+ , K.parseChunks
3948
4049 -- ** Array Folds
41− -- XXX Use Parser.Chunked instead, need only chunkedParseBreak,
50+ -- XXX Use parseBreakChunks/parseChunks instead
4251 -- foldBreak can be implemented using parseBreak. Use StreamK.
4352 , runArrayFold
4453 , runArrayFoldBreak
4554 -- , parseArr
46− , runArrayParserDBreak -- StreamK.chunkedParseBreak
47− , runArrayFoldMany -- StreamK.chunkedParseMany
55+ , runArrayParserDBreak -- StreamK.parseBreakChunks
56+ , runArrayFoldMany
4857
4958 , toArray
5059
@@ -100,21 +109,6 @@ import qualified Streamly.Internal.Data.StreamK as K
100109-- XXX Since these are immutable arrays MonadIO constraint can be removed from
101110-- most places.
102111
103−-------------------------------------------------------------------------------
104−-- Generation
105−-------------------------------------------------------------------------------
106−
107−-- | @chunksOf n stream@ groups the elements in the input stream into arrays of
108−-- @n@ elements each.
109−--
110−-- > chunksOf n = Stream.groupsOf n (Array.writeN n)
111−--
112−-- /Pre-release/
113−{-# INLINE chunksOf #-}
114−chunksOf :: (MonadIO m, Unbox a)
115− => Int -> Stream m a -> Stream m (Array a)
116−chunksOf = A.chunksOf
117−
118112-------------------------------------------------------------------------------
119113-- Append
120114-------------------------------------------------------------------------------