on master help sign in
Cleanup and rearrange exports
0abf713Harendra Kumar
src/Streamly/Internal/Data/Array/Foreign.hs+37−52
@@ -36,8 +36,6 @@ module Streamly.Internal.Data.Array.Foreign
36 (
36 (
37 Array
37 Array
38
38
39− -- , defaultChunkSize
40−
41 -- * Construction
39 -- * Construction
42
40
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
57
55
58− -- Monadic APIs
56+ -- Monadic Folds
59− -- , newArray
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
64
61
65 -- * Elimination
62 -- * Elimination
66−
67 , A.toList
63 , A.toList
68 , A.toStream
64 , A.toStream
69 , A.toStreamRev
65 , A.toStreamRev
70 , read
66 , read
71− , producer
72− , unsafeRead
67+ , unsafeRead -- XXX readUnsafe?
73 , A.readRev
68 , A.readRev
74− -- , readChunksOf
69+ , producer -- experimental
75
70
76 -- * Random Access
71 -- * Random Access
77− , length
78− , null
79− , last
80 -- , (!!)
72 -- , (!!)
81 , getIndex
73 , getIndex
82− , A.unsafeIndex
74+ , A.unsafeIndex -- XXX Rename to getIndexUnsafe??
83− -- , readIndices
75+ -- , getIndexRev
84− -- , readRanges
76+ , last -- XXX getIndexLast?
85−
77+ -- , getIndices
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
90− -- , readFromTo
84+
91− -- , readFromThenTo
85+ -- * Size
92−
86+ , length
93− -- , readChunksOfFrom
87+ , null
94− -- , ...
95−
96− -- -- * Search
97− -- , bsearch
98− -- , bsearchIndex
99− -- , find
100− -- , findIndex
101− -- , findIndices
102−
103− , unsafeSlice
104
88
105− -- * Immutable Transformations
89+ -- * Search
106− , streamTransform
90+ -- , binarySearch
91+ -- , findIndicesOf
92+ -- , findIndexOf
93+ -- , find
107
94
108 -- * Casting
95 -- * Casting
109 , cast
96 , cast
110− , unsafeCast
111− , unsafeAsPtr
112 , asBytes
97 , asBytes
98+ , unsafeCast -- castUnsafe?
99+ , unsafeAsPtr -- asPtrUnsafe?
113− , unsafeAsCString
100+ , unsafeAsCString -- asCStringUnsafe?
101+ , A.unsafeFreeze -- asImmutableUnsafe?
102+ , A.unsafeThaw -- asMutableUnsafe?
114
103
104+ -- * Subarrays
105+ , unsafeSlice
106+ -- , getSlice
107+ -- , getSlicesFromLenN
108+
109+ -- * Streaming Operations
110+ , streamTransform
111+
115− -- * Folding Arrays
112+ -- ** Folding
116 , streamFold
113 , streamFold
117 , fold
114 , fold
118 )
115 )
@@ -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.
332
329
333-------------------------------------------------------------------------------
330-------------------------------------------------------------------------------
334−-- Slice and splice
331+-- Slice
335-------------------------------------------------------------------------------
332-------------------------------------------------------------------------------
336
333
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
356
353
357−{-
358−
359−splitAt :: Int -> Array a -> (Array a, Array a)
360−splitAt i arr = undefined
361−
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
366−
367−-}
368−
369-------------------------------------------------------------------------------
354-------------------------------------------------------------------------------
370-- Random reads and writes
355-- Random reads and writes
371-------------------------------------------------------------------------------
356-------------------------------------------------------------------------------