packages feed

Monadoro-0.2.6.2: src/ConsoleDisplay.lhs

#!/usr/bin/env stack
> --stack --install-ghc runghc

Unified interface for displaying the remaining time on the screen.

> module ConsoleDisplay (display) where
>
> import Control.Concurrent  (threadDelay)
> import System.Console.ANSI (clearLine,
>                             saveCursor,
>                             restoreCursor)
>
> display :: String -> IO ()
> display s = putStr $ "\r" ++ s
>
> waitASecond :: IO()
> waitASecond = threadDelay $ 10^6

> main :: IO ()
> main = do
>     display "00:01" >> waitASecond >> display "00:00"