on master help sign in
Hide readIndex for now, update comments for arrays
commit70bbd5c5d5da70deea968d323549403e2e35726c authorHarendra Kumar <harendra.kumar@gmail.com> dateWed 6 Nov 2019, 17:53 (7 years ago) parentbe920a2
3 files changed+45−21
src/Streamly/Benchmark/FileIO/Array.hs+1−1 src/Streamly/Internal/Memory/Array.hs+42−14 src/Streamly/Memory/Array.hs+2−6
src/Streamly/Benchmark/FileIO/Array.hs+1−1
@@ -67,7 +67,7 @@ last inh = do
6767 larr <- S.last s
6868 return $ case larr of
6969 Nothing -> Nothing
70− Just arr -> A.readIndex arr (A.length arr - 1)
70+ Just arr -> IA.readIndex arr (A.length arr - 1)
7171
7272#ifdef INSPECTION
7373inspect $ hasNoTypeClasses 'last
src/Streamly/Internal/Memory/Array.hs+42−14
@@ -56,35 +56,63 @@ module Streamly.Internal.Memory.Array
5656 -- Monadic APIs
5757 -- , newArray
5858 , A.writeN -- drop new
59− , A.write -- full buffer
59+ , A.write -- full buffer
6060 -- , writeLastN -- drop old (ring buffer)
6161
6262 -- * Elimination
63− -- 'GHC.Exts.toList' from "GHC.Exts" can be used to convert an array to a
64− -- list.
6563
6664 , A.toList
6765 , toStream
6866 , toStreamRev
6967 , read
68+ -- , readChunksOf
7069
7170 -- * Random Access
7271 , length
7372 , null
73+ , last
7474 -- , (!!)
75−
7675 , readIndex
77− , last
78− {-
79− , readSlice
80− , readSliceRev
81− -}
76+ -- , readIndices
77+ -- , readRanges
78+
79+ -- , readFrom -- read from a given position to the end of file
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+ -- , ...
8299
83100 , writeIndex
84− {-
85− , writeSlice
86− , writeSliceRev
87− -}
101+ --, writeIndices
102+ --, writeRanges
103+
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
88116
89117 -- * Immutable Transformations
90118 , streamTransform
@@ -324,7 +352,7 @@ foldbWith level f = undefined
324352
325353-- | /O(1)/ Lookup the element at the given index, starting from 0.
326354--
327−-- @since 0.7.0
355+-- /Internal/
328356{-# INLINE readIndex #-}
329357readIndex :: Storable a => Array a -> Int -> Maybe a
330358readIndex arr i =
src/Streamly/Memory/Array.hs+2−6
@@ -45,8 +45,6 @@ module Streamly.Memory.Array
4545 (
4646 A.Array
4747
48− -- , defaultChunkSize
49−
5048 -- * Arrays
5149 -- ** Construction
5250 -- | When performance matters, the fastest way to generate an array is
@@ -61,9 +59,8 @@ module Streamly.Memory.Array
6159 , A.fromList
6260
6361 -- Monadic APIs
64− -- , newArray
6562 , A.writeN -- drop new
66− , A.write -- full buffer
63+ , A.write -- full buffer
6764 -- , writeLastN -- drop old (ring buffer)
6865
6966 -- ** Elimination
@@ -76,8 +73,7 @@ module Streamly.Memory.Array
7673 -- ** Random Access
7774 , A.length
7875 -- , (!!)
79−
80− , A.readIndex
76+ -- , A.readIndex
8177 )
8278where
8379