@@ -1,17 +1,17 @@
1import Control.Monad.IO.Class (liftIO)
1import Control.Monad.IO.Class (liftIO)
2import Path.IO (listDir, getCurrentDir)
2import Path.IO (listDir, getCurrentDir)
3import System.IO (stdout, hSetBuffering, BufferMode(LineBuffering))
3import System.IO (stdout, hSetBuffering, BufferMode(LineBuffering))
4−import Streamly (runStream, asParAhead)
4+import Streamly (runStream, asyncly)
6-- | List the current directory recursively using concurrent processing
6-- | List the current directory recursively using concurrent processing
8-- This example demonstrates that there is little difference between regular
8-- This example demonstrates that there is little difference between regular
9-- IO code and concurrent streamly code. You can just remove
9-- IO code and concurrent streamly code. You can just remove
10−-- 'runStream . asParAhead' and this becomes your regular IO code.
10+-- 'runStream . asyncly' and this becomes your regular IO code.
11main :: IO ()
11main :: IO ()
13 hSetBuffering stdout LineBuffering
13 hSetBuffering stdout LineBuffering
14− runStream . asParAhead $ getCurrentDir >>= readdir
14+ runStream . asyncly $ getCurrentDir >>= readdir
15 where readdir d = do
15 where readdir d = do
16 (ds, fs) <- liftIO $ listDir d
16 (ds, fs) <- liftIO $ listDir d
17 liftIO $ mapM_ putStrLn $ map show fs ++ map show ds
17 liftIO $ mapM_ putStrLn $ map show fs ++ map show ds