@@ -29,6 +29,8 @@ module Streamly.Internal.Data.Array.Foreign.Type
29 , fromCString#
29 , fromCString#
30 , fromList
30 , fromList
31 , fromListN
31 , fromListN
32 , fromStreamDN
34 , fromStreamDN
33 , fromStreamD
35 , fromStreamD
@@ -295,6 +297,20 @@ fromCString# addr# = do
295fromListN :: Storable a => Int -> [a] -> Array a
297fromListN :: Storable a => Int -> [a] -> Array a
296fromListN n xs = unsafePerformIO $ unsafeFreeze <$> MA.fromListN n xs
298fromListN n xs = unsafePerformIO $ unsafeFreeze <$> MA.fromListN n xs
300+-- XXX We can possibly have a direction flag in the array to reverse it without
301+-- actually doing anything. With that we can just do "reverse . fromList". But
302+-- it may complicate all the APIs as all reads of the array will have to handle
305+-- | Create an 'Array' from the first N elements of a list in reverse order.
306+-- The array is allocated to size N, if the list terminates before N elements
307+-- then the array may hold less than N elements.
310+{-# INLINABLE fromListRevN #-}
311+fromListRevN :: {- Storable a => -} Int -> [a] -> Array a
312+fromListRevN _n _xs = undefined
298-- | Create an 'Array' from a list. The list must be of finite size.
314-- | Create an 'Array' from a list. The list must be of finite size.
300-- /Since 0.7.0 (Streamly.Memory.Array)/
316-- /Since 0.7.0 (Streamly.Memory.Array)/
@@ -304,6 +320,14 @@ fromListN n xs = unsafePerformIO $ unsafeFreeze <$> MA.fromListN n xs
304fromList :: Storable a => [a] -> Array a
320fromList :: Storable a => [a] -> Array a
305fromList xs = unsafePerformIO $ unsafeFreeze <$> MA.fromList xs
321fromList xs = unsafePerformIO $ unsafeFreeze <$> MA.fromList xs
323+-- | Create an 'Array' from a list in reverse order. The list must be of finite
327+{-# INLINABLE fromListRev #-}
328+fromListRev :: {- Storable a => -} [a] -> Array a
329+fromListRev _xs = undefined
307{-# INLINE_NORMAL fromStreamDN #-}
331{-# INLINE_NORMAL fromStreamDN #-}
308fromStreamDN :: forall m a. (MonadIO m, Storable a)
332fromStreamDN :: forall m a. (MonadIO m, Storable a)
309 => Int -> D.Stream m a -> m (Array a)
333 => Int -> D.Stream m a -> m (Array a)