@@ -234,18 +234,18 @@ module Streamly.Internal.Data.MutArray.Type
234234
235235 -- *** Concat
236236 -- | Append the arrays in a stream to form a stream of elements.
237− , concatChunks
238− , concatChunksRev
237+ , concat
238+ , concatRev
239239
240240 -- *** Compact
241241 -- | Append the arrays in a stream to form a stream of larger arrays.
242242 , SpliceState (..)
243− , pCompactChunksLE
244− , rCompactChunksLE
245− , fCompactChunksGE
246− , lCompactChunksGE
247− , compactChunksGE
248− , compactChunksEQ
243+ , pCompactLE
244+ , rCompactLE
245+ , fCompactGE
246+ , lCompactGE
247+ , compactGE
248+ , compactEQ
249249
250250 -- ** Utilities
251251 , roundUpToPower2
@@ -318,7 +318,7 @@ import qualified Streamly.Internal.Data.StreamK.Type as K
318318import qualified Prelude
319319
320320import Prelude hiding
321− (Foldable(..), read, unlines, splitAt, reverse, truncate)
321+ (Foldable(..), concat, read, unlines, splitAt, reverse, truncate)
322322
323323#include "DocTestDataMutArray.hs"
324324
@@ -851,7 +851,7 @@ reallocWith label capSizer minIncrBytes arr = do
851851 where
852852
853853 badSize newSize =
854− concat
854+ Prelude.concat
855855 [ label
856856 , ": new array size (in bytes) is less than required size "
857857 , show newSize
@@ -1465,14 +1465,14 @@ data FlattenState s contents a =
14651465
14661466-- | Use the "reader" unfold instead.
14671467--
1468−-- @concatChunks = unfoldMany reader@
1468+-- @concat = unfoldMany reader@
14691469--
14701470-- We can try this if there are any fusion issues in the unfold.
14711471--
1472−{-# INLINE_NORMAL concatChunks #-}
1473−concatChunks :: forall m a. (MonadIO m, Unbox a)
1472+{-# INLINE_NORMAL concat #-}
1473+concat :: forall m a. (MonadIO m, Unbox a)
14741474 => D.Stream m (MutArray a) -> D.Stream m a
1475−concatChunks (D.Stream step state) = D.Stream step' (OuterLoop state)
1475+concat (D.Stream step state) = D.Stream step' (OuterLoop state)
14761476
14771477 where
14781478
@@ -1495,18 +1495,18 @@ concatChunks (D.Stream step state) = D.Stream step' (OuterLoop state)
14951495{-# DEPRECATED flattenArrays "Please use \"unfoldMany reader\" instead." #-}
14961496flattenArrays :: forall m a. (MonadIO m, Unbox a)
14971497 => D.Stream m (MutArray a) -> D.Stream m a
1498−flattenArrays = concatChunks
1498+flattenArrays = concat
14991499
15001500-- | Use the "readerRev" unfold instead.
15011501--
1502−-- @concatChunks = unfoldMany readerRev@
1502+-- @concat = unfoldMany readerRev@
15031503--
15041504-- We can try this if there are any fusion issues in the unfold.
15051505--
1506−{-# INLINE_NORMAL concatChunksRev #-}
1507−concatChunksRev :: forall m a. (MonadIO m, Unbox a)
1506+{-# INLINE_NORMAL concatRev #-}
1507+concatRev :: forall m a. (MonadIO m, Unbox a)
15081508 => D.Stream m (MutArray a) -> D.Stream m a
1509−concatChunksRev (D.Stream step state) = D.Stream step' (OuterLoop state)
1509+concatRev (D.Stream step state) = D.Stream step' (OuterLoop state)
15101510
15111511 where
15121512
@@ -1531,7 +1531,7 @@ concatChunksRev (D.Stream step state) = D.Stream step' (OuterLoop state)
15311531{-# DEPRECATED flattenArraysRev "Please use \"unfoldMany readerRev\" instead." #-}
15321532flattenArraysRev :: forall m a. (MonadIO m, Unbox a)
15331533 => D.Stream m (MutArray a) -> D.Stream m a
1534−flattenArraysRev = concatChunksRev
1534+flattenArraysRev = concatRev
15351535
15361536-------------------------------------------------------------------------------
15371537-- Unfolds
@@ -2625,21 +2625,21 @@ byteEq arr1 arr2 = fmap (EQ ==) $ byteCmp arr1 arr2
26252625-- Compact
26262626-------------------------------------------------------------------------------
26272627
2628−-- | Parser @pCompactChunksLE n@ coalesces adjacent arrays in the input stream
2628+-- | Parser @pCompactLE n@ coalesces adjacent arrays in the input stream
26292629-- only if the combined size would be less than or equal to n.
26302630--
26312631-- /Internal/
2632−{-# INLINE_NORMAL pCompactChunksLE #-}
2633−pCompactChunksLE ::
2632+{-# INLINE_NORMAL pCompactLE #-}
2633+pCompactLE ::
26342634 forall m a. (MonadIO m, Unbox a)
26352635 => Int -> Parser (MutArray a) m (MutArray a)
2636−pCompactChunksLE n = Parser step initial extract
2636+pCompactLE n = Parser step initial extract
26372637
26382638 where
26392639
26402640 nBytes = n * SIZE_OF(a)
26412641
2642− functionName = "Streamly.Internal.Data.MutArray.pCompactChunksLE"
2642+ functionName = "Streamly.Internal.Data.MutArray.pCompactLE"
26432643
26442644 initial =
26452645 return
@@ -2683,19 +2683,19 @@ data SpliceState s arr
26832683-- immutable array never has additional space so a new array is allocated
26842684-- instead of mutating it.
26852685
2686−-- | Scan @rCompactChunksLE n@ coalesces adjacent arrays in the input stream
2686+-- | Scan @rCompactLE n@ coalesces adjacent arrays in the input stream
26872687-- only if the combined size would be less than or equal to n.
26882688--
26892689-- /Internal/
2690−{-# INLINE_NORMAL rCompactChunksLE #-}
2691−rCompactChunksLE :: (MonadIO m, Unbox a)
2690+{-# INLINE_NORMAL rCompactLE #-}
2691+rCompactLE :: (MonadIO m, Unbox a)
26922692 => Int -> D.Stream m (MutArray a) -> D.Stream m (MutArray a)
2693−rCompactChunksLE n (D.Stream step state) =
2693+rCompactLE n (D.Stream step state) =
26942694 D.Stream step' (SpliceInitial state)
26952695
26962696 where
26972697
2698− functionName = "Streamly.Internal.Data.MutArray.rCompactChunksLE"
2698+ functionName = "Streamly.Internal.Data.MutArray.rCompactLE"
26992699
27002700 {-# INLINE_LATE step' #-}
27012701 step' gst (SpliceInitial st) = do
@@ -2735,20 +2735,20 @@ rCompactChunksLE n (D.Stream step state) =
27352735
27362736 step' _ (SpliceYielding arr next) = return $ D.Yield arr next
27372737
2738−-- | Fold @fCompactChunksGE n@ coalesces adjacent arrays in the input stream
2738+-- | Fold @fCompactGE n@ coalesces adjacent arrays in the input stream
27392739-- until the size becomes greater than or equal to n.
27402740--
2741−{-# INLINE_NORMAL fCompactChunksGE #-}
2742−fCompactChunksGE ::
2741+{-# INLINE_NORMAL fCompactGE #-}
2742+fCompactGE ::
27432743 forall m a. (MonadIO m, Unbox a)
27442744 => Int -> FL.Fold m (MutArray a) (MutArray a)
2745−fCompactChunksGE n = Fold step initial extract extract
2745+fCompactGE n = Fold step initial extract extract
27462746
27472747 where
27482748
27492749 nBytes = n * SIZE_OF(a)
27502750
2751− functionName = "Streamly.Internal.Data.MutArray.fCompactChunksGE"
2751+ functionName = "Streamly.Internal.Data.MutArray.fCompactGE"
27522752
27532753 initial =
27542754 return
@@ -2779,20 +2779,20 @@ fCompactChunksGE n = Fold step initial extract extract
27792779 extract Nothing = return nil
27802780 extract (Just buf) = return buf
27812781
2782−-- | Like 'compactChunksGE' but for transforming folds instead of stream.
2782+-- | Like 'compactGE' but for transforming folds instead of stream.
27832783--
2784−-- >>> lCompactChunksGE n = Fold.many (MutArray.fCompactChunksGE n)
2784+-- >>> lCompactGE n = Fold.many (MutArray.fCompactGE n)
27852785--
2786−{-# INLINE_NORMAL lCompactChunksGE #-}
2787−lCompactChunksGE :: (MonadIO m, Unbox a)
2786+{-# INLINE_NORMAL lCompactGE #-}
2787+lCompactGE :: (MonadIO m, Unbox a)
27882788 => Int -> Fold m (MutArray a) () -> Fold m (MutArray a) ()
2789−-- lCompactChunksGE n = Fold.many (fCompactChunksGE n)
2790−lCompactChunksGE n (Fold step1 initial1 _ final1) =
2789+-- lCompactGE n = Fold.many (fCompactGE n)
2790+lCompactGE n (Fold step1 initial1 _ final1) =
27912791 Fold step initial extract final
27922792
27932793 where
27942794
2795− functionName = "Streamly.Internal.Data.MutArray.lCompactChunksGE"
2795+ functionName = "Streamly.Internal.Data.MutArray.lCompactGE"
27962796
27972797 initial = do
27982798 when (n <= 0) $
@@ -2841,7 +2841,7 @@ lCompactChunksGE n (Fold step1 initial1 _ final1) =
28412841 --
28422842 -- extract forces the pending buffer to be sent to the fold which is not
28432843 -- what we want.
2844− extract _ = error "lCompactChunksGE: not designed for scanning"
2844+ extract _ = error "lCompactGE: not designed for scanning"
28452845
28462846 final (Tuple' Nothing r1) = final1 r1
28472847 final (Tuple' (Just buf) r1) = do
@@ -2850,25 +2850,25 @@ lCompactChunksGE n (Fold step1 initial1 _ final1) =
28502850 FL.Partial rr -> final1 rr
28512851 FL.Done _ -> return ()
28522852
2853−-- | @compactChunksGE n stream@ coalesces adjacent arrays in the @stream@ until
2853+-- | @compactGE n stream@ coalesces adjacent arrays in the @stream@ until
28542854-- the size becomes greater than or equal to @n@.
28552855--
2856−-- >>> compactChunksGE n = Stream.foldMany (MutArray.fCompactChunksGE n)
2856+-- >>> compactGE n = Stream.foldMany (MutArray.fCompactGE n)
28572857--
2858−{-# INLINE compactChunksGE #-}
2859−compactChunksGE ::
2858+{-# INLINE compactGE #-}
2859+compactGE ::
28602860 (MonadIO m, Unbox a)
28612861 => Int -> Stream m (MutArray a) -> Stream m (MutArray a)
2862−compactChunksGE n = D.foldMany (fCompactChunksGE n)
2862+compactGE n = D.foldMany (fCompactGE n)
28632863
2864−-- | 'compactChunksEQ n' coalesces adajacent arrays in the input stream to
2864+-- | 'compactEQ n' coalesces adajacent arrays in the input stream to
28652865-- arrays of exact size @n@.
28662866--
28672867-- /Unimplemented/
2868−{-# INLINE compactChunksEQ #-}
2869−compactChunksEQ :: -- (MonadIO m, Unbox a) =>
2868+{-# INLINE compactEQ #-}
2869+compactEQ :: -- (MonadIO m, Unbox a) =>
28702870 Int -> Stream m (MutArray a) -> Stream m (MutArray a)
2871−compactChunksEQ _n = undefined -- D.parseManyD (pCompactChunksEQ n)
2871+compactEQ _n = undefined -- D.parseManyD (pCompactEQ n)
28722872
28732873-------------------------------------------------------------------------------
28742874-- In-place mutation algorithms