[fix] Add display of each file size for clarity in NonDet example.

This commit is contained in:
Yamada Ryo 2024-10-29 11:12:23 +09:00
parent fcd9faf819
commit 758d5912c9
No known key found for this signature in database
GPG Key ID: AAE3C7A542B02DBF
2 changed files with 14 additions and 2 deletions

View File

@ -259,7 +259,9 @@ totalFileSize path = do
liftIO $ putStrLn $ "Found " <> path'
getFileSize path' >>= \case
Right size -> pure $ Sum size
Right size -> do
liftIO $ putStrLn $ " ... " <> show size <> " bytes"
pure $ Sum size
Left NotAFile -> do
totalFileSize path'
@ -299,11 +301,15 @@ runDummyFS root = interpret \case
```
>>> main
Found ./README.md
... 4000 bytes
Found ./src
Found ./src/Bar.hs
... 1000 bytes
Found ./src/Foo.hs
... 2000 bytes
Found ./test
Found ./test/Baz.hs
... 3000 bytes
Sum {getSum = 10000}
```

View File

@ -61,7 +61,9 @@ totalFileSize path = do
liftIO $ putStrLn $ "Found " <> path'
getFileSize path' >>= \case
Right size -> pure $ Sum size
Right size -> do
liftIO $ putStrLn $ " ... " <> show size <> " bytes"
pure $ Sum size
Left NotAFile -> do
totalFileSize path'
@ -77,11 +79,15 @@ main = runEff
{-
>>> main
Found ./README.md
... 4000 bytes
Found ./src
Found ./src/Bar.hs
... 1000 bytes
Found ./src/Foo.hs
... 2000 bytes
Found ./test
Found ./test/Baz.hs
... 3000 bytes
Sum {getSum = 10000}
-}