on master help sign in
Move Data.Array to Data.Array.Generic
commit64d337474bf7dacee5ba4ed083ba1b0b6230bf44 authorRanjeet Kumar Ranjan <ranjeetr@composewell.com> dateThu 3 Nov 2022, 13:42 (4 years ago) parentb0ff88f
15 files changed+36−34
benchmark/Streamly/Benchmark/Data/Array.hs → benchmark/Streamly/Benchmark/Data/Array/Generic.hs+3−3 benchmark/streamly-benchmarks.cabal+2−2 core/src/Streamly/Data/Array.hs → core/src/Streamly/Data/Array/Generic.hs+4−4 core/src/Streamly/Internal/Data/Array.hs → core/src/Streamly/Internal/Data/Array/Generic.hs+3−3 core/src/Streamly/Internal/Data/Array/Mut/Type.hs → core/src/Streamly/Internal/Data/Array/Generic/Mut/Type.hs+4−4 core/src/Streamly/Internal/Data/Ring.hs+1−1 core/src/Streamly/Internal/Data/Stream/Top.hs+1−1 core/streamly-core.cabal+3−3 docs/Developer/Tests.md+2−2 docs/Developer/module-organization.md+2−2 src/Streamly/Internal/Data/SmallArray.hs+1−1 src/Streamly/Internal/Data/Stream/IsStream/Top.hs+1−1 streamly.cabal+3−1 test/Streamly/Test/Data/Array.hs → test/Streamly/Test/Data/Array/Generic.hs+3−3 test/streamly-tests.cabal+3−3
benchmark/Streamly/Benchmark/Data/Array.hs → benchmark/Streamly/Benchmark/Data/Array/Generic.hsrenamed+3−3
@@ -6,8 +6,8 @@
66
77import Control.DeepSeq (deepseq)
88
9−import qualified Streamly.Internal.Data.Array as IA
10−import qualified Streamly.Internal.Data.Array as A
9+import qualified Streamly.Internal.Data.Array.Generic as IA
10+import qualified Streamly.Internal.Data.Array.Generic as A
1111type Stream = A.Array
1212
1313#include "Streamly/Benchmark/Data/Array/Common.hs"
@@ -95,7 +95,7 @@ o_n_heap_serial value =
9595 ]
9696
9797moduleName :: String
98−moduleName = "Data.Array"
98+moduleName = "Data.Array.Generic"
9999
100100defStreamSize :: Int
101101defStreamSize = defaultStreamSize
benchmark/streamly-benchmarks.cabal+2−2
@@ -551,11 +551,11 @@ benchmark Prelude.Rate
551551-- Array Benchmarks
552552-------------------------------------------------------------------------------
553553
554−benchmark Data.Array
554+benchmark Data.Array.Generic
555555 import: bench-options
556556 type: exitcode-stdio-1.0
557557 hs-source-dirs: .
558− main-is: Streamly/Benchmark/Data/Array.hs
558+ main-is: Streamly/Benchmark/Data/Array/Generic.hs
559559 if flag(use-streamly-core)
560560 buildable: False
561561 else
core/src/Streamly/Data/Array.hs → core/src/Streamly/Data/Array/Generic.hsrenamed+4−4
@@ -1,5 +1,5 @@
11-- |
2−-- Module : Streamly.Data.Array
2+-- Module : Streamly.Data.Array.Generic
33-- Copyright : (c) 2019 Composewell Technologies
44--
55-- License : BSD-3-Clause
@@ -7,7 +7,7 @@
77-- Stability : experimental
88-- Portability : GHC
99--
10−module Streamly.Data.Array
10+module Streamly.Data.Array.Generic
1111 ( Array
1212
1313 -- * Construction
@@ -38,6 +38,6 @@ module Streamly.Data.Array
3838 )
3939where
4040
41−import Streamly.Internal.Data.Array (Array)
41+import Streamly.Internal.Data.Array.Generic (Array)
4242
43−import qualified Streamly.Internal.Data.Array as A
43+import qualified Streamly.Internal.Data.Array.Generic as A
core/src/Streamly/Internal/Data/Array.hs → core/src/Streamly/Internal/Data/Array/Generic.hsrenamed+3−3
@@ -3,7 +3,7 @@
33#include "inline.hs"
44
55-- |
6−-- Module : Streamly.Internal.Data.Array
6+-- Module : Streamly.Internal.Data.Array.Generic
77-- Copyright : (c) 2019 Composewell Technologies
88--
99-- License : BSD-3-Clause
@@ -11,7 +11,7 @@
1111-- Stability : pre-release
1212-- Portability : GHC
1313--
14−module Streamly.Internal.Data.Array
14+module Streamly.Internal.Data.Array.Generic
1515 ( Array(..)
1616
1717 -- * Construction
@@ -62,7 +62,7 @@ import Streamly.Internal.Data.Stream.Type (Stream)
6262import Streamly.Internal.Data.Tuple.Strict (Tuple'(..), Tuple3'(..))
6363import Streamly.Internal.Data.Unfold.Type (Unfold(..))
6464
65−import qualified Streamly.Internal.Data.Array.Mut.Type as MArray
65+import qualified Streamly.Internal.Data.Array.Generic.Mut.Type as MArray
6666import qualified Streamly.Internal.Data.Fold.Type as FL
6767import qualified Streamly.Internal.Data.Ring as RB
6868import qualified Streamly.Internal.Data.Stream.StreamD as D
core/src/Streamly/Internal/Data/Array/Mut/Type.hs → core/src/Streamly/Internal/Data/Array/Generic/Mut/Type.hsrenamed+4−4
@@ -1,14 +1,14 @@
11{-# LANGUAGE UnboxedTuples #-}
22
33-- |
4−-- Module : Streamly.Internal.Data.Array.Mut.Type
4+-- Module : Streamly.Internal.Data.Array.Generic.Mut.Type
55-- Copyright : (c) 2020 Composewell Technologies
66-- License : BSD3-3-Clause
77-- Maintainer : streamly@composewell.com
88-- Stability : experimental
99-- Portability : GHC
1010--
11−module Streamly.Internal.Data.Array.Mut.Type
11+module Streamly.Internal.Data.Array.Generic.Mut.Type
1212(
1313 -- * Type
1414 -- $arrayNotes
@@ -182,7 +182,7 @@ import Prelude hiding (read)
182182
183183-- $setup
184184-- >>> :m
185−-- >>> import qualified Streamly.Internal.Data.Array.Mut.Type as Array
185+-- >>> import qualified Streamly.Internal.Data.Array.Generic.Mut.Type as Array
186186-- >>> import qualified Streamly.Internal.Data.Stream as Stream
187187-- >>> import qualified Streamly.Internal.Data.Stream.StreamD as StreamD
188188-- >>> import qualified Streamly.Internal.Data.Fold as Fold
@@ -223,7 +223,7 @@ bottomElement =
223223
224224 where
225225
226− funcName = "Streamly.Internal.Data.Array.Mut.Type.bottomElement:"
226+ funcName = "Streamly.Internal.Data.Array.Generic.Mut.Type.bottomElement:"
227227
228228-- XXX Would be nice if GHC can provide something like newUninitializedArray# so
229229-- that we do not have to write undefined or error in the whole array.
core/src/Streamly/Internal/Data/Ring.hs+1−1
@@ -14,7 +14,7 @@ module Streamly.Internal.Data.Ring
1414 ) where
1515
1616import Data.IORef (modifyIORef', newIORef, readIORef, writeIORef, IORef)
17−import Streamly.Internal.Data.Array.Mut.Type
17+import Streamly.Internal.Data.Array.Generic.Mut.Type
1818 ( Array(..)
1919 , newArray
2020 , putIndexUnsafe
core/src/Streamly/Internal/Data/Stream/Top.hs+1−1
@@ -53,7 +53,7 @@ import Streamly.Internal.Data.Stream.Common ()
5353import Streamly.Internal.Data.Stream.Type (Stream, fromStreamD, toStreamD)
5454
5555import qualified Data.List as List
56−import qualified Streamly.Internal.Data.Array as Array
56+import qualified Streamly.Internal.Data.Array.Generic as Array
5757import qualified Streamly.Internal.Data.Array.Unboxed.Mut.Type as MA
5858import qualified Streamly.Internal.Data.Fold as Fold
5959import qualified Streamly.Internal.Data.Parser as Parser
core/streamly-core.cabal+3−3
@@ -277,7 +277,7 @@ library
277277 , Streamly.Internal.Data.Array.Unboxed.Mut.Type
278278 , Streamly.Internal.Data.Array.Unboxed.Mut
279279 , Streamly.Internal.Data.Array.Unboxed.Type
280− , Streamly.Internal.Data.Array.Mut.Type
280+ , Streamly.Internal.Data.Array.Generic.Mut.Type
281281
282282 -- streamly-core-streams
283283 -- StreamD depends on streamly-array-types
@@ -318,7 +318,7 @@ library
318318 , Streamly.Internal.Data.List
319319
320320 -- streamly-core-data-arrays
321− , Streamly.Internal.Data.Array
321+ , Streamly.Internal.Data.Array.Generic
322322 , Streamly.Internal.Data.Array.Unboxed
323323 , Streamly.Internal.Data.Array.Unboxed.Mut.Stream
324324 , Streamly.Internal.Data.Array.Unboxed.Fold
@@ -375,7 +375,7 @@ library
375375 -- streamly-core released modules in alphabetic order
376376 -- NOTE: these must be added to streamly.cabal as well
377377 , Streamly.Console.Stdio
378− , Streamly.Data.Array
378+ , Streamly.Data.Array.Generic
379379 , Streamly.Data.Array.Unboxed
380380 , Streamly.Data.Array.Unboxed.Mut
381381 , Streamly.Data.Fold
docs/Developer/Tests.md+2−2
@@ -133,7 +133,7 @@ $ cabal-docspec --timeout 60 --check-properties --property-variables xs
133133## Naming of test modules
134134
135135Tests are organized by source modules. For example, for the source
136−module `Streamly.Data.Array` and `Streamly.Internal.Data.Array` we have
137−a test module `Data.Array`. For some modules tests for a source module
136+module `Streamly.Data.Array.Generic` and `Streamly.Internal.Data.Array.Generic` we have
137+a test module `Data.Array.Generic`. For some modules tests for a source module
138138are broken into multiple modules. For example, for `Streamly.Prelude` we have
139139`Streamly.Prelude.Serial`, `Streamly.Prelude.Async` etc.
docs/Developer/module-organization.md+2−2
@@ -144,7 +144,7 @@ We have the following module hierarchy under Streamly:
144144
145145* Data: This is a generic bucket for basic data structures a la the `base`
146146 package's `Data` hierarchy.
147− * Streamly.Data.Array
147+ * Streamly.Data.Array.Generic
148148
149149 Streams can be classified under `Data` or `Control`. Though they are
150150 mostly used for processing, they can also be used to store data in
@@ -213,7 +213,7 @@ distinguish only by the module name.
213213
214214Similarly, the immutable Array modules would go in:
215215
216−* `Streamly.Data.Array` -- unpinned, native memory arrays
216+* `Streamly.Data.Array.Generic` -- unpinned, native memory arrays
217217* `Streamly.Data.Array.Storable` -- unpinned, unboxed, native memory arrays
218218* `Streamly.Data.Array.Storable.Pinned` -- pinned, unboxed, native memory arrays
219219* `Streamly.Data.Array.Foreign` -- pinned, unboxed, foreign capable arrays
src/Streamly/Internal/Data/SmallArray.hs+1−1
@@ -104,7 +104,7 @@ foldr f z arr = runIdentity $ D.foldr f z $ toStreamD arr
104104-- 'SmallArray'.
105105--
106106-- Since we are folding to a 'SmallArray' @n@ should be <= 128, for larger number
107−-- of elements use an 'Array' from either "Streamly.Data.Array" or "Streamly.Data.Array.Foreign".
107+-- of elements use an 'Array' from either "Streamly.Data.Array.Generic" or "Streamly.Data.Array.Foreign".
108108{-# INLINE_NORMAL writeN #-}
109109writeN :: MonadIO m => Int -> Fold m a (SmallArray a)
110110writeN len = FL.Fold step initial extract
src/Streamly/Internal/Data/Stream/IsStream/Top.hs+1−1
@@ -69,7 +69,7 @@ import Streamly.Internal.Data.Time.Units (NanoSecond64(..), toRelTime64)
6969
7070import qualified Data.List as List
7171import qualified Data.Map.Strict as Map
72−import qualified Streamly.Internal.Data.Array as Array
72+import qualified Streamly.Internal.Data.Array.Generic as Array
7373 (fromStream, length, read)
7474import qualified Streamly.Data.Array.Unboxed.Mut as MA
7575import qualified Streamly.Internal.Data.Fold as Fold
streamly.cabal+3−1
@@ -54,6 +54,7 @@ extra-source-files:
5454 benchmark/Streamly/Benchmark/Data/*.hs
5555 benchmark/Streamly/Benchmark/Data/Array/Common.hs
5656 benchmark/Streamly/Benchmark/Data/Array/CommonImports.hs
57+ benchmark/Streamly/Benchmark/Data/Array/Generic.hs
5758 benchmark/Streamly/Benchmark/Data/Array/SmallArray.hs
5859 benchmark/Streamly/Benchmark/Data/Array/Unboxed.hs
5960 benchmark/Streamly/Benchmark/Data/Ring/Unboxed.hs
@@ -91,6 +92,7 @@ extra-source-files:
9192 test/Streamly/Test/Data/*.hs
9293 test/Streamly/Test/Data/Array/CommonImports.hs
9394 test/Streamly/Test/Data/Array/Common.hs
95+ test/Streamly/Test/Data/Array/Generic.hs
9496 test/Streamly/Test/Data/Array/Unboxed.hs
9597 test/Streamly/Test/Data/Array/Unboxed/Mut.hs
9698 test/Streamly/Test/Data/Ring/Unboxed.hs
@@ -433,7 +435,7 @@ library
433435 reexported-modules:
434436 -- streamly-core exposed modules
435437 , Streamly.Console.Stdio
436− , Streamly.Data.Array
438+ , Streamly.Data.Array.Generic
437439 , Streamly.Data.Array.Unboxed
438440 , Streamly.Data.Array.Unboxed.Mut
439441 , Streamly.Data.Fold
test/Streamly/Test/Data/Array.hs → test/Streamly/Test/Data/Array/Generic.hsrenamed+3−3
@@ -1,18 +1,18 @@
11{-# OPTIONS_GHC -Wno-deprecations #-}
22
33-- |
4−-- Module : Streamly.Test.Data.Array
4+-- Module : Streamly.Test.Data.Array.Generic
55-- Copyright : (c) 2019 Composewell Technologies
66-- License : BSD-3-Clause
77-- Maintainer : streamly@composewell.com
88-- Stability : experimental
99-- Portability : GHC
1010
11−module Streamly.Test.Data.Array (main) where
11+module Streamly.Test.Data.Array.Generic (main) where
1212
1313#include "Streamly/Test/Data/Array/CommonImports.hs"
1414
15−import qualified Streamly.Internal.Data.Array as A
15+import qualified Streamly.Internal.Data.Array.Generic as A
1616
1717type Array = A.Array
1818
test/streamly-tests.cabal+3−3
@@ -225,11 +225,11 @@ test-suite Data.List.Base
225225 type: exitcode-stdio-1.0
226226 main-is: Streamly/Test/Data/List.hs
227227
228−test-suite Data.Array
228+test-suite Data.Array.Generic
229229 import: test-options
230230 type: exitcode-stdio-1.0
231− main-is: Streamly/Test/Data/Array.hs
232− ghc-options: -main-is Streamly.Test.Data.Array.main
231+ main-is: Streamly/Test/Data/Array/Generic.hs
232+ ghc-options: -main-is Streamly.Test.Data.Array.Generic.main
233233 if flag(use-streamly-core)
234234 buildable: False
235235