on master help sign in
Stop exposing internal Prelude functions via Internal
ee6be00Harendra Kumar
benchmark/Linear.hs+3−2
@@ -21,6 +21,7 @@ import qualified Streamly.Benchmark.Prelude as Ops
21import Streamly
21import Streamly
22import qualified Streamly.Fold as FL
22import qualified Streamly.Fold as FL
23import qualified Streamly.Internal as Internal
23import qualified Streamly.Internal as Internal
24+import qualified Streamly.Internal.Prelude as IP
24--import qualified Streamly.Pipe as Pipe
25--import qualified Streamly.Pipe as Pipe
25import qualified Streamly.Memory.Array as A
26import qualified Streamly.Memory.Array as A
26import qualified Streamly.Prelude as S
27import qualified Streamly.Prelude as S
@@ -235,8 +236,8 @@ main =
235
236
236 , benchIOSink "toList" (S.runFold FL.toList)
237 , benchIOSink "toList" (S.runFold FL.toList)
237 , benchIOSink "toListRevF" (S.runFold Internal.toListRevF)
238 , benchIOSink "toListRevF" (S.runFold Internal.toListRevF)
238− , benchIOSink "toStream" (S.runFold Internal.toStream)
239+ , benchIOSink "toStream" (S.runFold IP.toStream)
239− , benchIOSink "toStreamRev" (S.runFold Internal.toStreamRev)
240+ , benchIOSink "toStreamRev" (S.runFold IP.toStreamRev)
240 , benchIOSink "writeN" (S.runFold (A.writeN Ops.value))
241 , benchIOSink "writeN" (S.runFold (A.writeN Ops.value))
241
242
242 , benchIOSink "index" (S.runFold (FL.index Ops.maxValue))
243 , benchIOSink "index" (S.runFold (FL.index Ops.maxValue))
src/Streamly/Benchmark/FileIO/Array.hs+1−1
@@ -43,7 +43,7 @@ import qualified Streamly.FileSystem.Handle as FH
43import qualified Streamly.Memory.Array as A
43import 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
46−import qualified Streamly.Internal as Internal
46+import qualified Streamly.Internal.Prelude as Internal
47
47
48#ifdef INSPECTION
48#ifdef INSPECTION
49import Foreign.Storable (Storable)
49import Foreign.Storable (Storable)
src/Streamly/Benchmark/FileIO/Stream.hs+7−6
@@ -63,6 +63,7 @@ import qualified Streamly.Internal.Prelude as S
63import qualified Streamly.Fold as FL
63import qualified Streamly.Fold as FL
64import qualified Streamly.Data.String as SS
64import qualified Streamly.Data.String as SS
65import qualified Streamly.Internal as Internal
65import qualified Streamly.Internal as Internal
66+import qualified Streamly.Internal.Prelude as IP
66import qualified Streamly.Streams.StreamD as D
67import qualified Streamly.Streams.StreamD as D
67
68
68#ifdef INSPECTION
69#ifdef INSPECTION
@@ -134,7 +135,7 @@ countLinesU inh =
134 S.length
135 S.length
135 $ SS.foldLines FL.drain
136 $ SS.foldLines FL.drain
136 $ SS.decodeChar8
137 $ SS.decodeChar8
137− $ Internal.concatMapU Internal.readU (FH.readArrays inh)
138+ $ IP.concatMapU Internal.readU (FH.readArrays inh)
138
139
139#ifdef INSPECTION
140#ifdef INSPECTION
140inspect $ hasNoTypeClasses 'countLinesU
141inspect $ hasNoTypeClasses 'countLinesU
@@ -343,7 +344,7 @@ isSp = isSpace . chr . fromIntegral
343wordsUnwordsCopyWord8 :: Handle -> Handle -> IO ()
344wordsUnwordsCopyWord8 :: Handle -> Handle -> IO ()
344wordsUnwordsCopyWord8 inh outh =
345wordsUnwordsCopyWord8 inh outh =
345 S.runFold (FH.write outh)
346 S.runFold (FH.write outh)
346− $ Internal.concatMapU Internal.fromList
347+ $ IP.concatMapU Internal.fromList
347 $ S.intersperse [32]
348 $ S.intersperse [32]
348 $ S.wordsBy isSp FL.toList
349 $ S.wordsBy isSp FL.toList
349 $ FH.read inh
350 $ FH.read inh
@@ -360,7 +361,7 @@ wordsUnwordsCopy :: Handle -> Handle -> IO ()
360wordsUnwordsCopy inh outh =
361wordsUnwordsCopy inh outh =
361 S.runFold (FH.write outh)
362 S.runFold (FH.write outh)
362 $ SS.encodeChar8
363 $ SS.encodeChar8
363− $ Internal.concatMapU Internal.fromList
364+ $ IP.concatMapU Internal.fromList
364 $ S.intersperse " "
365 $ S.intersperse " "
365 -- Array allocation is too expensive for such small strings. So just use
366 -- Array allocation is too expensive for such small strings. So just use
366 -- lists instead.
367 -- lists instead.
@@ -439,7 +440,7 @@ inspect $ 'wordsBy `hasNoType` ''D.ConcatMapUState
439{-# INLINE splitOnSeq #-}
440{-# INLINE splitOnSeq #-}
440splitOnSeq :: String -> Handle -> IO Int
441splitOnSeq :: String -> Handle -> IO Int
441splitOnSeq str inh =
442splitOnSeq str inh =
442− (S.length $ Internal.splitOnSeq (toarr str) FL.drain
443+ (S.length $ IP.splitOnSeq (toarr str) FL.drain
443 $ FH.read inh) -- >>= print
444 $ FH.read inh) -- >>= print
444
445
445#ifdef INSPECTION
446#ifdef INSPECTION
@@ -453,7 +454,7 @@ inspect $ hasNoTypeClasses 'splitOnSeq
453{-# INLINE splitOnSeqUtf8 #-}
454{-# INLINE splitOnSeqUtf8 #-}
454splitOnSeqUtf8 :: String -> Handle -> IO Int
455splitOnSeqUtf8 :: String -> Handle -> IO Int
455splitOnSeqUtf8 str inh =
456splitOnSeqUtf8 str inh =
456− (S.length $ Internal.splitOnSeq (A.fromList str) FL.drain
457+ (S.length $ IP.splitOnSeq (A.fromList str) FL.drain
457 $ SS.decodeUtf8ArraysLenient
458 $ SS.decodeUtf8ArraysLenient
458 $ FH.readArrays inh) -- >>= print
459 $ FH.readArrays inh) -- >>= print
459
460
@@ -461,7 +462,7 @@ splitOnSeqUtf8 str inh =
461{-# INLINE splitOnSuffixSeq #-}
462{-# INLINE splitOnSuffixSeq #-}
462splitOnSuffixSeq :: String -> Handle -> IO Int
463splitOnSuffixSeq :: String -> Handle -> IO Int
463splitOnSuffixSeq str inh =
464splitOnSuffixSeq str inh =
464− (S.length $ Internal.splitOnSuffixSeq (toarr str) FL.drain
465+ (S.length $ IP.splitOnSuffixSeq (toarr str) FL.drain
465 $ FH.read inh) -- >>= print
466 $ FH.read inh) -- >>= print
466
467
467#ifdef INSPECTION
468#ifdef INSPECTION
src/Streamly/Benchmark/Prelude.hs+1−1
@@ -45,7 +45,7 @@ import qualified Streamly.Streams.StreamD as D
45
45
46import qualified Streamly as S hiding (foldMapWith, runStream)
46import qualified Streamly as S hiding (foldMapWith, runStream)
47import qualified Streamly.Prelude as S
47import qualified Streamly.Prelude as S
48−import qualified Streamly.Internal as Internal
48+import qualified Streamly.Internal.Prelude as Internal
49import qualified Streamly.Unfold as UF
49import qualified Streamly.Unfold as UF
50-- import qualified Streamly.Pipe as Pipe
50-- import qualified Streamly.Pipe as Pipe
51
51
src/Streamly/Internal.hs+1−11
@@ -21,17 +21,9 @@ module Streamly.Internal
21 -- * Diagnostics
21 -- * Diagnostics
22 inspectMode
22 inspectMode
23
23
24− -- * Streamly.Prelude Experimental Exports
25− , toListRevF
26− , tapAsync
27−
28− , wSerialFst
29− , wSerialMin
30− , parallelFst
31− , parallelMin
32−
33 -- * Streamly.Fold Experimental Exports
24 -- * Streamly.Fold Experimental Exports
34 , Fold (..)
25 , Fold (..)
26+ , toListRevF
35 , rollingHash
27 , rollingHash
36 , rollingHashWithSalt
28 , rollingHashWithSalt
37 , lmap
29 , lmap
@@ -60,8 +52,6 @@ import Prelude hiding (break, span, splitAt)
60
52
61import Streamly.Memory.Array.Types (readU)
53import Streamly.Memory.Array.Types (readU)
62import Streamly.Streams.Combinators (inspectMode)
54import Streamly.Streams.Combinators (inspectMode)
63−import Streamly.Streams.Parallel (tapAsync, parallelFst, parallelMin)
64−import Streamly.Streams.Serial (wSerialFst, wSerialMin)
65import Streamly.Unfold.Types (Unfold(..))
55import Streamly.Unfold.Types (Unfold(..))
66import Streamly.Unfold (fromList)
56import Streamly.Unfold (fromList)
67
57
src/Streamly/Internal/Prelude.hs+8
@@ -221,9 +221,16 @@ module Streamly.Internal.Prelude
221 , interleaveFst
221 , interleaveFst
222 , interleaveMin
222 , interleaveMin
223
223
224+ , Serial.wSerialFst
225+ , Serial.wSerialMin
226+
224 -- ** Scheduling
227 -- ** Scheduling
225 , roundrobin
228 , roundrobin
226
229
230+ -- ** Parallel
231+ , Par.parallelFst
232+ , Par.parallelMin
233+
227 -- ** Merging
234 -- ** Merging
228
235
229 -- , merge
236 -- , merge
@@ -312,6 +319,7 @@ module Streamly.Internal.Prelude
312 -- ** Distributing
319 -- ** Distributing
313 , trace
320 , trace
314 , tap
321 , tap
322+ , Par.tapAsync
315
323
316 -- * Windowed Classification
324 -- * Windowed Classification
317
325