on master help sign in
Change the naming scheme to make it more intuitive
e44e5b0Harendra Kumar
design/module-organization.md+40−20
@@ -143,12 +143,25 @@ conflict with any other module on Hackage.
143We have the following module hierarchy under Streamly:
143We have the following module hierarchy under Streamly:
144
144
145* Data: This is a generic bucket for basic data structures a la the `base`
145* Data: This is a generic bucket for basic data structures a la the `base`
146− package's `Data` hierarchy.
146+ package's `Data` hierarchy.
147+ * Streamly.Data.Array
148+
149+ Streams can be classified under `Data` or `Control`. Though they are
150+ mostly used for processing, they can also be used to store data in
151+ memory.
152+ * Streamly.Data.Stream
153+
154+ The following modules could in fact be classified under `Control`
155+ too as they are about processing of data rather than data itself:
156+ * Streamly.Data.Unfold
157+ * Streamly.Data.Fold
158+ * Streamly.Data.Parser
147
159
148* Unicode: Unicode text processing:
160* Unicode: Unicode text processing:
149− * Streamly.Unicode.Char
161+ * Streamly.Unicode.Char -- operations on individual chars
150− * Streamly.Unicode.Stream
162+ * Streamly.Unicode.Stream -- operations on streams of Char
151− * Streamly.Unicode.Array
163+ * Streamly.Unicode.Array.Char -- compact strings of UTF-32 chars
164+ * Streamly.Unicode.Array.Utf8 -- compact strings of UTF-8 encoded chars
152
165
153* FileSystem: This name space is for data structures that reside in files
166* FileSystem: This name space is for data structures that reside in files
154 provided by a file system interface on top of storage devices.
167 provided by a file system interface on top of storage devices.
@@ -183,13 +196,13 @@ these remain the same as the base type:
183* `Streamly.Data.Stream.Async.RoundRobin`
196* `Streamly.Data.Stream.Async.RoundRobin`
184* ...
197* ...
185
198
186−Pure streams are a special case of effectful streams and go in
199+Pure streams are a special case of effectful streams and have the same
187−specialized modules suffixed with `Pure`:
200+interface as lists, so we put them under `Streamly.Data.List`:
188
201
189−* `Streamly.Data.Stream.Pure`
202+* `Streamly.Data.List`
190−* `Streamly.Data.Stream.Zip.Pure`
203+* `Streamly.Data.List.Zip`
191−* `Streamly.Data.Stream.Interleaved.Pure`
204+* `Streamly.Data.List.Interleaved`
192−* `Streamly.Data.Stream.RoundRobin.Pure`
205+* `Streamly.Data.List.RoundRobin`
193* ...
206* ...
194
207
195We could possibly use the same type named `Stream` for all stream
208We could possibly use the same type named `Stream` for all stream
@@ -198,30 +211,37 @@ distinguish only by the module name.
198
211
199## Array modules
212## Array modules
200
213
201−Similarly, the Array modules would go in:
214+Similarly, the immutable Array modules would go in:
215+
216+* `Streamly.Data.Array` -- unpinned, native memory arrays
217+* `Streamly.Data.Array.Storable` -- unpinned, unboxed, native memory arrays
218+* `Streamly.Data.Array.Storable.Pinned` -- pinned, unboxed, native memory arrays
219+* `Streamly.Data.Array.Storable.Foreign` -- pinned, unboxed, foreign capable arrays
220+
221+Unboxed arrays, based on `Prim` type class:
202
222
203−* `Streamly.Data.Array`
204* `Streamly.Data.Array.Prim`
223* `Streamly.Data.Array.Prim`
205* `Streamly.Data.Array.Prim.Pinned`
224* `Streamly.Data.Array.Prim.Pinned`
206−* ...
207
225
208−Pure arrays are just a special case of mutable arrays:
226+Mutable arrays are a generalization of immutable arrays:
209
227
210−* `Streamly.Data.Array.Pure`
228+* `Streamly.Data.Array.Mut`
211−* `Streamly.Data.Array.Prim.Pure`
229+* `Streamly.Data.Array.Storable.Mut`
212−* `Streamly.Data.Array.Prim.Pinned.Pure`
230+* `Streamly.Data.Array.Storable.Pinned.Mut`
213* ...
231* ...
214
232
215## Stream and Fold Channels (SVar)
233## Stream and Fold Channels (SVar)
216
234
217* `Streamly.Data.Stream.Channel`
235* `Streamly.Data.Stream.Channel`
218−* `Streamly.Data.Stream.Channel.Prim`
236+* `Streamly.Data.Stream.Channel.Storable`
219* `Streamly.Data.Fold.Channel`
237* `Streamly.Data.Fold.Channel`
220−* `Streamly.Data.Fold.Channel.Prim`
238+* `Streamly.Data.Fold.Channel.Storable`
221
239
222## Mutable variables
240## Mutable variables
223
241
242+Unboxed IORef:
243+
224−* `Streamly.Data.MutVar.Prim`
244+* `Streamly.Data.IORef.Prim`
225
245
226## Strict Data
246## Strict Data
227
247