'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. It is a bit modified example of ncurses package. Problem is that is do not display anything. In C API, as I remember, I have to refresh each window independently. But Haskell offer only render. Where I am wrong? I want to have some moveable widget.



Solution 1:[1]

You have just to call refreshPanels.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 vinzee