Closed mcandre closed 13 years ago
This issue raises several questions.
Why is there KeyLeft/Right/Up/Down and also cKEY_LEFT/RIGHT/UP/DOWN?
In GHCI, the c keys are distinct:
> cKEY_LEFT
260
> cKEY_RIGHT
261
> cKEY_LEFT == cKEY_RIGHT
False
So why does Haskell consider these patterns overlapping?
case k of
cKEY_LEFT -> putStrLn $ "Pressed Left"
cKEY_RIGHT -> putStrLn $ "Pressed Right"
cKEY_UP -> putStrLn $ "Pressed Up"
cKEY_DOWN -> putStrLn $ "Pressed Down"
otherwise -> putStrLn $ "Pressed something else"
Why does this always evaluate to "Pressed something else"?
case k of
cKEY_UP -> putStrLn $ "Pressed Up"
otherwise -> putStrLn $ "Pressed something else"
And why does that always evaluate to "Pressed Up", no matter which arrow key is pressed?
You need to add
keypad stdScr True
after initCurses and before loopKey
The docs show constructors for KeyLeft, KeyRight, KeyUp, and KeyDown, but when I press left, right, up, or down, they're all interpreted as Escape.
Example:
Specs:
hscurses 1.4.0.0 cabal 0.8.2 ghc 6.12.3 Mac OS X 10.6.6