@@ -11,8 +11,8 @@ module Streamly.Internal.Data.Array.Generic
12 -- * Construction
12 -- * Construction
14− , writeN
14+ , createOf
16 , writeWith
16 , writeWith
17 , writeLastN
17 , writeLastN
@@ -44,6 +44,10 @@ module Streamly.Internal.Data.Array.Generic
44 , getIndex
44 , getIndex
45 , getSliceUnsafe
45 , getSliceUnsafe
@@ -104,9 +108,15 @@ nil = unsafePerformIO $ unsafeFreeze <$> MArray.nil
104-- Construction - Folds
108-- Construction - Folds
105-------------------------------------------------------------------------------
109-------------------------------------------------------------------------------
107−{-# INLINE_NORMAL writeN #-}
111+{-# INLINE_NORMAL createOf #-}
112+createOf :: MonadIO m => Int -> Fold m a (Array a)
113+createOf = fmap unsafeFreeze <$> MArray.createOf
115+-- XXX Deprecate in major
116+-- {-# DEPRECATED writeN "Please use createOf instead." #-}
117+{-# INLINE writeN #-}
108writeN :: MonadIO m => Int -> Fold m a (Array a)
118writeN :: MonadIO m => Int -> Fold m a (Array a)
109−writeN = fmap unsafeFreeze <$> MArray.createOf
119+writeN = createOf
111{-# INLINE_NORMAL writeWith #-}
121{-# INLINE_NORMAL writeWith #-}
112writeWith :: MonadIO m => Int -> Fold m a (Array a)
122writeWith :: MonadIO m => Int -> Fold m a (Array a)
@@ -116,9 +126,15 @@ writeWith elemCount = unsafeFreeze <$> MArray.createWith elemCount
117-- /Caution! Do not use this on infinite streams./
127-- /Caution! Do not use this on infinite streams./
129+{-# INLINE create #-}
130+create :: MonadIO m => Fold m a (Array a)
131+create = fmap unsafeFreeze MArray.create
133+-- XXX Deprecate in major
134+-- {-# DEPRECATED write "Please use create instead." #-}
119{-# INLINE write #-}
135{-# INLINE write #-}
120write :: MonadIO m => Fold m a (Array a)
136write :: MonadIO m => Fold m a (Array a)
121−write = fmap unsafeFreeze MArray.create
137+write = create
123fromPureStream :: Stream Identity a -> Array a
139fromPureStream :: Stream Identity a -> Array a
124fromPureStream x =
140fromPureStream x =