I\'m writing a terminal-mode program in Haskell. How would I go about reading raw keypress information?
In particular, there seems to be something providing line-edi
Incomplete:
After several hours of web surfing, I can report the following:
readline
has a huge interface with virtually no documentation whatsoever. From the function names and type signatures you could maybe guess what this stuff does... but it's far from trivial. At any rate, this library seems to provide a high-level editing interface - which is the thing I'm trying to implement myself. I need something more low-level.
After wading through the source of haskeline
, it seems it has a huge tangle low-level code, seperately for Win32 and POSIX. If there is an easy way to do console I/O, this library does not demonstrate it. The code appears to be so tightly integrated and highly specific to haskeline
that I doubt I can reuse any of it. But perhaps by reading it I can learn enough to write my own?
Yi is... freaking massive. The Cabal file lists > 150 exposed modules. (!!) It appears, though, that underneath it's using a package called vty
, which is POSIX-only. (I wonder how the hell Yi works on Windows then?) vty
looks like it might be directly useful to me without further modification. (But again, not on Windows.)
unix
has... basically nothing interesting. It has a bunch of stuff to set things on a terminal, but absolutely nothing for reading from a terminal. (Except maybe to check whether echo is on, etc. Nothing about keypresses.)
unix-compat
has absolutely nothing of interest.