@@ -164,9 +164,9 @@ module Streamly.Internal.Data.MutArray.Type
164164 , blockSize
165165 , arrayChunkBytes
166166 , allocBytesToElemCount
167− , realloc
168− , resize
169− , resizeExp
167+ , realloc -- this is "resize"
168+ , grow
169+ , growExp
170170 , rightSize
171171
172172 -- ** Folding
@@ -263,6 +263,8 @@ module Streamly.Internal.Data.MutArray.Type
263263 , cmp
264264 , getIndices
265265 , getIndicesWith
266+ , resize
267+ , resizeExp
266268 )
267269where
268270
@@ -859,9 +861,7 @@ reallocWith label capSizer minIncrBytes arr = do
859861 , ". Please check the sizing function passed."
860862 ]
861863
862−-- XXX should be called expand/extend because it never shortens the array.
863−
864−-- | @resize newCapacity array@ changes the total capacity of the array so that
864+-- | @grow newCapacity array@ changes the total capacity of the array so that
865865-- it is enough to hold the specified number of elements. Nothing is done if
866866-- the specified capacity is less than the length of the array.
867867--
@@ -869,24 +869,29 @@ reallocWith label capSizer minIncrBytes arr = do
869869-- the block size (4K).
870870--
871871-- /Pre-release/
872−{-# INLINE resize #-}
873−resize :: forall m a. (MonadIO m, Unbox a) =>
872+{-# INLINE grow #-}
873+grow :: forall m a. (MonadIO m, Unbox a) =>
874874 Int -> MutArray a -> m (MutArray a)
875−resize nElems arr@MutArray{..} = do
875+grow nElems arr@MutArray{..} = do
876876 let req = SIZE_OF(a) * nElems
877877 cap = arrBound - arrStart
878878 if req < cap
879879 then return arr
880880 else realloc req arr
881881
882−-- | Like 'resize' but if the requested byte capacity is more than
882+{-# DEPRECATED resize "Please use grow instead." #-}
883+resize :: forall m a. (MonadIO m, Unbox a) =>
884+ Int -> MutArray a -> m (MutArray a)
885+resize = grow
886+
887+-- | Like 'grow' but if the requested byte capacity is more than
883888-- 'largeObjectThreshold' then it is rounded up to the closest power of 2.
884889--
885890-- /Pre-release/
886−{-# INLINE resizeExp #-}
887−resizeExp :: forall m a. (MonadIO m, Unbox a) =>
891+{-# INLINE growExp #-}
892+growExp :: forall m a. (MonadIO m, Unbox a) =>
888893 Int -> MutArray a -> m (MutArray a)
889−resizeExp nElems arr@MutArray{..} = do
894+growExp nElems arr@MutArray{..} = do
890895 let req = roundUpLargeArray (SIZE_OF(a) * nElems)
891896 req1 =
892897 if req > largeObjectThreshold
@@ -897,6 +902,11 @@ resizeExp nElems arr@MutArray{..} = do
897902 then return arr
898903 else realloc req1 arr
899904
905+{-# DEPRECATED resizeExp "Please use growExp instead." #-}
906+resizeExp :: forall m a. (MonadIO m, Unbox a) =>
907+ Int -> MutArray a -> m (MutArray a)
908+resizeExp = growExp
909+
900910-- | Resize the allocated memory to drop any reserved free space at the end of
901911-- the array and reallocate it to reduce wastage.
902912--