File size distribution: Difference between revisions
Content added Content deleted
Line 509: | Line 509: | ||
display :: Double -> String -> String |
display :: Double -> String -> String |
||
display b = printf "%7.2f%s " (realToFrac n / b) |
display b = printf "%7.2f%s " (realToFrac n / b) |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
folderWorker :: Chan FilePath -> Chan [Item] -> IO () |
folderWorker :: Chan FilePath -> Chan [Item] -> IO () |
||
Line 525: | Line 536: | ||
items <- mapM (\f -> File f <$> withFile f ReadMode hFileSize) files |
items <- mapM (\f -> File f <$> withFile f ReadMode hFileSize) files |
||
pure $ items <> fmap Folder folders |
pure $ items <> fmap Folder folders |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
parallelItemCollector :: FilePath -> IO [Item] |
parallelItemCollector :: FilePath -> IO [Item] |
||
Line 563: | Line 556: | ||
result <- mapM (loop folderChan resultItemsChan) childItems |
result <- mapM (loop folderChan resultItemsChan) childItems |
||
pure (join childItems <> join result) |
pure (join childItems <> join result) |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
main :: IO () |
main :: IO () |