Haskell ncurses

main :: IO()
main = runCurses $ do 
  setEcho False
  w <- defaultWindow
  canvas <- newWindow 19 19 0 0
  panel <- newPanel canvas
  updateWindow canvas $ do 
    drawString "Hello world!"
  render
  waitFor w (\ev -> ev == EventCharacter 'q' || ev == EventCharacter 'Q')

waitFor :: Window -> (Event -> Bool) -> Curses ()
waitFor w p = loop where
    loop = do
        ev <- getEvent w Nothing
        case ev of
            Nothing -> loop
            Just ev' -> unless (p ev') loop

Hello. This is a slightly modified example of the ncurses package. The problem is that nothing is displayed. In the C API, as I recall, I have to update each window independently. But Haskell offers only render. Where am I mistaken? I want to have a movable widget.

+5
source share
1 answer

Sorry for the stupid question. You only need to call updatePanels.

+4
source

All Articles