on master help sign in
Hide modules not finalised for 0.7.0.

- Hides Pipe, FileSystem.FD, FileSystem.File, Time.Units, Time.Clock modules. - Hides transform function from Fold, Prelude modules. - Change examples depending on File api, and do not build FileIOExamples.

commitea668dc99b755567575ce752fe266904ff112033 authorPranay Sashank <pranaysashank@gmail.com> dateTue 30 Jul 2019, 14:32 (7 years ago) parentede4e3f
6 files changed+30−23
examples/FileIOExamples.hs+1−1 examples/FileSinkServer.hs+6−3 examples/FromFileClient.hs+7−3 src/Streamly/Fold.hs+4−4 src/Streamly/Prelude.hs+4−4 streamly.cabal+8−8
examples/FileIOExamples.hs+1−1
@@ -1,7 +1,7 @@
11import qualified Streamly.Prelude as S
22import qualified Streamly.Fold as FL
33import qualified Streamly.Mem.Array as A
4−import qualified Streamly.FileSystem.File as File
4+import qualified Streamly.FileSystem.Handle as Handle
55
66import Data.Char (ord)
77import System.Environment (getArgs)
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+4−4
@@ -136,7 +136,7 @@ module Streamly.Fold
136136 , mapM
137137
138138 -- ** Mapping
139− , transform
139+ --, transform
140140 , lmap
141141 --, lsequence
142142 , lmapM
@@ -492,9 +492,9 @@ mapM f = sequence . fmap f
492492-- | Apply a transformation on a 'Fold' using a 'Pipe'.
493493--
494494-- @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) =
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) =
498498 Fold step initial extract
499499
500500 where
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