codeforces-cli-0.1.0: Command line interface to interact with Codeforces.
Safe HaskellNone
LanguageHaskell2010

Codeforces.App.Watcher

Synopsis

Documentation

data WatchState Source #

Values used for watching output.

Constructors

WatchState 

handleWatch :: Bool -> IO (Either CodeforcesError Table) -> IO () Source #

handleWatch shouldWatch m runs computation m once if shouldWatch is false, otherwise watchTable watches it.

In the latter case, it clears the terminal and sets up terminal behaviour for watching data.

watchTable Source #

Arguments

:: Int

Delay, in seconds.

-> IO (Either CodeforcesError Table)

Fetches an updated table.

-> StateT WatchState IO ()

Data from previous iteration.

watchTable delaySecs m runs computation m every delaySecs amount of seconds. The terminal output from m is changed if the next run of m yields a different result.

addInfo Source #

Arguments

:: Table

Table to modify.

-> Maybe CodeforcesError

Error message, if exists.

-> UTCTime

Current system time.

-> Maybe UTCTime

Last successful update time, if any.

-> Table 

Takes a table with a potential error message and last successful update time, and returns the table with extra rows for various messages.

When tables are displayed in watch mode, these extra rows are placed before the table: * The first displays a message for how to exit watch mode. * The second row displays errors if there are any and the last update time. * The third row is blank.

truncateTable :: Table -> Maybe Int -> Table Source #

truncateTable table x returns the table with the first x rows, or the original table if x is Nothing.

withDisabledStdin :: IO a -> IO a Source #

Prevents any input into the terminal while running the IO computation.