Haskell read raw keyboard input

前端 未结 6 1369
暗喜
暗喜 2020-11-28 12:04

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

6条回答
  •  爱一瞬间的悲伤
    2020-11-28 12:39

    One option would be to use ncurses. A minimalistic example:

    import Control.Monad
    import UI.NCurses
    
    main :: IO ()
    main = runCurses $ do
        w <- defaultWindow
        forever $ do
            e <- getEvent w Nothing
            updateWindow w $ do
                moveCursor 0 0
                drawString (show e)
            render
    

提交回复
热议问题