How to handle arrow keys in a CLI-based application in Haskell?

I am writing a simple Pomodoro timer console (as my exercise for learning Haskell): pomodoro-cli

So far this temporary menu has not been based on the prompt bar. But now I want to replace it with an arrow-based menu, for example Yeoman : http://yeoman.io/codelab/install-generators.html

How can I do this in Haskell? I read about System.Console.Terminfo.Keys and other System.Console packages, but could not find a solution for my question.

+6
source share
1 answer

One way to do this is to use the ncurses library bindings. Infact ncurses shows you an example of passing the key character "Q" into your sample program.

Another nice Haskell solution is vty-ui , which has good documentation .

+7
source

Source: https://habr.com/ru/post/984642/


All Articles