@@ -1,13 +1,15 @@
2+-- stack runghc --package path --package path-io
1{-# LANGUAGE FlexibleContexts #-}
3{-# LANGUAGE FlexibleContexts #-}
3−import Control.Monad.IO.Class (liftIO)
4−import Control.Monad.Trans.Class (lift)
5−import Data.Monoid ((<>))
6import Path.IO (listDir, getCurrentDir)
5import Path.IO (listDir, getCurrentDir)
7import Path (Path, Dir, reldir)
6import Path (Path, Dir, reldir)
7+import System.IO (stdout, hSetBuffering, BufferMode(LineBuffering))
8import Asyncly
8import Asyncly
11+ liftIO $ hSetBuffering stdout LineBuffering
10−main = runAsyncly $ getCurrentDir >>= readdir
12+ runAsyncly $ getCurrentDir >>= readdir
11 where readdir d = do
13 where readdir d = do
12 (ds, fs) <- lift $ listDir d
14 (ds, fs) <- lift $ listDir d
13 liftIO $ mapM_ putStrLn $ map show fs ++ map show ds
15 liftIO $ mapM_ putStrLn $ map show fs ++ map show ds