on master help sign in
Hide modules not finalised for 0.7.0.
ea668dcPranay Sashank
examples/FileIOExamples.hs+1−1
@@ -1,7 +1,7 @@
1import qualified Streamly.Prelude as S
1import qualified Streamly.Prelude as S
2import qualified Streamly.Fold as FL
2import qualified Streamly.Fold as FL
3import qualified Streamly.Mem.Array as A
3import qualified Streamly.Mem.Array as A
4−import qualified Streamly.FileSystem.File as File
4+import qualified Streamly.FileSystem.Handle as Handle
5
5
6import Data.Char (ord)
6import Data.Char (ord)
7import System.Environment (getArgs)
7import System.Environment (getArgs)
examples/FileSinkServer.hs+6−3
@@ -9,21 +9,24 @@ import System.Environment (getArgs)
9
9
10import Streamly
10import Streamly
11import Streamly.String
11import Streamly.String
12−import qualified Streamly.FileSystem.File as File
12+import qualified Streamly.FileSystem.Handle as FH
13import qualified Streamly.Fold as FL
13import qualified Streamly.Fold as FL
14import qualified Streamly.Mem.Array as A
14import qualified Streamly.Mem.Array as A
15import qualified Streamly.Network.Socket as NS
15import qualified Streamly.Network.Socket as NS
16import qualified Streamly.Network.Server as NS
16import qualified Streamly.Network.Server as NS
17import qualified Streamly.Prelude as S
17import qualified Streamly.Prelude as S
18
18
19+import System.IO (withFile, IOMode(..))
20+
19main :: IO ()
21main :: IO ()
20main = do
22main = do
21 file <- fmap head getArgs
23 file <- fmap head getArgs
22− File.append file
24+ withFile file AppendMode
25+ (\src -> FH.write src
23 $ encodeChar8Unchecked
26 $ encodeChar8Unchecked
24 $ S.concatMap A.read
27 $ S.concatMap A.read
25 $ S.concatMapBy parallel (flip NS.withSocketS recv)
28 $ S.concatMapBy parallel (flip NS.withSocketS recv)
26− $ NS.connectionsOnAllAddrs 8090
29+ $ NS.connectionsOnAllAddrs 8090)
27
30
28 where
31 where
29
32
examples/FromFileClient.hs+7−3
@@ -7,10 +7,14 @@ import System.Environment (getArgs)
7
7
8import Streamly
8import Streamly
9import qualified Streamly.Prelude as S
9import qualified Streamly.Prelude as S
10−import qualified Streamly.FileSystem.File as File
10+import qualified Streamly.FileSystem.Handle as FH
11import qualified Streamly.Network.Client as Client
11import qualified Streamly.Network.Client as Client
12
12
13+import System.IO (withFile, IOMode(..))
14+
13main :: IO ()
15main :: IO ()
14main =
16main =
17+ let sendFile file =
18+ withFile file ReadMode $ \src ->
15− let sendFile = Client.writeArrays (127,0,0,1) 8090 . File.readArrays
19+ Client.writeArrays (127, 0, 0, 1) 8090 $ FH.readArrays src
16− in getArgs >>= S.drain . parallely . S.mapM sendFile . S.fromList
20+ in getArgs >>= S.drain . parallely . S.mapM sendFile . S.fromList
src/Streamly/Fold.hs+4−4
@@ -136,7 +136,7 @@ module Streamly.Fold
136 , mapM
136 , mapM
137
137
138 -- ** Mapping
138 -- ** Mapping
139− , transform
139+ --, transform
140 , lmap
140 , lmap
141 --, lsequence
141 --, lsequence
142 , lmapM
142 , lmapM
@@ -492,9 +492,9 @@ mapM f = sequence . fmap f
492-- | Apply a transformation on a 'Fold' using a 'Pipe'.
492-- | Apply a transformation on a 'Fold' using a 'Pipe'.
493--
493--
494-- @since 0.7.0
494-- @since 0.7.0
495−{-# INLINE transform #-}
495+{-# INLINE _transform #-}
496−transform :: Monad m => Pipe m a b -> Fold m b c -> Fold m a c
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+_transform (Pipe pstep1 pstep2 pinitial) (Fold fstep finitial fextract) =
498 Fold step initial extract
498 Fold step initial extract
499
499
500 where
500 where
src/Streamly/Prelude.hs+4−4
@@ -240,7 +240,7 @@ module Streamly.Prelude
240
240
241 -- * Transformation
241 -- * Transformation
242
242
243− , transform
243+ --, transform
244
244
245 -- ** Mapping
245 -- ** Mapping
246 -- | In imperative terms a map operation can be considered as a loop over
246 -- | In imperative terms a map operation can be considered as a loop over
@@ -1581,9 +1581,9 @@ toHandle h m = go m
1581------------------------------------------------------------------------------
1581------------------------------------------------------------------------------
1582
1582
1583-- | Use a 'Pipe' to transform a stream.
1583-- | Use a 'Pipe' to transform a stream.
1584−{-# INLINE transform #-}
1584+{-# INLINE _transform #-}
1585−transform :: (IsStream t, Monad m) => Pipe m a b -> t m a -> t m b
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)
1586+_transform pipe xs = fromStreamD $ D.transform pipe (toStreamD xs)
1587
1587
1588------------------------------------------------------------------------------
1588------------------------------------------------------------------------------
1589-- Transformation by Folding (Scans)
1589-- Transformation by Folding (Scans)
streamly.cabal+8−8
@@ -204,27 +204,27 @@ library
204 , Streamly.Sink.Types
204 , Streamly.Sink.Types
205 , Streamly.Sink
205 , Streamly.Sink
206 , Streamly.Pipe.Types
206 , Streamly.Pipe.Types
207+ , Streamly.Pipe
207
208
208 , Streamly.FileSystem.IOVec
209 , Streamly.FileSystem.IOVec
209 , Streamly.FileSystem.FDIO
210 , Streamly.FileSystem.FDIO
211+ , Streamly.FileSystem.FD
212+ , Streamly.FileSystem.File
213+
214+ -- Time
215+ , Streamly.Time.Units
216+ , Streamly.Time.Clock
210
217
211 exposed-modules: Streamly.Prelude
218 exposed-modules: Streamly.Prelude
212 , Streamly.Time
219 , Streamly.Time
213 , Streamly
220 , Streamly
214 , Streamly.Fold
221 , Streamly.Fold
215− , Streamly.Pipe
216
222
217 , Streamly.String
223 , Streamly.String
218
224
219 -- IO devices
225 -- IO devices
220 , Streamly.Mem.Array
226 , Streamly.Mem.Array
221− , Streamly.FileSystem.FD
222 , Streamly.FileSystem.Handle
227 , Streamly.FileSystem.Handle
223− , Streamly.FileSystem.File
224−
225− -- Time
226− , Streamly.Time.Units
227− , Streamly.Time.Clock
228
228
229 , Streamly.Tutorial
229 , Streamly.Tutorial
230 , Streamly.Internal
230 , Streamly.Internal
@@ -1041,7 +1041,7 @@ executable FileIOExamples
1041 hs-source-dirs: examples
1041 hs-source-dirs: examples
1042 ghc-options: -Wall
1042 ghc-options: -Wall
1043 if flag(examples) || flag(examples-sdl)
1043 if flag(examples) || flag(examples-sdl)
1044− buildable: True
1044+ buildable: False
1045 build-Depends:
1045 build-Depends:
1046 streamly
1046 streamly
1047 , base >= 4.8 && < 5
1047 , base >= 4.8 && < 5