mirror of
https://github.com/joshuaclayton/unused.git
synced 2024-10-26 13:19:58 +03:00
Be more flexible with progress indicator types
This commit is contained in:
parent
fb1198dc2f
commit
279cdfa494
@ -20,11 +20,11 @@ createSpinner =
|
||||
snapshots = ["⣾", "⣽", "⣻", "⢿", "⡿", "⣟", "⣯", "⣷"]
|
||||
colors = cycle [Black, Red, Yellow, Green, Blue, Cyan, Magenta]
|
||||
|
||||
progressWithIndicator :: (a -> IO [b]) -> ProgressIndicator -> [a] -> IO [b]
|
||||
progressWithIndicator :: Monoid b => (a -> IO b) -> ProgressIndicator -> [a] -> IO b
|
||||
progressWithIndicator f i terms = do
|
||||
printPrefix i
|
||||
(tid, indicator) <- start i $ length terms
|
||||
installChildInterruptHandler tid
|
||||
concat <$> parallel (ioOps indicator) <* stop indicator <* stopGlobalPool
|
||||
mconcat <$> parallel (ioOps indicator) <* stop indicator <* stopGlobalPool
|
||||
where
|
||||
ioOps i' = map (\t -> f t <* increment i') terms
|
||||
|
Loading…
Reference in New Issue
Block a user