How can I clear a terminal screen after my user has selected an option from my application's menu?
相关问题
- Understanding do notation for simple Reader monad:
- Making Custom Instances of PersistBackend
- Haskell: What is the differrence between `Num [a]
- applying a list to an entered function to check fo
- Haskell split a list into two by a pivot value
相关文章
- Is it possible to write pattern-matched functions
- Haskell underscore vs. explicit variable
- Top-level expression evaluation at compile time
- Stuck in the State Monad
- Emacs/xterm color annoyance on Linux
- foldr vs foldr1 usage in Haskell
- List of checkboxes with digestive-functors
- How does this list comprehension over the inits of
Just press Ctrl+L (works on Windows)
On Windows, use Ctrl + L for Haskell command prompt terminal. And, for GUI use Ctrl + S.
A quick way on Windows would be to
On a terminal that understands ANSI escape sequences (I believe every term in Unix/Linux systems) you can do it simply with:
The
2
clears the entire screen. You can use0
or1
respectively if you want to clear from the cursor to end of screen or from cursor to the beginning of the screen.However I don't think this works in the Windows shell.
:! run the shell command
:! cls under windows
:! clear under linux and OS X
This is what you may be looking for:
ansi-terminal: Simple ANSI terminal support, with Windows compatibility
You can find it in Hackage and install usingcabal install ansi-terminal
. It specifically has functions for clearing the screen, displaying colors, moving the cursor, etc.Using it to clear the screen is easy: (this is with GHCI)
import System.Console.ANSI
clearScreen