@@ -36,8 +36,6 @@ module Streamly.Internal.Data.Array.Foreign
39− -- , defaultChunkSize
41 -- * Construction
39 -- * Construction
43 -- Pure, From Static Memory (Unsafe)
41 -- Pure, From Static Memory (Unsafe)
@@ -55,64 +53,63 @@ module Streamly.Internal.Data.Array.Foreign
55 , fromStreamN
53 , fromStreamN
56 , fromStream
54 , fromStream
58− -- Monadic APIs
56+ -- Monadic Folds
60 , A.writeN -- drop new
57 , A.writeN -- drop new
61 , A.writeNAligned
58 , A.writeNAligned
62 , A.write -- full buffer
59 , A.write -- full buffer
63 , writeLastN
60 , writeLastN
65 -- * Elimination
62 -- * Elimination
67 , A.toList
63 , A.toList
68 , A.toStream
64 , A.toStream
69 , A.toStreamRev
65 , A.toStreamRev
72− , unsafeRead
67+ , unsafeRead -- XXX readUnsafe?
73 , A.readRev
68 , A.readRev
74− -- , readChunksOf
69+ , producer -- experimental
76 -- * Random Access
71 -- * Random Access
81 , getIndex
73 , getIndex
82− , A.unsafeIndex
74+ , A.unsafeIndex -- XXX Rename to getIndexUnsafe??
83− -- , readIndices
75+ -- , getIndexRev
84− -- , readRanges
76+ , last -- XXX getIndexLast?
86− -- , readFrom -- read from a given position to the end of file
78+ -- , getIndicesFromThenTo
87− -- , readFromRev -- read from a given position to the beginning of file
79+ -- , getIndicesFrom -- read from a given position to the end of file
88− -- , readTo -- read from beginning up to the given position
80+ -- , getIndicesUpto -- read from beginning up to the given position
81+ -- , getIndicesFromTo
82+ -- , getIndicesFromRev -- read from a given position to the beginning of file
89− -- , readToRev -- read from end to the given position in file
83+ -- , getIndicesUptoRev -- read from end to the given position in file
91− -- , readFromThenTo
85+ -- * Size
93− -- , readChunksOfFrom
87+ , null
105− -- * Immutable Transformations
89+ -- * Search
106− , streamTransform
90+ -- , binarySearch
108 -- * Casting
95 -- * Casting
112 , asBytes
97 , asBytes
98+ , unsafeCast -- castUnsafe?
99+ , unsafeAsPtr -- asPtrUnsafe?
113− , unsafeAsCString
100+ , unsafeAsCString -- asCStringUnsafe?
101+ , A.unsafeFreeze -- asImmutableUnsafe?
102+ , A.unsafeThaw -- asMutableUnsafe?
107+ -- , getSlicesFromLenN
109+ -- * Streaming Operations
115− -- * Folding Arrays
112+ -- ** Folding
116 , streamFold
113 , streamFold
@@ -331,7 +328,7 @@ findIndices = undefined
331-- XXX We can potentially use SIMD instructions on arrays to fold faster.
328-- XXX We can potentially use SIMD instructions on arrays to fold faster.
333-------------------------------------------------------------------------------
330-------------------------------------------------------------------------------
334−-- Slice and splice
331+-- Slice
335-------------------------------------------------------------------------------
332-------------------------------------------------------------------------------
337-- | /O(1)/ Slice an array in constant time.
334-- | /O(1)/ Slice an array in constant time.
@@ -354,18 +351,6 @@ unsafeSlice start len (Array fp _) =
354 end = unsafeForeignPtrToPtr fp1 `plusPtr` (len * size)
351 end = unsafeForeignPtrToPtr fp1 `plusPtr` (len * size)
355 in Array fp1 end
352 in Array fp1 end
359−splitAt :: Int -> Array a -> (Array a, Array a)
360−splitAt i arr = undefined
362−-- XXX This operation can be performed efficiently via streams.
363−-- | Append two arrays together to create a single array.
364−splice :: Array a -> Array a -> Array a
365−splice arr1 arr2 = undefined
369-------------------------------------------------------------------------------
354-------------------------------------------------------------------------------
370-- Random reads and writes
355-- Random reads and writes
371-------------------------------------------------------------------------------
356-------------------------------------------------------------------------------