Vty supports input and output to terminal devices.
- Input to the terminal is provided to the app as a sequence of
- The output is defined by a
Picture. Which is one or more layers of
See the vty-examples package for a number of examples.
main = do vty <-
mkVtydef let line0 =
green) "first line" line1 =
blue) "second line" img = line0
<->line1 pic =
updatevty pic e ::
shutdownvty print $ "Last event was: " ++ show e
Good sources of documentation for terminal programming are:
- vt100 control sequences
The main object. At most one should be created.
The use of Vty typically follows this process:
- initialize vty
- use the update equation of Vty to display a picture
- shutdown vty.
An alternative to tracking the Vty instance is to use
withVty in Graphics.Vty.Inline.Unsafe.
This does not assure any thread safety. In theory, as long as an update action is not executed when another update action is already then it's safe to call this on multiple threads.
todo Remove explicit