diff --git a/examples/FileIOExamples.hs b/examples/FileIOExamples.hs index f23189222..3bb782670 100644 --- a/examples/FileIOExamples.hs +++ b/examples/FileIOExamples.hs @@ -1,7 +1,7 @@ import qualified Streamly.Prelude as S import qualified Streamly.Fold as FL import qualified Streamly.Mem.Array as A -import qualified Streamly.FileSystem.File as File +import qualified Streamly.FileSystem.Handle as Handle import Data.Char (ord) import System.Environment (getArgs) diff --git a/examples/FileSinkServer.hs b/examples/FileSinkServer.hs index 3ad3e1f9b..927673fd3 100644 --- a/examples/FileSinkServer.hs +++ b/examples/FileSinkServer.hs @@ -9,21 +9,24 @@ import System.Environment (getArgs) import Streamly import Streamly.String -import qualified Streamly.FileSystem.File as File +import qualified Streamly.FileSystem.Handle as FH import qualified Streamly.Fold as FL import qualified Streamly.Mem.Array as A import qualified Streamly.Network.Socket as NS import qualified Streamly.Network.Server as NS import qualified Streamly.Prelude as S +import System.IO (withFile, IOMode(..)) + main :: IO () main = do file <- fmap head getArgs - File.append file + withFile file AppendMode + (\src -> FH.write src $ encodeChar8Unchecked $ S.concatMap A.read $ S.concatMapBy parallel (flip NS.withSocketS recv) - $ NS.connectionsOnAllAddrs 8090 + $ NS.connectionsOnAllAddrs 8090) where diff --git a/examples/FromFileClient.hs b/examples/FromFileClient.hs index e9d3abd6c..f36ec2a49 100644 --- a/examples/FromFileClient.hs +++ b/examples/FromFileClient.hs @@ -7,10 +7,14 @@ import System.Environment (getArgs) import Streamly import qualified Streamly.Prelude as S -import qualified Streamly.FileSystem.File as File +import qualified Streamly.FileSystem.Handle as FH import qualified Streamly.Network.Client as Client +import System.IO (withFile, IOMode(..)) + main :: IO () main = - let sendFile = Client.writeArrays (127,0,0,1) 8090 . File.readArrays - in getArgs >>= S.drain . parallely . S.mapM sendFile . S.fromList + let sendFile file = + withFile file ReadMode $ \src -> + Client.writeArrays (127, 0, 0, 1) 8090 $ FH.readArrays src + in getArgs >>= S.drain . parallely . S.mapM sendFile . S.fromList diff --git a/src/Streamly/Fold.hs b/src/Streamly/Fold.hs index 88b5a5f7e..8dc661fbd 100644 --- a/src/Streamly/Fold.hs +++ b/src/Streamly/Fold.hs @@ -136,7 +136,7 @@ module Streamly.Fold , mapM -- ** Mapping - , transform + --, transform , lmap --, lsequence , lmapM @@ -492,9 +492,9 @@ mapM f = sequence . fmap f -- | Apply a transformation on a 'Fold' using a 'Pipe'. -- -- @since 0.7.0 -{-# INLINE transform #-} -transform :: Monad m => Pipe m a b -> Fold m b c -> Fold m a c -transform (Pipe pstep1 pstep2 pinitial) (Fold fstep finitial fextract) = +{-# INLINE _transform #-} +_transform :: Monad m => Pipe m a b -> Fold m b c -> Fold m a c +_transform (Pipe pstep1 pstep2 pinitial) (Fold fstep finitial fextract) = Fold step initial extract where diff --git a/src/Streamly/Prelude.hs b/src/Streamly/Prelude.hs index 179dd1d15..cdb6b74d7 100644 --- a/src/Streamly/Prelude.hs +++ b/src/Streamly/Prelude.hs @@ -240,7 +240,7 @@ module Streamly.Prelude -- * Transformation - , transform + --, transform -- ** Mapping -- | In imperative terms a map operation can be considered as a loop over @@ -1581,9 +1581,9 @@ toHandle h m = go m ------------------------------------------------------------------------------ -- | Use a 'Pipe' to transform a stream. -{-# INLINE transform #-} -transform :: (IsStream t, Monad m) => Pipe m a b -> t m a -> t m b -transform pipe xs = fromStreamD $ D.transform pipe (toStreamD xs) +{-# INLINE _transform #-} +_transform :: (IsStream t, Monad m) => Pipe m a b -> t m a -> t m b +_transform pipe xs = fromStreamD $ D.transform pipe (toStreamD xs) ------------------------------------------------------------------------------ -- Transformation by Folding (Scans) diff --git a/streamly.cabal b/streamly.cabal index 6f88c3067..eb93eddee 100644 --- a/streamly.cabal +++ b/streamly.cabal @@ -204,28 +204,28 @@ library , Streamly.Sink.Types , Streamly.Sink , Streamly.Pipe.Types + , Streamly.Pipe , Streamly.FileSystem.IOVec , Streamly.FileSystem.FDIO - - exposed-modules: Streamly.Prelude - , Streamly.Time - , Streamly - , Streamly.Fold - , Streamly.Pipe - - , Streamly.String - - -- IO devices - , Streamly.Mem.Array , Streamly.FileSystem.FD - , Streamly.FileSystem.Handle , Streamly.FileSystem.File -- Time , Streamly.Time.Units , Streamly.Time.Clock + exposed-modules: Streamly.Prelude + , Streamly.Time + , Streamly + , Streamly.Fold + + , Streamly.String + + -- IO devices + , Streamly.Mem.Array + , Streamly.FileSystem.Handle + , Streamly.Tutorial , Streamly.Internal if !impl(ghcjs) @@ -1041,7 +1041,7 @@ executable FileIOExamples hs-source-dirs: examples ghc-options: -Wall if flag(examples) || flag(examples-sdl) - buildable: True + buildable: False build-Depends: streamly , base >= 4.8 && < 5