on master help sign in
Hide readIndex for now, update comments for arrays
70bbd5cHarendra Kumar
src/Streamly/Benchmark/FileIO/Array.hs+1−1
@@ -67,7 +67,7 @@ last inh = do
67 larr <- S.last s
67 larr <- S.last s
68 return $ case larr of
68 return $ case larr of
69 Nothing -> Nothing
69 Nothing -> Nothing
70− Just arr -> A.readIndex arr (A.length arr - 1)
70+ Just arr -> IA.readIndex arr (A.length arr - 1)
71
71
72#ifdef INSPECTION
72#ifdef INSPECTION
73inspect $ hasNoTypeClasses 'last
73inspect $ hasNoTypeClasses 'last
src/Streamly/Internal/Memory/Array.hs+42−14
@@ -56,35 +56,63 @@ module Streamly.Internal.Memory.Array
56 -- Monadic APIs
56 -- Monadic APIs
57 -- , newArray
57 -- , newArray
58 , A.writeN -- drop new
58 , A.writeN -- drop new
59− , A.write -- full buffer
59+ , A.write -- full buffer
60 -- , writeLastN -- drop old (ring buffer)
60 -- , writeLastN -- drop old (ring buffer)
61
61
62 -- * Elimination
62 -- * Elimination
63− -- 'GHC.Exts.toList' from "GHC.Exts" can be used to convert an array to a
64− -- list.
65
63
66 , A.toList
64 , A.toList
67 , toStream
65 , toStream
68 , toStreamRev
66 , toStreamRev
69 , read
67 , read
68+ -- , readChunksOf
70
69
71 -- * Random Access
70 -- * Random Access
72 , length
71 , length
73 , null
72 , null
73+ , last
74 -- , (!!)
74 -- , (!!)
75−
76 , readIndex
75 , readIndex
77− , last
76+ -- , readIndices
78− {-
77+ -- , readRanges
79− , readSlice
78+
80− , readSliceRev
79+ -- , readFrom -- read from a given position to the end of file
81− -}
80+ -- , readFromRev -- read from a given position to the beginning of file
81+ -- , readTo -- read from beginning up to the given position
82+ -- , readToRev -- read from end to the given position in file
83+ -- , readFromTo
84+ -- , readFromThenTo
85+
86+ -- , readChunksOfFrom
87+ -- , ...
88+
89+ -- , writeIndex
90+ -- , writeFrom -- start writing at the given position
91+ -- , writeFromRev
92+ -- , writeTo -- write from beginning up to the given position
93+ -- , writeToRev
94+ -- , writeFromTo
95+ -- , writeFromThenTo
96+ --
97+ -- , writeChunksOfFrom
98+ -- , ...
82
99
83 , writeIndex
100 , writeIndex
84− {-
101+ --, writeIndices
85− , writeSlice
102+ --, writeRanges
86− , writeSliceRev
103+
87− -}
104+ -- -- * Search
105+ -- , bsearch
106+ -- , bsearchIndex
107+ -- , find
108+ -- , findIndex
109+ -- , findIndices
110+
111+ -- -- * In-pace mutation (for Mutable Array type)
112+ -- , partitionBy
113+ -- , shuffleBy
114+ -- , foldtWith
115+ -- , foldbWith
88
116
89 -- * Immutable Transformations
117 -- * Immutable Transformations
90 , streamTransform
118 , streamTransform
@@ -324,7 +352,7 @@ foldbWith level f = undefined
324
352
325-- | /O(1)/ Lookup the element at the given index, starting from 0.
353-- | /O(1)/ Lookup the element at the given index, starting from 0.
326--
354--
327−-- @since 0.7.0
355+-- /Internal/
328{-# INLINE readIndex #-}
356{-# INLINE readIndex #-}
329readIndex :: Storable a => Array a -> Int -> Maybe a
357readIndex :: Storable a => Array a -> Int -> Maybe a
330readIndex arr i =
358readIndex arr i =
src/Streamly/Memory/Array.hs+2−6
@@ -45,8 +45,6 @@ module Streamly.Memory.Array
45 (
45 (
46 A.Array
46 A.Array
47
47
48− -- , defaultChunkSize
49−
50 -- * Arrays
48 -- * Arrays
51 -- ** Construction
49 -- ** Construction
52 -- | When performance matters, the fastest way to generate an array is
50 -- | When performance matters, the fastest way to generate an array is
@@ -61,9 +59,8 @@ module Streamly.Memory.Array
61 , A.fromList
59 , A.fromList
62
60
63 -- Monadic APIs
61 -- Monadic APIs
64− -- , newArray
65 , A.writeN -- drop new
62 , A.writeN -- drop new
66− , A.write -- full buffer
63+ , A.write -- full buffer
67 -- , writeLastN -- drop old (ring buffer)
64 -- , writeLastN -- drop old (ring buffer)
68
65
69 -- ** Elimination
66 -- ** Elimination
@@ -76,8 +73,7 @@ module Streamly.Memory.Array
76 -- ** Random Access
73 -- ** Random Access
77 , A.length
74 , A.length
78 -- , (!!)
75 -- , (!!)
79−
80− , A.readIndex
76+ -- , A.readIndex
81 )
77 )
82where
78where
83
79