| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Xrefcheck.Progress
Contents
Description
Printing progress bars.
Synopsis
- data TaskTimestamp = TaskTimestamp {}
- data Progress a w
- initProgress :: Num a => a -> Progress a w
- initProgressWitnessed :: [w] -> Progress Int w
- reportSuccess :: (Num a, Ord w) => w -> Progress a w -> Progress a w
- reportError :: (Num a, Ord w) => w -> Progress a w -> Progress a w
- reportRetry :: Ord w => w -> Progress a w -> Progress a w
- getTaskTimestamp :: Progress a w -> Maybe TaskTimestamp
- setTaskTimestamp :: w -> Time Second -> Time Second -> Progress a w -> Progress a w
- removeTaskTimestamp :: Progress a w -> Progress a w
- checkTaskTimestamp :: Time Second -> Progress a w -> Progress a w
- sameProgress :: (Eq a, Eq w) => Progress a w -> Progress a w -> Bool
- showProgress :: Given ColorMode => Text -> Int -> Color -> Time Second -> Progress Int w -> Text
- data Rewrite
- allowRewrite :: (MonadIO m, MonadMask m) => Bool -> (Rewrite -> m a) -> m a
- putTextRewrite :: MonadIO m => Rewrite -> Text -> m ()
Task timestamp
data TaskTimestamp Source #
Data type defining a point in time when an anonymous task had started and its time to completion.
Constructors
| TaskTimestamp | |
Instances
| Show TaskTimestamp Source # | |
Defined in Xrefcheck.Progress Methods showsPrec :: Int -> TaskTimestamp -> ShowS # show :: TaskTimestamp -> String # showList :: [TaskTimestamp] -> ShowS # | |
Progress
Processing progress of any thing, measured with type a, where progress units have witnesses
of type w that can be retried.
The () type can be used as a trivial witness if the retry logic is not going to be used.
initProgress :: Num a => a -> Progress a w Source #
Initialise null progress.
initProgressWitnessed :: [w] -> Progress Int w Source #
Initialise null progress from a given list of witnesses.
This just initializes it with as many work to do as witnesses are in the list, so you can be more confident regarding the progress initialization because you actualy provided data that represents each unit of work to do.
reportSuccess :: (Num a, Ord w) => w -> Progress a w -> Progress a w Source #
Report a unit of success with witness item.
reportError :: (Num a, Ord w) => w -> Progress a w -> Progress a w Source #
Report a unit of failure with witness item.
reportRetry :: Ord w => w -> Progress a w -> Progress a w Source #
Report a unit of failure and retry intention with witness item.
getTaskTimestamp :: Progress a w -> Maybe TaskTimestamp Source #
Get the current TaskTimestamp.
It does not require a witness because the TaskTimestamp is anonymous
and anyone should be able to observe it.
setTaskTimestamp :: w -> Time Second -> Time Second -> Progress a w -> Progress a w Source #
Set the current TaskTimestamp.
It does require a witness because, although the TaskTimestamp is
anonymous, at this point an actual task should be responsible for
registering this timestamp.
removeTaskTimestamp :: Progress a w -> Progress a w Source #
sameProgress :: (Eq a, Eq w) => Progress a w -> Progress a w -> Bool Source #
Check whether the two Progress values are equal up to similarity of their essential
components, ignoring the comparison of pTaskTimestamps, which is done to prevent test
failures when comparing the resulting progress, gotten from running the link
verification algorithm, with the expected one, where pTaskTimestamp is hardcoded
as Nothing.
showProgress :: Given ColorMode => Text -> Int -> Color -> Time Second -> Progress Int w -> Text Source #
Visualise progress bar.
Printing
Passing this object allows returning caret and replace text in line.
Only functions which has this thing can do that because being
interleaved with putTextLn printing caret symbol produced garbage.