on master help sign in
remove fold API exports from Streamly.Internal
ae847b8Harendra Kumar
benchmark/Linear.hs+3−3
@@ -20,7 +20,7 @@ import qualified Streamly.Benchmark.Prelude as Ops
20
20
21import Streamly
21import Streamly
22import qualified Streamly.Data.Fold as FL
22import qualified Streamly.Data.Fold as FL
23−import qualified Streamly.Internal as Internal
23+import qualified Streamly.Internal.Data.Fold.Types as IFL
24import qualified Streamly.Internal.Prelude as IP
24import qualified Streamly.Internal.Prelude as IP
25--import qualified Streamly.Pipe as Pipe
25--import qualified Streamly.Pipe as Pipe
26import qualified Streamly.Memory.Array as A
26import qualified Streamly.Memory.Array as A
@@ -235,7 +235,7 @@ main =
235 , benchIOSink "foldMap" (S.runFold (FL.foldMap (Last . Just)))
235 , benchIOSink "foldMap" (S.runFold (FL.foldMap (Last . Just)))
236
236
237 , benchIOSink "toList" (S.runFold FL.toList)
237 , benchIOSink "toList" (S.runFold FL.toList)
238− , benchIOSink "toListRevF" (S.runFold Internal.toListRevF)
238+ , benchIOSink "toListRevF" (S.runFold IFL.toListRevF)
239 , benchIOSink "toStream" (S.runFold IP.toStream)
239 , benchIOSink "toStream" (S.runFold IP.toStream)
240 , benchIOSink "toStreamRev" (S.runFold IP.toStreamRev)
240 , benchIOSink "toStreamRev" (S.runFold IP.toStreamRev)
241 , benchIOSink "writeN" (S.runFold (A.writeN Ops.value))
241 , benchIOSink "writeN" (S.runFold (A.writeN Ops.value))
@@ -263,7 +263,7 @@ main =
263 ]
263 ]
264 , bgroup "folds-transforms"
264 , bgroup "folds-transforms"
265 [ benchIOSink "drain" (S.runFold FL.drain)
265 [ benchIOSink "drain" (S.runFold FL.drain)
266− , benchIOSink "lmap" (S.runFold (Internal.lmap (+1) FL.drain))
266+ , benchIOSink "lmap" (S.runFold (IFL.lmap (+1) FL.drain))
267 {-, benchIOSink "pipe-mapM"
267 {-, benchIOSink "pipe-mapM"
268 (S.runFold (FL.transform (Pipe.mapM (\x -> return $ x + 1)) FL.drain))-}
268 (S.runFold (FL.transform (Pipe.mapM (\x -> return $ x + 1)) FL.drain))-}
269 ]
269 ]
examples/WordClassifier.hs+3−3
@@ -19,16 +19,16 @@ import Foreign.Storable (Storable(..))
19import qualified Streamly.Data.String as Streamly
19import qualified Streamly.Data.String as Streamly
20import qualified Streamly.FileSystem.Handle as FH
20import qualified Streamly.FileSystem.Handle as FH
21import qualified Streamly.Data.Fold as FL
21import qualified Streamly.Data.Fold as FL
22−import qualified Streamly.Internal as Streamly
22+import qualified Streamly.Internal.Data.Fold as Internal
23import qualified Streamly.Memory.Array as A
23import qualified Streamly.Memory.Array as A
24import qualified Streamly.Prelude as Streamly
24import qualified Streamly.Prelude as Streamly
25import System.Environment (getArgs)
25import System.Environment (getArgs)
26import System.IO (openFile, IOMode(..))
26import System.IO (openFile, IOMode(..))
27
27
28instance (Enum a, Storable a) => Hashable (A.Array a) where
28instance (Enum a, Storable a) => Hashable (A.Array a) where
29− hash arr = runIdentity $ Streamly.runFold Streamly.rollingHash (A.read arr)
29+ hash arr = runIdentity $ Streamly.runFold Internal.rollingHash (A.read arr)
30 hashWithSalt salt arr = runIdentity $
30 hashWithSalt salt arr = runIdentity $
31− Streamly.runFold (Streamly.rollingHashWithSalt salt) (A.read arr)
31+ Streamly.runFold (Internal.rollingHashWithSalt salt) (A.read arr)
32
32
33{-# INLINE toLower #-}
33{-# INLINE toLower #-}
34toLower :: Char -> Char
34toLower :: Char -> Char
src/Streamly/Internal.hs−21
@@ -21,24 +21,6 @@ module Streamly.Internal
21 -- * Diagnostics
21 -- * Diagnostics
22 inspectMode
22 inspectMode
23
23
24− -- * Streamly.Internal.Data.Fold Experimental Exports
25− , Fold (..)
26− , toListRevF
27− , rollingHash
28− , rollingHashWithSalt
29− , lmap
30− , lmapM
31− , lfilter
32− , lfilterM
33− , lcatMaybes
34− , ltake
35− , ltakeWhile
36− , lsessionsOf
37− , lchunksOf
38− , duplicate
39− , initialize
40− , runStep
41−
42 -- * Streamly.Unfold Experimental Exports
24 -- * Streamly.Unfold Experimental Exports
43 , Unfold (..)
25 , Unfold (..)
44 , fromList
26 , fromList
@@ -54,6 +36,3 @@ import Streamly.Memory.Array.Types (readU)
54import Streamly.Streams.Combinators (inspectMode)
36import Streamly.Streams.Combinators (inspectMode)
55import Streamly.Unfold.Types (Unfold(..))
37import Streamly.Unfold.Types (Unfold(..))
56import Streamly.Unfold (fromList)
38import Streamly.Unfold (fromList)
57−
58−import Streamly.Internal.Data.Fold
59−import Streamly.Internal.Data.Fold.Types
src/Streamly/Internal/Data/Fold.hs+19−11
@@ -30,7 +30,7 @@ module Streamly.Internal.Data.Fold
30 -- >>> S.runFold FL.sum (S.enumerateFromTo 1 100)
30 -- >>> S.runFold FL.sum (S.enumerateFromTo 1 100)
31 -- 5050
31 -- 5050
32
32
33− Fold -- (..)
33+ Fold (..)
34
34
35 -- , tail
35 -- , tail
36 -- , init
36 -- , init
@@ -66,6 +66,7 @@ module Streamly.Internal.Data.Fold
66 -- detrimental to performance if the input is large.
66 -- detrimental to performance if the input is large.
67
67
68 , toList
68 , toList
69+ , toListRevF -- experimental
69
70
70 -- ** Partial Folds
71 -- ** Partial Folds
71 -- , drainN
72 -- , drainN
@@ -113,15 +114,15 @@ module Streamly.Internal.Data.Fold
113
114
114 -- ** Mapping
115 -- ** Mapping
115 --, transform
116 --, transform
116− -- , lmap
117+ , lmap
117 --, lsequence
118 --, lsequence
118− -- , lmapM
119+ , lmapM
119−
120− -- -- ** Filtering
120+ -- ** Filtering
121− -- , lfilter
121+ , lfilter
122− -- , lfilterM
122+ , lfilterM
123 -- , ldeleteBy
123 -- , ldeleteBy
124 -- , luniq
124 -- , luniq
125+ , lcatMaybes
125
126
126 {-
127 {-
127 -- ** Mapping Filters
128 -- ** Mapping Filters
@@ -142,18 +143,21 @@ module Streamly.Internal.Data.Fold
142 , lreverse
143 , lreverse
143 -}
144 -}
144
145
145− {-
146 -- * Parsing
146 -- * Parsing
147 -- ** Trimming
147 -- ** Trimming
148 , ltake
148 , ltake
149 -- , lrunFor -- time
149 -- , lrunFor -- time
150 , ltakeWhile
150 , ltakeWhile
151+ {-
151 , ltakeWhileM
152 , ltakeWhileM
152 , ldrop
153 , ldrop
153 , ldropWhile
154 , ldropWhile
154 , ldropWhileM
155 , ldropWhileM
155 -}
156 -}
156
157
158+ , lsessionsOf
159+ , lchunksOf
160+
157 -- * Distributing
161 -- * Distributing
158 -- |
162 -- |
159 -- The 'Applicative' instance of a distributing 'Fold' distributes one copy
163 -- The 'Applicative' instance of a distributing 'Fold' distributes one copy
@@ -219,10 +223,14 @@ module Streamly.Internal.Data.Fold
219 -- , unzipWith
223 -- , unzipWith
220 -- , unzipWithM
224 -- , unzipWithM
221
225
226+ -- * Running Folds
227+ , initialize
228+ , runStep
229+
222− -- -- * Nested Folds
230+ -- * Nested Folds
223 -- , concatMap
231 -- , concatMap
224 -- , chunksOf
232 -- , chunksOf
225− -- , duplicate -- experimental
233+ , duplicate -- experimental
226 )
234 )
227where
235where
228
236
@@ -240,8 +248,8 @@ import Prelude
240import qualified Data.Map.Strict as Map
248import qualified Data.Map.Strict as Map
241import qualified Prelude
249import qualified Prelude
242
250
243−import Streamly.Internal.Data.Fold.Types (Fold(..), lmap)
244import Streamly.Pipe.Types (Pipe (..), PipeState(..))
251import Streamly.Pipe.Types (Pipe (..), PipeState(..))
252+import Streamly.Internal.Data.Fold.Types
245import Streamly.Strict
253import Streamly.Strict
246
254
247import qualified Streamly.Pipe.Types as Pipe
255import qualified Streamly.Pipe.Types as Pipe