on master help sign in
stop exporting ArrayStream APIs from Array module
b8b3e17Harendra Kumar
examples/HandleIO.hs+3−2
@@ -1,6 +1,7 @@
1import qualified Streamly.Prelude as S
1import qualified Streamly.Prelude as S
2import qualified Streamly.Data.Fold as FL
2import qualified Streamly.Data.Fold as FL
3−import qualified Streamly.Memory.Array as A
3+-- import qualified Streamly.Memory.Array as A
4+import qualified Streamly.Internal.Memory.ArrayStream as AS
4import qualified Streamly.FileSystem.Handle as FH
5import qualified Streamly.FileSystem.Handle as FH
5import qualified System.IO as FH
6import qualified System.IO as FH
6-- import qualified Streamly.FileSystem.FD as FH
7-- import qualified Streamly.FileSystem.FD as FH
@@ -25,7 +26,7 @@ ord' = (fromIntegral . ord)
25
26
26wcl :: FH.Handle -> IO ()
27wcl :: FH.Handle -> IO ()
27wcl src = print =<< (S.length
28wcl src = print =<< (S.length
28− $ A.splitOn 10
29+ $ AS.splitOn 10
29 $ FH.readArrays src)
30 $ FH.readArrays src)
30{-
31{-
31-- Char stream version
32-- Char stream version
src/Streamly/Benchmark/FileIO/Array.hs+5−4
@@ -44,6 +44,7 @@ import qualified Streamly.Memory.Array as A
44import qualified Streamly.Prelude as S
44import qualified Streamly.Prelude as S
45import qualified Streamly.Data.String as SS
45import qualified Streamly.Data.String as SS
46import qualified Streamly.Internal.Prelude as Internal
46import qualified Streamly.Internal.Prelude as Internal
47+import qualified Streamly.Internal.Memory.ArrayStream as AS
47
48
48#ifdef INSPECTION
49#ifdef INSPECTION
49import Foreign.Storable (Storable)
50import Foreign.Storable (Storable)
@@ -81,7 +82,7 @@ inspect $ 'countBytes `hasNoType` ''Step
81-- | Count the number of lines in a file.
82-- | Count the number of lines in a file.
82{-# INLINE countLines #-}
83{-# INLINE countLines #-}
83countLines :: Handle -> IO Int
84countLines :: Handle -> IO Int
84−countLines = S.length . A.splitOnSuffix 10 . FH.readArrays
85+countLines = S.length . AS.splitOnSuffix 10 . FH.readArrays
85
86
86#ifdef INSPECTION
87#ifdef INSPECTION
87inspect $ hasNoTypeClasses 'countLines
88inspect $ hasNoTypeClasses 'countLines
@@ -92,7 +93,7 @@ inspect $ 'countLines `hasNoType` ''Step
92-- | Count the number of lines in a file.
93-- | Count the number of lines in a file.
93{-# INLINE countWords #-}
94{-# INLINE countWords #-}
94countWords :: Handle -> IO Int
95countWords :: Handle -> IO Int
95−countWords = S.length . A.splitOn 32 . FH.readArrays
96+countWords = S.length . AS.splitOn 32 . FH.readArrays
96
97
97#ifdef INSPECTION
98#ifdef INSPECTION
98inspect $ hasNoTypeClasses 'countWords
99inspect $ hasNoTypeClasses 'countWords
@@ -141,7 +142,7 @@ linesUnlinesCopy :: Handle -> Handle -> IO ()
141linesUnlinesCopy inh outh =
142linesUnlinesCopy inh outh =
142 S.runFold (FH.writeArraysInChunksOf (1024*1024) outh)
143 S.runFold (FH.writeArraysInChunksOf (1024*1024) outh)
143 $ Internal.insertAfterEach (return $ A.fromList [10])
144 $ Internal.insertAfterEach (return $ A.fromList [10])
144− $ A.splitOnSuffix 10
145+ $ AS.splitOnSuffix 10
145 $ FH.readArraysOf (1024*1024) inh
146 $ FH.readArraysOf (1024*1024) inh
146
147
147#ifdef INSPECTION
148#ifdef INSPECTION
@@ -156,7 +157,7 @@ wordsUnwordsCopy inh outh =
156 S.runFold (FH.writeArraysInChunksOf (1024*1024) outh)
157 S.runFold (FH.writeArraysInChunksOf (1024*1024) outh)
157 $ S.intersperse (A.fromList [32])
158 $ S.intersperse (A.fromList [32])
158 -- XXX use a word splitting combinator
159 -- XXX use a word splitting combinator
159− $ A.splitOn 32
160+ $ AS.splitOn 32
160 $ FH.readArraysOf (1024*1024) inh
161 $ FH.readArraysOf (1024*1024) inh
161
162
162#ifdef INSPECTION
163#ifdef INSPECTION
src/Streamly/Memory/Array.hs−15
@@ -120,20 +120,6 @@ module Streamly.Memory.Array
120 -- , runStreamFold
120 -- , runStreamFold
121 , runFold
121 , runFold
122 -}
122 -}
123−
124− -- * Streams of Arrays
125− -- -- ** Creation
126− -- , AS.arraysOf
127−
128− -- -- ** Elimination
129− -- , AS.concat
130− -- , AS.concatRev
131− -- , AS.toArray
132−
133− -- ** Transformation
134− , AS.splitOn
135− , AS.splitOnSuffix
136− -- , AS.compact -- compact
137 )
123 )
138where
124where
139
125
@@ -149,7 +135,6 @@ import Streamly.Streams.StreamK.Type (IsStream)
149import Streamly.Internal.Data.Fold.Types (Fold(..))
135import Streamly.Internal.Data.Fold.Types (Fold(..))
150
136
151import qualified Streamly.Internal.Memory.Array.Types as A
137import qualified Streamly.Internal.Memory.Array.Types as A
152−import qualified Streamly.Internal.Memory.ArrayStream as AS
153import qualified Streamly.Streams.Prelude as P
138import qualified Streamly.Streams.Prelude as P
154import qualified Streamly.Streams.Serial as Serial
139import qualified Streamly.Streams.Serial as Serial
155import qualified Streamly.Streams.StreamD as D
140import qualified Streamly.Streams.StreamD as D
test/String.hs+2−1
@@ -13,6 +13,7 @@ import Test.QuickCheck.Monadic (run, monadicIO, assert)
13import Test.Hspec as H
13import Test.Hspec as H
14
14
15import qualified Streamly.Memory.Array as A
15import qualified Streamly.Memory.Array as A
16+import qualified Streamly.Internal.Memory.ArrayStream as AS
16import qualified Streamly.Prelude as S
17import qualified Streamly.Prelude as S
17import qualified Streamly.Data.String as SS
18import qualified Streamly.Data.String as SS
18
19
@@ -75,7 +76,7 @@ testLinesArray =
75 monadicIO $ do
76 monadicIO $ do
76 xs <- S.toList
77 xs <- S.toList
77 $ S.map A.toList
78 $ S.map A.toList
78− $ A.splitOnSuffix 10
79+ $ AS.splitOnSuffix 10
79 $ S.yield (A.fromList list)
80 $ S.yield (A.fromList list)
80 assert (xs == map (map (fromIntegral . ord))
81 assert (xs == map (map (fromIntegral . ord))
81 (lines (map (chr . fromIntegral) list)))
82 (lines (map (chr . fromIntegral) list)))