@@ -1,8 +1,9 @@
11module Main (main) where
22
3−import System.IO (stdout, hSetBuffering, BufferMode(LineBuffering))
4−import Streamly (async)
3+import Data.Bifunctor (bimap)
54import Data.Function ((&))
5+import System.IO (stdout, hSetBuffering, BufferMode(LineBuffering))
6+import Streamly (ahead)
67
78import qualified Streamly.Prelude as S
89import qualified Streamly.Internal.Prelude as S
@@ -13,19 +14,12 @@ import qualified Streamly.Internal.FileSystem.Dir as Dir
1314main :: IO ()
1415main = do
1516 hSetBuffering stdout LineBuffering
16− -- XXX Fix bug in enqueueAhead when mixing serial with ahead:
17− -- (\x -> S.yield dir <> S.concatMapWith ahead recursePath x)
18− -- :: SerialT IO String
19− -- or S.cons dir . S.concatMapWith ahead recursePath
20− S.mapM_ print $ S.concatMapTreeWith async listDir
17+ S.mapM_ print $ S.concatMapTreeWith ahead listDir
2118 (S.yieldM $ return (Left "."))
2219
2320 where
2421
2522 listDir dir =
2623 Dir.toEither dir -- SerialT IO (Either String String)
27− & S.map (prefixDir dir) -- SerialT IO (Either String String)
28−
29− prefixDir :: String -> Either String String -> Either String String
30− prefixDir dir (Right x) = Right $ dir ++ "/" ++ x
31− prefixDir dir (Left x) = Left $ dir ++ "/" ++ x
24+ & S.map (bimap prefix prefix) -- SerialT IO (Either String String)
25+ where prefix x = dir ++ "/" ++ x