@@ -31,33 +31,44 @@ module Streamly.Internal.Data.MutArray.Type
3131 -- ** Type
3232 -- $arrayNotes
3333 MutArray (..)
34+
35+ -- ** Conversion
36+ -- *** Pinned and Unpinned
3437 , pin
3538 , unpin
3639 , isPinned
3740
38− -- -- * Constructing and Writing
41+ -- ** Casting
42+ , cast
43+ , castUnsafe
44+ , asBytes
45+ , asPtrUnsafe
46+ , asUnpinnedPtrUnsafe
47+
3948 -- ** Construction
4049 , nil
4150
42− -- *** Uninitialized Arrays
51+ -- *** New
52+ -- | New arrays are always empty arrays with some reserve capacity to
53+ -- extend the length without reallocating.
54+ , new
55+ , newArrayWith
4356 , pinnedNew
4457 , pinnedNewBytes
4558 , pinnedNewAligned
46− , new
47− , newArrayWith
4859
49− -- ** Cloning arrays
60+ -- *** Cloning
5061 , clone
5162 , pinnedClone
5263
53− -- ** Slicing
64+ -- *** Slicing
5465 -- | Get a subarray without copying
5566 , getSliceUnsafe
5667 , getSlice
5768 , splitAt -- XXX should be able to express using getSlice
5869 , breakOn
5970
60− -- *** From streams
71+ -- *** Stream Folds
6172 , ArrayUnsafe (..)
6273 , writeNWithUnsafe
6374 , writeNWith
@@ -107,65 +118,49 @@ module Streamly.Internal.Data.MutArray.Type
107118 , swapIndices
108119 , unsafeSwapIndices
109120
110− -- ** Growing and Shrinking
111− -- | Arrays grow only at the end, though it is possible to grow on both sides
112− -- and therefore have a cons as well as snoc. But that will require two
113− -- bounds in the array representation.
121+ -- ** Reading
114122
115− -- *** Appending elements
116− , snocWith
117− , snoc
118− , snocLinear
119− , snocMay
120− , snocUnsafe
121−
122− -- *** Appending streams
123− , writeAppendNUnsafe
124− , writeAppendN
125− , writeAppendWith
126− , writeAppend
127−
128− -- *** Appending arrays
129− , spliceCopy
130− , spliceWith
131− , splice
132− , spliceExp
133− , spliceUnsafe
134− -- , putSlice
135− -- , appendSlice
136− -- , appendSliceFrom
137−
138− -- ** Eliminating and Reading
139−
140− -- *** To streams
141− , reader
142− , readerRevWith
143− , readerRev
123+ -- *** Indexing
124+ , getIndex
125+ , getIndexUnsafe
126+ , getIndices -- XXX indexReader
127+ , getIndicesWith -- XXX indexReaderWith
128+ -- , getFromThenTo
129+ , getIndexRev
144130
145− -- *** To containers
146− , toStreamWith
147− , toStreamRevWith
148− , toStreamKWith
149− , toStreamKRevWith
131+ -- *** To Streams
150132 , read
151133 , readRev
134+ , toStreamWith
135+ , toStreamRevWith
152136 , toStreamK
137+ , toStreamKWith
153138 , toStreamKRev
139+ , toStreamKRevWith
140+
141+ -- *** To Containers
154142 , toList
155143
144+ -- *** Unfolds
156145 -- experimental
157146 , producerWith
158147 , producer
159148
160− -- *** Random reads
161− , getIndex
162− , getIndexUnsafe
163− , getIndices
164− , getIndicesWith
165− -- , getFromThenTo
166− , getIndexRev
149+ , reader
150+ , readerRevWith
151+ , readerRev
152+
153+ -- ** Size and Capacity
154+ -- *** Size
155+ , length
156+ , byteLength
167157
168− -- ** Memory Management
158+ -- *** Capacity
159+ -- , capacity
160+ , byteCapacity
161+ , bytesFree
162+
163+ -- *** Capacity Management
169164 , blockSize
170165 , arrayChunkBytes
171166 , allocBytesToElemCount
@@ -174,12 +169,11 @@ module Streamly.Internal.Data.MutArray.Type
174169 , resizeExp
175170 , rightSize
176171
177− -- ** Size
178− , length
179− , byteLength
180− -- , capacity
181− , byteCapacity
182− , bytesFree
172+ -- ** Folding
173+ , foldl'
174+ , foldr
175+ , byteCmp
176+ , byteEq
183177
184178 -- ** In-place Mutation Algorithms
185179 , strip
@@ -191,19 +185,33 @@ module Streamly.Internal.Data.MutArray.Type
191185 , mergeBy
192186 , bubble
193187
194− -- ** Casting
195− , cast
196− , castUnsafe
197− , asBytes
198− , asPtrUnsafe
199− , asUnpinnedPtrUnsafe
188+ -- ** Growing and Shrinking
189+ -- | Arrays grow only at the end, though it is possible to grow on both
190+ -- sides and therefore have a cons as well as snoc. But that will require
191+ -- both lower and upper bound in the array representation.
200192
201− -- ** Folding
202− , foldl'
203− , foldr
204− , cmp
205− , byteCmp
206− , byteEq
193+ -- *** Appending elements
194+ , snocWith
195+ , snoc
196+ , snocLinear
197+ , snocMay
198+ , snocUnsafe
199+
200+ -- *** Appending streams
201+ , writeAppendNUnsafe
202+ , writeAppendN
203+ , writeAppendWith
204+ , writeAppend
205+
206+ -- *** Appending arrays
207+ , spliceCopy
208+ , spliceWith
209+ , splice
210+ , spliceExp
211+ , spliceUnsafe
212+ -- , putSlice
213+ -- , appendSlice
214+ -- , appendSliceFrom
207215
208216 -- Arrays of arrays
209217 -- We can add dimensionality parameter to the array type to get
@@ -211,21 +219,26 @@ module Streamly.Internal.Data.MutArray.Type
211219 -- convenience wrapper on top of single dimensional arrays.
212220
213221 -- ** Streams of Arrays
214− -- *** Group a stream into arrays
222+ -- *** Chunk
223+ -- | Group a stream into arrays.
215224 , chunksOf
216225 , pinnedChunksOf
217226 , buildChunks
218227
219− -- *** Split an array into slices
228+ -- *** Split
229+ -- | Split an array into slices.
230+
220231 -- , getSlicesFromLenN
221232 , splitOn
222233 -- , slicesOf
223234
224− -- *** Flatten a stream of arrays
235+ -- *** Concat
236+ -- | Append the arrays in a stream to form a stream of elements.
225237 , concatChunks
226238 , concatChunksRev
227239
228− -- *** Compaction
240+ -- *** Compact
241+ -- | Append the arrays in a stream to form a stream of larger arrays.
229242 , SpliceState (..)
230243 , pCompactChunksLE
231244 , rCompactChunksLE
@@ -247,6 +260,7 @@ module Streamly.Internal.Data.MutArray.Type
247260 , fromArrayStreamK
248261 , fromStreamDN
249262 , fromStreamD
263+ , cmp
250264 )
251265where
252266