Skip to content

Commit 3e26770

Browse files
Use emptyOf instead of the deprecated "new".
1 parent b685efe commit 3e26770

File tree

1 file changed

+6
-6
lines changed
  • core/src/Streamly/Internal/Data/MutArray

1 file changed

+6
-6
lines changed

core/src/Streamly/Internal/Data/MutArray/Generic.hs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ new = emptyOf
284284
-- >>> nil = MutArray.emptyOf 0
285285
{-# INLINE nil #-}
286286
nil :: MonadIO m => m (MutArray a)
287-
nil = new 0
287+
nil = emptyOf 0
288288

289289
-------------------------------------------------------------------------------
290290
-- Random writes
@@ -384,7 +384,7 @@ modifyIndex i arr f = do
384384
--
385385
realloc :: MonadIO m => Int -> MutArray a -> m (MutArray a)
386386
realloc n arr = do
387-
arr1 <- new n
387+
arr1 <- emptyOf n
388388
let !newLen@(I# newLen#) = min n (length arr)
389389
!(I# arrS#) = arrStart arr
390390
!(I# arr1S#) = arrStart arr1
@@ -637,7 +637,7 @@ unsafeCreateOf n = Fold step initial return return
637637

638638
where
639639

640-
initial = FL.Partial <$> new (max n 0)
640+
initial = FL.Partial <$> emptyOf (max n 0)
641641

642642
step arr x = FL.Partial <$> unsafeSnoc arr x
643643

@@ -681,7 +681,7 @@ createWith elemCount = FL.rmapM extract $ FL.foldlM' step initial
681681

682682
initial = do
683683
when (elemCount < 0) $ error "createWith: elemCount is negative"
684-
new elemCount
684+
emptyOf elemCount
685685

686686
step arr@(MutArray _ start end bound) x
687687
| end == bound = do
@@ -783,7 +783,7 @@ chunksOf n (D.Stream step state) =
783783
error $ "Streamly.Internal.Data.Array.Generic.Mut.Type.chunksOf: "
784784
++ "the size of arrays [" ++ show n
785785
++ "] must be a natural number"
786-
(MutArray contents start end bound :: MutArray a) <- new n
786+
(MutArray contents start end bound :: MutArray a) <- emptyOf n
787787
return $ D.Skip (GroupBuffer st contents start end bound)
788788

789789
step' gst (GroupBuffer st contents start end bound) = do
@@ -872,7 +872,7 @@ unsafePutSlice src srcStart dst dstStart len = liftIO $ do
872872
clone :: MonadIO m => MutArray a -> m (MutArray a)
873873
clone src = do
874874
let len = length src
875-
dst <- new len
875+
dst <- emptyOf len
876876
unsafePutSlice src 0 dst 0 len
877877
return dst
878878

0 commit comments

Comments
 (0)