on master help sign in
Change the naming scheme to make it more intuitive
commite44e5b04e9df40301054c2ab1474835f54402905 authorHarendra Kumar <harendra@composewell.com> dateSat 18 Jul 2020, 23:03 (6 years ago) parent18d9d9e
1 file changed+40−20
design/module-organization.md+40−20
design/module-organization.md+40−20
@@ -143,12 +143,25 @@ conflict with any other module on Hackage.
143143We have the following module hierarchy under Streamly:
144144
145145* 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
147159
148160* Unicode: Unicode text processing:
149− * Streamly.Unicode.Char
150− * Streamly.Unicode.Stream
151− * Streamly.Unicode.Array
161+ * Streamly.Unicode.Char -- operations on individual chars
162+ * Streamly.Unicode.Stream -- operations on streams of Char
163+ * Streamly.Unicode.Array.Char -- compact strings of UTF-32 chars
164+ * Streamly.Unicode.Array.Utf8 -- compact strings of UTF-8 encoded chars
152165
153166* FileSystem: This name space is for data structures that reside in files
154167 provided by a file system interface on top of storage devices.
@@ -183,13 +196,13 @@ these remain the same as the base type:
183196* `Streamly.Data.Stream.Async.RoundRobin`
184197* ...
185198
186−Pure streams are a special case of effectful streams and go in
187−specialized modules suffixed with `Pure`:
199+Pure streams are a special case of effectful streams and have the same
200+interface as lists, so we put them under `Streamly.Data.List`:
188201
189−* `Streamly.Data.Stream.Pure`
190−* `Streamly.Data.Stream.Zip.Pure`
191−* `Streamly.Data.Stream.Interleaved.Pure`
192−* `Streamly.Data.Stream.RoundRobin.Pure`
202+* `Streamly.Data.List`
203+* `Streamly.Data.List.Zip`
204+* `Streamly.Data.List.Interleaved`
205+* `Streamly.Data.List.RoundRobin`
193206* ...
194207
195208We could possibly use the same type named `Stream` for all stream
@@ -198,30 +211,37 @@ distinguish only by the module name.
198211
199212## Array modules
200213
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:
202222
203−* `Streamly.Data.Array`
204223* `Streamly.Data.Array.Prim`
205224* `Streamly.Data.Array.Prim.Pinned`
206−* ...
207225
208−Pure arrays are just a special case of mutable arrays:
226+Mutable arrays are a generalization of immutable arrays:
209227
210−* `Streamly.Data.Array.Pure`
211−* `Streamly.Data.Array.Prim.Pure`
212−* `Streamly.Data.Array.Prim.Pinned.Pure`
228+* `Streamly.Data.Array.Mut`
229+* `Streamly.Data.Array.Storable.Mut`
230+* `Streamly.Data.Array.Storable.Pinned.Mut`
213231* ...
214232
215233## Stream and Fold Channels (SVar)
216234
217235* `Streamly.Data.Stream.Channel`
218−* `Streamly.Data.Stream.Channel.Prim`
236+* `Streamly.Data.Stream.Channel.Storable`
219237* `Streamly.Data.Fold.Channel`
220−* `Streamly.Data.Fold.Channel.Prim`
238+* `Streamly.Data.Fold.Channel.Storable`
221239
222240## Mutable variables
223241
224−* `Streamly.Data.MutVar.Prim`
242+Unboxed IORef:
243+
244+* `Streamly.Data.IORef.Prim`
225245
226246## Strict Data
227247