@@ -1,9 +1,9 @@
11module Streamly.Examples.ListDirRecursive where
22
3−import Control.Monad.IO.Class (liftIO)
43import Path.IO (listDir, getCurrentDir)
54import System.IO (stdout, hSetBuffering, BufferMode(LineBuffering))
65import Streamly (runStream, coparallely)
6+import Streamly.Prelude (once)
77
88-- | This example demonstrates that there is little difference between regular
99-- IO code and concurrent streamly code. You can just remove
@@ -13,6 +13,6 @@ listDirRecursive = do
1313 hSetBuffering stdout LineBuffering
1414 runStream . coparallely $ getCurrentDir >>= readdir
1515 where readdir d = do
16− (ds, fs) <- liftIO $ listDir d
17− liftIO $ mapM_ putStrLn $ map show fs ++ map show ds
16+ (ds, fs) <- once $ listDir d
17+ once $ mapM_ putStrLn $ map show fs ++ map show ds
1818 foldMap readdir ds