Fix since annotations in Array.Foreign module

Module was moved from Streamly.Memory.Array, so the APIs should be
marked since the current release.
This commit is contained in:
Harendra Kumar 2021-06-03 00:18:01 +05:30
parent 8b071538e4
commit 3706e838be
2 changed files with 21 additions and 7 deletions

View File

@ -219,7 +219,9 @@ fromStream = P.fold A.write
-- | Unfold an array into a stream.
--
-- @since 0.7.0
-- /Since 0.7.0 (Streamly.Memory.Array)/
--
-- @since 0.8.0
{-# INLINE_NORMAL read #-}
read :: forall m a. (Monad m, Storable a) => Unfold m (Array a) a
read = Unfold.lmap A.unsafeThaw MA.read

View File

@ -294,14 +294,18 @@ fromCString# addr# = do
-- allocated to size N, if the list terminates before N elements then the
-- array may hold less than N elements.
--
-- @since 0.7.0
-- /Since 0.7.0 (Streamly.Memory.Array)/
--
-- @since 0.8.0
{-# INLINABLE fromListN #-}
fromListN :: Storable a => Int -> [a] -> Array a
fromListN n xs = unsafeFreeze $ MA.fromListN n xs
-- | Create an 'Array' from a list. The list must be of finite size.
--
-- @since 0.7.0
-- /Since 0.7.0 (Streamly.Memory.Array)/
--
-- @since 0.8.0
{-# INLINABLE fromList #-}
fromList :: Storable a => [a] -> Array a
fromList xs = unsafeFreeze $ MA.fromList xs
@ -388,7 +392,9 @@ byteLength = MA.byteLength . unsafeThaw
-- | /O(1)/ Get the length of the array i.e. the number of elements in the
-- array.
--
-- @since 0.7.0
-- /Since 0.7.0 (Streamly.Memory.Array)/
--
-- @since 0.8.0
{-# INLINE length #-}
length :: forall a. Storable a => Array a -> Int
length arr = MA.length (unsafeThaw arr)
@ -456,7 +462,9 @@ splitAt i arr = (unsafeFreeze a, unsafeFreeze b)
-- | Convert an 'Array' into a list.
--
-- @since 0.7.0
-- /Since 0.7.0 (Streamly.Memory.Array)/
--
-- @since 0.8.0
{-# INLINE toList #-}
toList :: Storable a => Array a -> [a]
toList = MA.toList . unsafeThaw
@ -468,7 +476,9 @@ toList = MA.toList . unsafeThaw
-- | @writeN n@ folds a maximum of @n@ elements from the input stream to an
-- 'Array'.
--
-- @since 0.7.0
-- /Since 0.7.0 (Streamly.Memory.Array)/
--
-- @since 0.8.0
{-# INLINE_NORMAL writeN #-}
writeN :: forall m a. (MonadIO m, Storable a) => Int -> Fold m a (Array a)
writeN = fmap unsafeFreeze . MA.writeN
@ -531,7 +541,9 @@ toArrayMinChunk alignSize elemCount =
--
-- /Caution! Do not use this on infinite streams./
--
-- @since 0.7.0
-- /Since 0.7.0 (Streamly.Memory.Array)/
--
-- @since 0.8.0
{-# INLINE write #-}
write :: forall m a. (MonadIO m, Storable a) => Fold m a (Array a)
write = fmap unsafeFreeze MA.write