on master help sign in
remove fold API exports from Streamly.Internal

They are now exported via Streamly.Internal.Data.Fold

commitae847b821f6b7bce1b24b3b170d4586d60a90582 authorHarendra Kumar <harendra.kumar@gmail.com> dateMon 23 Sep 2019, 00:06 (7 years ago) parent885a66f
4 files changed+25−38
benchmark/Linear.hs+3−3 examples/WordClassifier.hs+3−3 src/Streamly/Internal.hs−21 src/Streamly/Internal/Data/Fold.hs+19−11
benchmark/Linear.hs+3−3
@@ -20,7 +20,7 @@ import qualified Streamly.Benchmark.Prelude as Ops
2020
2121import Streamly
2222import qualified Streamly.Data.Fold as FL
23−import qualified Streamly.Internal as Internal
23+import qualified Streamly.Internal.Data.Fold.Types as IFL
2424import qualified Streamly.Internal.Prelude as IP
2525--import qualified Streamly.Pipe as Pipe
2626import qualified Streamly.Memory.Array as A
@@ -235,7 +235,7 @@ main =
235235 , benchIOSink "foldMap" (S.runFold (FL.foldMap (Last . Just)))
236236
237237 , benchIOSink "toList" (S.runFold FL.toList)
238− , benchIOSink "toListRevF" (S.runFold Internal.toListRevF)
238+ , benchIOSink "toListRevF" (S.runFold IFL.toListRevF)
239239 , benchIOSink "toStream" (S.runFold IP.toStream)
240240 , benchIOSink "toStreamRev" (S.runFold IP.toStreamRev)
241241 , benchIOSink "writeN" (S.runFold (A.writeN Ops.value))
@@ -263,7 +263,7 @@ main =
263263 ]
264264 , bgroup "folds-transforms"
265265 [ 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))
267267 {-, benchIOSink "pipe-mapM"
268268 (S.runFold (FL.transform (Pipe.mapM (\x -> return $ x + 1)) FL.drain))-}
269269 ]
examples/WordClassifier.hs+3−3
@@ -19,16 +19,16 @@ import Foreign.Storable (Storable(..))
1919import qualified Streamly.Data.String as Streamly
2020import qualified Streamly.FileSystem.Handle as FH
2121import qualified Streamly.Data.Fold as FL
22−import qualified Streamly.Internal as Streamly
22+import qualified Streamly.Internal.Data.Fold as Internal
2323import qualified Streamly.Memory.Array as A
2424import qualified Streamly.Prelude as Streamly
2525import System.Environment (getArgs)
2626import System.IO (openFile, IOMode(..))
2727
2828instance (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)
3030 hashWithSalt salt arr = runIdentity $
31− Streamly.runFold (Streamly.rollingHashWithSalt salt) (A.read arr)
31+ Streamly.runFold (Internal.rollingHashWithSalt salt) (A.read arr)
3232
3333{-# INLINE toLower #-}
3434toLower :: Char -> Char
src/Streamly/Internal.hs−21
@@ -21,24 +21,6 @@ module Streamly.Internal
2121 -- * Diagnostics
2222 inspectMode
2323
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−
4224 -- * Streamly.Unfold Experimental Exports
4325 , Unfold (..)
4426 , fromList
@@ -54,6 +36,3 @@ import Streamly.Memory.Array.Types (readU)
5436import Streamly.Streams.Combinators (inspectMode)
5537import Streamly.Unfold.Types (Unfold(..))
5638import 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
3030 -- >>> S.runFold FL.sum (S.enumerateFromTo 1 100)
3131 -- 5050
3232
33− Fold -- (..)
33+ Fold (..)
3434
3535 -- , tail
3636 -- , init
@@ -66,6 +66,7 @@ module Streamly.Internal.Data.Fold
6666 -- detrimental to performance if the input is large.
6767
6868 , toList
69+ , toListRevF -- experimental
6970
7071 -- ** Partial Folds
7172 -- , drainN
@@ -113,15 +114,15 @@ module Streamly.Internal.Data.Fold
113114
114115 -- ** Mapping
115116 --, transform
116− -- , lmap
117+ , lmap
117118 --, lsequence
118− -- , lmapM
119−
120− -- -- ** Filtering
121− -- , lfilter
122− -- , lfilterM
119+ , lmapM
120+ -- ** Filtering
121+ , lfilter
122+ , lfilterM
123123 -- , ldeleteBy
124124 -- , luniq
125+ , lcatMaybes
125126
126127 {-
127128 -- ** Mapping Filters
@@ -142,18 +143,21 @@ module Streamly.Internal.Data.Fold
142143 , lreverse
143144 -}
144145
145− {-
146146 -- * Parsing
147147 -- ** Trimming
148148 , ltake
149149 -- , lrunFor -- time
150150 , ltakeWhile
151+ {-
151152 , ltakeWhileM
152153 , ldrop
153154 , ldropWhile
154155 , ldropWhileM
155156 -}
156157
158+ , lsessionsOf
159+ , lchunksOf
160+
157161 -- * Distributing
158162 -- |
159163 -- The 'Applicative' instance of a distributing 'Fold' distributes one copy
@@ -219,10 +223,14 @@ module Streamly.Internal.Data.Fold
219223 -- , unzipWith
220224 -- , unzipWithM
221225
222− -- -- * Nested Folds
226+ -- * Running Folds
227+ , initialize
228+ , runStep
229+
230+ -- * Nested Folds
223231 -- , concatMap
224232 -- , chunksOf
225− -- , duplicate -- experimental
233+ , duplicate -- experimental
226234 )
227235where
228236
@@ -240,8 +248,8 @@ import Prelude
240248import qualified Data.Map.Strict as Map
241249import qualified Prelude
242250
243−import Streamly.Internal.Data.Fold.Types (Fold(..), lmap)
244251import Streamly.Pipe.Types (Pipe (..), PipeState(..))
252+import Streamly.Internal.Data.Fold.Types
245253import Streamly.Strict
246254
247255import qualified Streamly.Pipe.Types as Pipe