Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Updating outputted text in haskeline

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?

like image 901
amindfv Avatar asked Sep 05 '12 00:09

amindfv


1 Answers

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).

like image 135
Gabriella Gonzalez Avatar answered Sep 24 '22 03:09

Gabriella Gonzalez