on master help sign in
Merge pull request #228 from composewell/hide-modules

Hide modules whose apis have not yet been finalised for 0.7.0

commit82c090d6ab020942fd9b929e922ba4f01e3f064c authorHarendra Kumar <harendra.kumar@gmail.com> dateWed 31 Jul 2019, 02:34 (7 years ago) parent15e28aac9cbe3a
8 files changed+60−50
Changelog.md+1−8 benchmark/Linear.hs+5−5 benchmark/LinearOps.hs+15−7 examples/FileSinkServer.hs+6−3 examples/FromFileClient.hs+7−3 src/Streamly/Fold.hs+14−12 src/Streamly/Prelude.hs+4−4 streamly.cabal+8−8
Changelog.md+1−8
@@ -35,16 +35,9 @@ multiple folds without breaking the stream. Combinators are provided for
3535temporal and spatial window based fold operations, for example, to support
3636folding and aggregating data for timeout or inactivity based sessions.
3737
38−#### Composable Pipes
39−
40−`Streamly.Pipes` module provides composable pipes (stream consumers and
41−producers). Pipes can partition, split or distribute a stream into multiple
42−streams, apply transformations on each stream and merge back the results into a
43−single stream.
44−
4538#### Streaming File IO
4639
47−`Streamly.FileSystem.File` provides handle based streaming file IO
40+`Streamly.FileSystem.Handle` provides handle based streaming file IO
4841operations.
4942
5043#### Streaming Network IO
benchmark/Linear.hs+5−5
@@ -20,7 +20,7 @@ import qualified LinearOps as Ops
2020
2121import Streamly
2222import qualified Streamly.Fold as FL
23−import qualified Streamly.Pipe as Pipe
23+--import qualified Streamly.Pipe as Pipe
2424import qualified Streamly.Mem.Array as A
2525import qualified Streamly.Prelude as S
2626-- import qualified Streamly.Sink as Sink
@@ -242,15 +242,15 @@ main =
242242 , bgroup "folds-transforms"
243243 [ benchIOSink "drain" (FL.foldl' FL.drain)
244244 , benchIOSink "lmap" (FL.foldl' (FL.lmap (+1) FL.drain))
245− , benchIOSink "pipe-mapM"
246− (FL.foldl' (FL.transform (Pipe.mapM (\x -> return $ x + 1)) FL.drain))
245+ {-, benchIOSink "pipe-mapM"
246+ (FL.foldl' (FL.transform (Pipe.mapM (\x -> return $ x + 1)) FL.drain))-}
247247 ]
248248 , bgroup "folds-compositions" -- Applicative
249249 [
250250 benchIOSink "all,any" (FL.foldl' ((,) <$> FL.all (<= Ops.maxValue)
251251 <*> FL.any (> Ops.maxValue)))
252252 , benchIOSink "sum,length" (FL.foldl' ((,) <$> FL.sum <*> FL.length))
253− ]
253+ ] {-
254254 , bgroup "pipes"
255255 [ benchIOSink "mapM" (Ops.transformMapM serially 1)
256256 , benchIOSink "compose" (Ops.transformComposeMapM serially 1)
@@ -262,7 +262,7 @@ main =
262262 , benchIOSink "compose" (Ops.transformComposeMapM serially 4)
263263 , benchIOSink "tee" (Ops.transformTeeMapM serially 4)
264264 , benchIOSink "zip" (Ops.transformZipMapM serially 4)
265− ]
265+ ] -}
266266 , bgroup "transformation"
267267 [ benchIOSink "scanl" (Ops.scan 1)
268268 , benchIOSink "scanl1'" (Ops.scanl1' 1)
benchmark/LinearOps.hs+15−7
@@ -30,7 +30,7 @@ import GHC.Generics (Generic)
3030
3131import qualified Streamly as S hiding (foldMapWith, runStream)
3232import qualified Streamly.Prelude as S
33−import qualified Streamly.Pipe as Pipe
33+-- import qualified Streamly.Pipe as Pipe
3434
3535value, maxValue, value2 :: Int
3636#ifdef LINEAR_ASYNC
@@ -370,14 +370,9 @@ scan, scanl1', map, fmap, mapMaybe, filterEven, filterAllOut,
370370mapMaybeM, intersperse :: S.MonadAsync m => Int -> Stream m Int -> m ()
371371
372372{-# INLINE mapM #-}
373−{-# INLINE transformMapM #-}
374−{-# INLINE transformComposeMapM #-}
375−{-# INLINE transformTeeMapM #-}
376−{-# INLINE transformZipMapM #-}
377373{-# INLINE map' #-}
378374{-# INLINE fmap' #-}
379−mapM, map', transformMapM, transformComposeMapM, transformTeeMapM,
380− transformZipMapM :: (S.IsStream t, S.MonadAsync m)
375+mapM, map' :: (S.IsStream t, S.MonadAsync m)
381376 => (t m Int -> S.SerialT m Int) -> Int -> t m Int -> m ()
382377
383378fmap' :: (S.IsStream t, S.MonadAsync m, P.Functor (t m))
@@ -395,6 +390,18 @@ map n = composeN n $ S.map (+1)
395390map' t n = composeN' n $ t . S.map (+1)
396391mapM t n = composeN' n $ t . S.mapM return
397392
393+-- Temporarily commented these ops as they depend on the hidden
394+-- Pipe module.
395+{-
396+{-# INLINE transformMapM #-}
397+{-# INLINE transformComposeMapM #-}
398+{-# INLINE transformTeeMapM #-}
399+{-# INLINE transformZipMapM #-}
400+
401+transformMapM, transformComposeMapM, transformTeeMapM,
402+ transformZipMapM :: (S.IsStream t, S.MonadAsync m)
403+ => (t m Int -> S.SerialT m Int) -> Int -> t m Int -> m ()
404+
398405transformMapM t n = composeN' n $ t . S.transform (Pipe.mapM return)
399406transformComposeMapM t n = composeN' n $ t . S.transform
400407 (Pipe.mapM (\x -> return (x + 1))
@@ -405,6 +412,7 @@ transformTeeMapM t n = composeN' n $ t . S.transform
405412transformZipMapM t n = composeN' n $ t . S.transform
406413 (Pipe.zipWith (+) (Pipe.mapM (\x -> return (x + 1)))
407414 (Pipe.mapM (\x -> return (x + 2))))
415+-}
408416
409417mapMaybe n = composeN n $ S.mapMaybe
410418 (\x -> if Prelude.odd x then Nothing else Just x)
examples/FileSinkServer.hs+6−3
@@ -9,21 +9,24 @@ import System.Environment (getArgs)
99
1010import Streamly
1111import Streamly.String
12−import qualified Streamly.FileSystem.File as File
12+import qualified Streamly.FileSystem.Handle as FH
1313import qualified Streamly.Fold as FL
1414import qualified Streamly.Mem.Array as A
1515import qualified Streamly.Network.Socket as NS
1616import qualified Streamly.Network.Server as NS
1717import qualified Streamly.Prelude as S
1818
19+import System.IO (withFile, IOMode(..))
20+
1921main :: IO ()
2022main = do
2123 file <- fmap head getArgs
22− File.append file
24+ withFile file AppendMode
25+ (\src -> FH.write src
2326 $ encodeChar8Unchecked
2427 $ S.concatMap A.read
2528 $ S.concatMapBy parallel (flip NS.withSocketS recv)
26− $ NS.connectionsOnAllAddrs 8090
29+ $ NS.connectionsOnAllAddrs 8090)
2730
2831 where
2932
examples/FromFileClient.hs+7−3
@@ -7,10 +7,14 @@ import System.Environment (getArgs)
77
88import Streamly
99import qualified Streamly.Prelude as S
10−import qualified Streamly.FileSystem.File as File
10+import qualified Streamly.FileSystem.Handle as FH
1111import qualified Streamly.Network.Client as Client
1212
13+import System.IO (withFile, IOMode(..))
14+
1315main :: IO ()
1416main =
15− let sendFile = Client.writeArrays (127,0,0,1) 8090 . File.readArrays
16− in getArgs >>= S.drain . parallely . S.mapM sendFile . S.fromList
17+ let sendFile file =
18+ withFile file ReadMode $ \src ->
19+ Client.writeArrays (127, 0, 0, 1) 8090 $ FH.readArrays src
20+ in getArgs >>= S.drain . parallely . S.mapM sendFile . S.fromList
src/Streamly/Fold.hs+14−12
@@ -136,7 +136,7 @@ module Streamly.Fold
136136 , mapM
137137
138138 -- ** Mapping
139− , transform
139+ --, transform
140140 , lmap
141141 --, lsequence
142142 , lmapM
@@ -320,6 +320,7 @@ module Streamly.Fold
320320 -- , chunksOf
321321 , duplicate -- experimental
322322
323+ {-
323324 -- * Windowed Classification
324325 -- | Split the stream into windows or chunks in space or time. Each window
325326 -- can be associated with a key, all events associated with a particular
@@ -333,13 +334,13 @@ module Streamly.Fold
333334 -- ** Tumbling Windows
334335 -- | A new window starts after the previous window is finished.
335336 -- , classifyChunksOf
336− , classifySessionsOf
337+ -- , classifySessionsOf
337338
338339 -- ** Keep Alive Windows
339340 -- | The window size is extended if an event arrives within the specified
340341 -- window size. This can represent sessions with idle or inactive timeout.
341342 -- , classifyKeepAliveChunks
342− , classifyKeepAliveSessions
343+ -- , classifyKeepAliveSessions
343344
344345 {-
345346 -- ** Sliding Windows
@@ -351,6 +352,7 @@ module Streamly.Fold
351352 -- ** Sliding Window Buffers
352353 -- , slidingChunkBuffer
353354 -- , slidingSessionBuffer
355+ -}
354356 )
355357where
356358
@@ -492,9 +494,9 @@ mapM f = sequence . fmap f
492494-- | Apply a transformation on a 'Fold' using a 'Pipe'.
493495--
494496-- @since 0.7.0
495−{-# INLINE transform #-}
496−transform :: Monad m => Pipe m a b -> Fold m b c -> Fold m a c
497−transform (Pipe pstep1 pstep2 pinitial) (Fold fstep finitial fextract) =
497+{-# INLINE _transform #-}
498+_transform :: Monad m => Pipe m a b -> Fold m b c -> Fold m a c
499+_transform (Pipe pstep1 pstep2 pinitial) (Fold fstep finitial fextract) =
498500 Fold step initial extract
499501
500502 where
@@ -2636,14 +2638,14 @@ classifySessionsBy tick timeout reset (Fold step initial extract) str =
26362638-- only if no event is received within the specified session window size.
26372639--
26382640-- @since 0.7.0
2639−{-# INLINABLE classifyKeepAliveSessions #-}
2640−classifyKeepAliveSessions
2641+{-# INLINABLE _classifyKeepAliveSessions #-}
2642+_classifyKeepAliveSessions
26412643 :: (IsStream t, MonadAsync m, Ord k)
26422644 => Double -- ^ session inactive timeout
26432645 -> Fold m a b -- ^ Fold to be applied to session payload data
26442646 -> t m (k, a, Bool, AbsTime) -- ^ session key, data, close flag, timestamp
26452647 -> t m (k, b)
2646−classifyKeepAliveSessions timeout = classifySessionsBy 1 timeout True
2648+_classifyKeepAliveSessions timeout = classifySessionsBy 1 timeout True
26472649
26482650------------------------------------------------------------------------------
26492651-- Keyed tumbling windows
@@ -2685,11 +2687,11 @@ classifyChunksOf wsize = classifyChunksBy wsize False
26852687-- the timestamps with a clock resolution of 1 second.
26862688--
26872689-- @since 0.7.0
2688−{-# INLINABLE classifySessionsOf #-}
2689−classifySessionsOf
2690+{-# INLINABLE _classifySessionsOf #-}
2691+_classifySessionsOf
26902692 :: (IsStream t, MonadAsync m, Ord k)
26912693 => Double -- ^ time window size
26922694 -> Fold m a b -- ^ Fold to be applied to window events
26932695 -> t m (k, a, Bool, AbsTime) -- ^ window key, data, close flag, timestamp
26942696 -> t m (k, b)
2695−classifySessionsOf interval = classifySessionsBy 1 interval False
2697+_classifySessionsOf interval = classifySessionsBy 1 interval False
src/Streamly/Prelude.hs+4−4
@@ -240,7 +240,7 @@ module Streamly.Prelude
240240
241241 -- * Transformation
242242
243− , transform
243+ --, transform
244244
245245 -- ** Mapping
246246 -- | In imperative terms a map operation can be considered as a loop over
@@ -1581,9 +1581,9 @@ toHandle h m = go m
15811581------------------------------------------------------------------------------
15821582
15831583-- | Use a 'Pipe' to transform a stream.
1584−{-# INLINE transform #-}
1585−transform :: (IsStream t, Monad m) => Pipe m a b -> t m a -> t m b
1586−transform pipe xs = fromStreamD $ D.transform pipe (toStreamD xs)
1584+{-# INLINE _transform #-}
1585+_transform :: (IsStream t, Monad m) => Pipe m a b -> t m a -> t m b
1586+_transform pipe xs = fromStreamD $ D.transform pipe (toStreamD xs)
15871587
15881588------------------------------------------------------------------------------
15891589-- Transformation by Folding (Scans)
streamly.cabal+8−8
@@ -204,27 +204,27 @@ library
204204 , Streamly.Sink.Types
205205 , Streamly.Sink
206206 , Streamly.Pipe.Types
207+ , Streamly.Pipe
207208
208209 , Streamly.FileSystem.IOVec
209210 , Streamly.FileSystem.FDIO
211+ , Streamly.FileSystem.FD
212+ , Streamly.FileSystem.File
213+
214+ -- Time
215+ , Streamly.Time.Units
216+ , Streamly.Time.Clock
210217
211218 exposed-modules: Streamly.Prelude
212219 , Streamly.Time
213220 , Streamly
214221 , Streamly.Fold
215− , Streamly.Pipe
216222
217223 , Streamly.String
218224
219225 -- IO devices
220226 , Streamly.Mem.Array
221− , Streamly.FileSystem.FD
222227 , Streamly.FileSystem.Handle
223− , Streamly.FileSystem.File
224−
225− -- Time
226− , Streamly.Time.Units
227− , Streamly.Time.Clock
228228
229229 , Streamly.Tutorial
230230 , Streamly.Internal
@@ -1041,7 +1041,7 @@ executable FileIOExamples
10411041 hs-source-dirs: examples
10421042 ghc-options: -Wall
10431043 if flag(examples) || flag(examples-sdl)
1044− buildable: True
1044+ buildable: False
10451045 build-Depends:
10461046 streamly
10471047 , base >= 4.8 && < 5