Updating outputted text in haskeline

177 views Asked by At

Haskeline provides the functions outputStr and outputStrLn, which output to stdout, but is there a way to update text that's already been outputted? I'm thinking of, for example, when an installer displays the current percentage installed -- the percentage number updates.

Am I going to need to use a curses binding?

1

There are 1 answers

3
Gabriella Gonzalez On BEST ANSWER
delete n = putStr (replicate n '\b')

This is (essentially) how QuickCheck does it and it works reasonably well. I use it in my own code for progress indicators and it gives me good results. Something more sophisticated will requires a curses binding (or equivalent).