on master help sign in
Move Data.Array to Data.Array.Generic
64d3374Ranjeet Kumar Ranjan
benchmark/Streamly/Benchmark/Data/Array.hs → benchmark/Streamly/Benchmark/Data/Array/Generic.hsrenamed+3−3
@@ -6,8 +6,8 @@
6
6
7import Control.DeepSeq (deepseq)
7import Control.DeepSeq (deepseq)
8
8
9−import qualified Streamly.Internal.Data.Array as IA
9+import qualified Streamly.Internal.Data.Array.Generic as IA
10−import qualified Streamly.Internal.Data.Array as A
10+import qualified Streamly.Internal.Data.Array.Generic as A
11type Stream = A.Array
11type Stream = A.Array
12
12
13#include "Streamly/Benchmark/Data/Array/Common.hs"
13#include "Streamly/Benchmark/Data/Array/Common.hs"
@@ -95,7 +95,7 @@ o_n_heap_serial value =
95 ]
95 ]
96
96
97moduleName :: String
97moduleName :: String
98−moduleName = "Data.Array"
98+moduleName = "Data.Array.Generic"
99
99
100defStreamSize :: Int
100defStreamSize :: Int
101defStreamSize = defaultStreamSize
101defStreamSize = defaultStreamSize
benchmark/streamly-benchmarks.cabal+2−2
@@ -551,11 +551,11 @@ benchmark Prelude.Rate
551-- Array Benchmarks
551-- Array Benchmarks
552-------------------------------------------------------------------------------
552-------------------------------------------------------------------------------
553
553
554−benchmark Data.Array
554+benchmark Data.Array.Generic
555 import: bench-options
555 import: bench-options
556 type: exitcode-stdio-1.0
556 type: exitcode-stdio-1.0
557 hs-source-dirs: .
557 hs-source-dirs: .
558− main-is: Streamly/Benchmark/Data/Array.hs
558+ main-is: Streamly/Benchmark/Data/Array/Generic.hs
559 if flag(use-streamly-core)
559 if flag(use-streamly-core)
560 buildable: False
560 buildable: False
561 else
561 else
core/src/Streamly/Data/Array.hs → core/src/Streamly/Data/Array/Generic.hsrenamed+4−4
@@ -1,5 +1,5 @@
1-- |
1-- |
2−-- Module : Streamly.Data.Array
2+-- Module : Streamly.Data.Array.Generic
3-- Copyright : (c) 2019 Composewell Technologies
3-- Copyright : (c) 2019 Composewell Technologies
4--
4--
5-- License : BSD-3-Clause
5-- License : BSD-3-Clause
@@ -7,7 +7,7 @@
7-- Stability : experimental
7-- Stability : experimental
8-- Portability : GHC
8-- Portability : GHC
9--
9--
10−module Streamly.Data.Array
10+module Streamly.Data.Array.Generic
11 ( Array
11 ( Array
12
12
13 -- * Construction
13 -- * Construction
@@ -38,6 +38,6 @@ module Streamly.Data.Array
38 )
38 )
39where
39where
40
40
41−import Streamly.Internal.Data.Array (Array)
41+import Streamly.Internal.Data.Array.Generic (Array)
42
42
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 @@
3#include "inline.hs"
3#include "inline.hs"
4
4
5-- |
5-- |
6−-- Module : Streamly.Internal.Data.Array
6+-- Module : Streamly.Internal.Data.Array.Generic
7-- Copyright : (c) 2019 Composewell Technologies
7-- Copyright : (c) 2019 Composewell Technologies
8--
8--
9-- License : BSD-3-Clause
9-- License : BSD-3-Clause
@@ -11,7 +11,7 @@
11-- Stability : pre-release
11-- Stability : pre-release
12-- Portability : GHC
12-- Portability : GHC
13--
13--
14−module Streamly.Internal.Data.Array
14+module Streamly.Internal.Data.Array.Generic
15 ( Array(..)
15 ( Array(..)
16
16
17 -- * Construction
17 -- * Construction
@@ -62,7 +62,7 @@ import Streamly.Internal.Data.Stream.Type (Stream)
62import Streamly.Internal.Data.Tuple.Strict (Tuple'(..), Tuple3'(..))
62import Streamly.Internal.Data.Tuple.Strict (Tuple'(..), Tuple3'(..))
63import Streamly.Internal.Data.Unfold.Type (Unfold(..))
63import Streamly.Internal.Data.Unfold.Type (Unfold(..))
64
64
65−import qualified Streamly.Internal.Data.Array.Mut.Type as MArray
65+import qualified Streamly.Internal.Data.Array.Generic.Mut.Type as MArray
66import qualified Streamly.Internal.Data.Fold.Type as FL
66import qualified Streamly.Internal.Data.Fold.Type as FL
67import qualified Streamly.Internal.Data.Ring as RB
67import qualified Streamly.Internal.Data.Ring as RB
68import qualified Streamly.Internal.Data.Stream.StreamD as D
68import 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 @@
1{-# LANGUAGE UnboxedTuples #-}
1{-# LANGUAGE UnboxedTuples #-}
2
2
3-- |
3-- |
4−-- Module : Streamly.Internal.Data.Array.Mut.Type
4+-- Module : Streamly.Internal.Data.Array.Generic.Mut.Type
5-- Copyright : (c) 2020 Composewell Technologies
5-- Copyright : (c) 2020 Composewell Technologies
6-- License : BSD3-3-Clause
6-- License : BSD3-3-Clause
7-- Maintainer : streamly@composewell.com
7-- Maintainer : streamly@composewell.com
8-- Stability : experimental
8-- Stability : experimental
9-- Portability : GHC
9-- Portability : GHC
10--
10--
11−module Streamly.Internal.Data.Array.Mut.Type
11+module Streamly.Internal.Data.Array.Generic.Mut.Type
12(
12(
13 -- * Type
13 -- * Type
14 -- $arrayNotes
14 -- $arrayNotes
@@ -182,7 +182,7 @@ import Prelude hiding (read)
182
182
183-- $setup
183-- $setup
184-- >>> :m
184-- >>> :m
185−-- >>> import qualified Streamly.Internal.Data.Array.Mut.Type as Array
185+-- >>> import qualified Streamly.Internal.Data.Array.Generic.Mut.Type as Array
186-- >>> import qualified Streamly.Internal.Data.Stream as Stream
186-- >>> import qualified Streamly.Internal.Data.Stream as Stream
187-- >>> import qualified Streamly.Internal.Data.Stream.StreamD as StreamD
187-- >>> import qualified Streamly.Internal.Data.Stream.StreamD as StreamD
188-- >>> import qualified Streamly.Internal.Data.Fold as Fold
188-- >>> import qualified Streamly.Internal.Data.Fold as Fold
@@ -223,7 +223,7 @@ bottomElement =
223
223
224 where
224 where
225
225
226− funcName = "Streamly.Internal.Data.Array.Mut.Type.bottomElement:"
226+ funcName = "Streamly.Internal.Data.Array.Generic.Mut.Type.bottomElement:"
227
227
228-- XXX Would be nice if GHC can provide something like newUninitializedArray# so
228-- XXX Would be nice if GHC can provide something like newUninitializedArray# so
229-- that we do not have to write undefined or error in the whole array.
229-- 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
14 ) where
14 ) where
15
15
16import Data.IORef (modifyIORef', newIORef, readIORef, writeIORef, IORef)
16import Data.IORef (modifyIORef', newIORef, readIORef, writeIORef, IORef)
17−import Streamly.Internal.Data.Array.Mut.Type
17+import Streamly.Internal.Data.Array.Generic.Mut.Type
18 ( Array(..)
18 ( Array(..)
19 , newArray
19 , newArray
20 , putIndexUnsafe
20 , putIndexUnsafe
core/src/Streamly/Internal/Data/Stream/Top.hs+1−1
@@ -53,7 +53,7 @@ import Streamly.Internal.Data.Stream.Common ()
53import Streamly.Internal.Data.Stream.Type (Stream, fromStreamD, toStreamD)
53import Streamly.Internal.Data.Stream.Type (Stream, fromStreamD, toStreamD)
54
54
55import qualified Data.List as List
55import qualified Data.List as List
56−import qualified Streamly.Internal.Data.Array as Array
56+import qualified Streamly.Internal.Data.Array.Generic as Array
57import qualified Streamly.Internal.Data.Array.Unboxed.Mut.Type as MA
57import qualified Streamly.Internal.Data.Array.Unboxed.Mut.Type as MA
58import qualified Streamly.Internal.Data.Fold as Fold
58import qualified Streamly.Internal.Data.Fold as Fold
59import qualified Streamly.Internal.Data.Parser as Parser
59import qualified Streamly.Internal.Data.Parser as Parser
core/streamly-core.cabal+3−3
@@ -277,7 +277,7 @@ library
277 , Streamly.Internal.Data.Array.Unboxed.Mut.Type
277 , Streamly.Internal.Data.Array.Unboxed.Mut.Type
278 , Streamly.Internal.Data.Array.Unboxed.Mut
278 , Streamly.Internal.Data.Array.Unboxed.Mut
279 , Streamly.Internal.Data.Array.Unboxed.Type
279 , Streamly.Internal.Data.Array.Unboxed.Type
280− , Streamly.Internal.Data.Array.Mut.Type
280+ , Streamly.Internal.Data.Array.Generic.Mut.Type
281
281
282 -- streamly-core-streams
282 -- streamly-core-streams
283 -- StreamD depends on streamly-array-types
283 -- StreamD depends on streamly-array-types
@@ -318,7 +318,7 @@ library
318 , Streamly.Internal.Data.List
318 , Streamly.Internal.Data.List
319
319
320 -- streamly-core-data-arrays
320 -- streamly-core-data-arrays
321− , Streamly.Internal.Data.Array
321+ , Streamly.Internal.Data.Array.Generic
322 , Streamly.Internal.Data.Array.Unboxed
322 , Streamly.Internal.Data.Array.Unboxed
323 , Streamly.Internal.Data.Array.Unboxed.Mut.Stream
323 , Streamly.Internal.Data.Array.Unboxed.Mut.Stream
324 , Streamly.Internal.Data.Array.Unboxed.Fold
324 , Streamly.Internal.Data.Array.Unboxed.Fold
@@ -375,7 +375,7 @@ library
375 -- streamly-core released modules in alphabetic order
375 -- streamly-core released modules in alphabetic order
376 -- NOTE: these must be added to streamly.cabal as well
376 -- NOTE: these must be added to streamly.cabal as well
377 , Streamly.Console.Stdio
377 , Streamly.Console.Stdio
378− , Streamly.Data.Array
378+ , Streamly.Data.Array.Generic
379 , Streamly.Data.Array.Unboxed
379 , Streamly.Data.Array.Unboxed
380 , Streamly.Data.Array.Unboxed.Mut
380 , Streamly.Data.Array.Unboxed.Mut
381 , Streamly.Data.Fold
381 , Streamly.Data.Fold
docs/Developer/Tests.md+2−2
@@ -133,7 +133,7 @@ $ cabal-docspec --timeout 60 --check-properties --property-variables xs
133## Naming of test modules
133## Naming of test modules
134
134
135Tests are organized by source modules. For example, for the source
135Tests are organized by source modules. For example, for the source
136−module `Streamly.Data.Array` and `Streamly.Internal.Data.Array` we have
136+module `Streamly.Data.Array.Generic` and `Streamly.Internal.Data.Array.Generic` we have
137−a test module `Data.Array`. For some modules tests for a source module
137+a test module `Data.Array.Generic`. For some modules tests for a source module
138are broken into multiple modules. For example, for `Streamly.Prelude` we have
138are broken into multiple modules. For example, for `Streamly.Prelude` we have
139`Streamly.Prelude.Serial`, `Streamly.Prelude.Async` etc.
139`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:
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
147+ * Streamly.Data.Array.Generic
148
148
149 Streams can be classified under `Data` or `Control`. Though they are
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
150 mostly used for processing, they can also be used to store data in
@@ -213,7 +213,7 @@ distinguish only by the module name.
213
213
214Similarly, the immutable Array modules would go in:
214Similarly, the immutable Array modules would go in:
215
215
216−* `Streamly.Data.Array` -- unpinned, native memory arrays
216+* `Streamly.Data.Array.Generic` -- unpinned, native memory arrays
217* `Streamly.Data.Array.Storable` -- unpinned, unboxed, native memory arrays
217* `Streamly.Data.Array.Storable` -- unpinned, unboxed, native memory arrays
218* `Streamly.Data.Array.Storable.Pinned` -- pinned, unboxed, native memory arrays
218* `Streamly.Data.Array.Storable.Pinned` -- pinned, unboxed, native memory arrays
219* `Streamly.Data.Array.Foreign` -- pinned, unboxed, foreign capable arrays
219* `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
104-- 'SmallArray'.
104-- 'SmallArray'.
105--
105--
106-- Since we are folding to a 'SmallArray' @n@ should be <= 128, for larger number
106-- 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".
108{-# INLINE_NORMAL writeN #-}
108{-# INLINE_NORMAL writeN #-}
109writeN :: MonadIO m => Int -> Fold m a (SmallArray a)
109writeN :: MonadIO m => Int -> Fold m a (SmallArray a)
110writeN len = FL.Fold step initial extract
110writeN 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)
69
69
70import qualified Data.List as List
70import qualified Data.List as List
71import qualified Data.Map.Strict as Map
71import 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
73 (fromStream, length, read)
73 (fromStream, length, read)
74import qualified Streamly.Data.Array.Unboxed.Mut as MA
74import qualified Streamly.Data.Array.Unboxed.Mut as MA
75import qualified Streamly.Internal.Data.Fold as Fold
75import qualified Streamly.Internal.Data.Fold as Fold
streamly.cabal+3−1
@@ -54,6 +54,7 @@ extra-source-files:
54 benchmark/Streamly/Benchmark/Data/*.hs
54 benchmark/Streamly/Benchmark/Data/*.hs
55 benchmark/Streamly/Benchmark/Data/Array/Common.hs
55 benchmark/Streamly/Benchmark/Data/Array/Common.hs
56 benchmark/Streamly/Benchmark/Data/Array/CommonImports.hs
56 benchmark/Streamly/Benchmark/Data/Array/CommonImports.hs
57+ benchmark/Streamly/Benchmark/Data/Array/Generic.hs
57 benchmark/Streamly/Benchmark/Data/Array/SmallArray.hs
58 benchmark/Streamly/Benchmark/Data/Array/SmallArray.hs
58 benchmark/Streamly/Benchmark/Data/Array/Unboxed.hs
59 benchmark/Streamly/Benchmark/Data/Array/Unboxed.hs
59 benchmark/Streamly/Benchmark/Data/Ring/Unboxed.hs
60 benchmark/Streamly/Benchmark/Data/Ring/Unboxed.hs
@@ -91,6 +92,7 @@ extra-source-files:
91 test/Streamly/Test/Data/*.hs
92 test/Streamly/Test/Data/*.hs
92 test/Streamly/Test/Data/Array/CommonImports.hs
93 test/Streamly/Test/Data/Array/CommonImports.hs
93 test/Streamly/Test/Data/Array/Common.hs
94 test/Streamly/Test/Data/Array/Common.hs
95+ test/Streamly/Test/Data/Array/Generic.hs
94 test/Streamly/Test/Data/Array/Unboxed.hs
96 test/Streamly/Test/Data/Array/Unboxed.hs
95 test/Streamly/Test/Data/Array/Unboxed/Mut.hs
97 test/Streamly/Test/Data/Array/Unboxed/Mut.hs
96 test/Streamly/Test/Data/Ring/Unboxed.hs
98 test/Streamly/Test/Data/Ring/Unboxed.hs
@@ -433,7 +435,7 @@ library
433 reexported-modules:
435 reexported-modules:
434 -- streamly-core exposed modules
436 -- streamly-core exposed modules
435 , Streamly.Console.Stdio
437 , Streamly.Console.Stdio
436− , Streamly.Data.Array
438+ , Streamly.Data.Array.Generic
437 , Streamly.Data.Array.Unboxed
439 , Streamly.Data.Array.Unboxed
438 , Streamly.Data.Array.Unboxed.Mut
440 , Streamly.Data.Array.Unboxed.Mut
439 , Streamly.Data.Fold
441 , Streamly.Data.Fold
test/Streamly/Test/Data/Array.hs → test/Streamly/Test/Data/Array/Generic.hsrenamed+3−3
@@ -1,18 +1,18 @@
1{-# OPTIONS_GHC -Wno-deprecations #-}
1{-# OPTIONS_GHC -Wno-deprecations #-}
2
2
3-- |
3-- |
4−-- Module : Streamly.Test.Data.Array
4+-- Module : Streamly.Test.Data.Array.Generic
5-- Copyright : (c) 2019 Composewell Technologies
5-- Copyright : (c) 2019 Composewell Technologies
6-- License : BSD-3-Clause
6-- License : BSD-3-Clause
7-- Maintainer : streamly@composewell.com
7-- Maintainer : streamly@composewell.com
8-- Stability : experimental
8-- Stability : experimental
9-- Portability : GHC
9-- Portability : GHC
10
10
11−module Streamly.Test.Data.Array (main) where
11+module Streamly.Test.Data.Array.Generic (main) where
12
12
13#include "Streamly/Test/Data/Array/CommonImports.hs"
13#include "Streamly/Test/Data/Array/CommonImports.hs"
14
14
15−import qualified Streamly.Internal.Data.Array as A
15+import qualified Streamly.Internal.Data.Array.Generic as A
16
16
17type Array = A.Array
17type Array = A.Array
18
18
test/streamly-tests.cabal+3−3
@@ -225,11 +225,11 @@ test-suite Data.List.Base
225 type: exitcode-stdio-1.0
225 type: exitcode-stdio-1.0
226 main-is: Streamly/Test/Data/List.hs
226 main-is: Streamly/Test/Data/List.hs
227
227
228−test-suite Data.Array
228+test-suite Data.Array.Generic
229 import: test-options
229 import: test-options
230 type: exitcode-stdio-1.0
230 type: exitcode-stdio-1.0
231− main-is: Streamly/Test/Data/Array.hs
231+ main-is: Streamly/Test/Data/Array/Generic.hs
232− ghc-options: -main-is Streamly.Test.Data.Array.main
232+ ghc-options: -main-is Streamly.Test.Data.Array.Generic.main
233 if flag(use-streamly-core)
233 if flag(use-streamly-core)
234 buildable: False
234 buildable: False
235
235