xrefcheck-0.3.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

Xrefcheck.Progress

Description

Printing progress bars.

Synopsis

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 

Fields

Instances

Instances details
Show TaskTimestamp Source # 
Instance details

Defined in Xrefcheck.Progress

Progress

data Progress a w Source #

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.

Instances

Instances details
(Show a, Show w) => Show (Progress a w) Source # 
Instance details

Defined in Xrefcheck.Progress

Methods

showsPrec :: Int -> Progress a w -> ShowS #

show :: Progress a w -> String #

showList :: [Progress a w] -> ShowS #

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.

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

data Rewrite Source #

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.

allowRewrite :: (MonadIO m, MonadMask m) => Bool -> (Rewrite -> m a) -> m a Source #

Provide context for rewrite operations.

putTextRewrite :: MonadIO m => Rewrite -> Text -> m () Source #

Return caret and print the given text.