About

Metadata

  • Last updated , by HerbertValerioRiedel
  • License GPL-3.0-only
  • Categories FFI, GUI
  • Maintained by: John Millikin <jmillikin@gmail.com>

  • Lottery factor: 0

Links

Installation

Package Flags

Use the -f option with cabal commands to enable flags

    use-pkgconfig (off by default)

    Use pkg-config to set linker and include flags.

    force-narrow-library (off by default)

    Force including and linking against ncurses instead of ncursesw. This is only useful on systems that have the ncursesw package installed incorrectly. On most systems this will cause compile- or run-time errors.

Readme

GNU ncurses is a library for creating command-line application with pseudo-graphical interfaces. This package is a nice, modern binding to GNU ncurses.

The following example is a program that displays the message "Hello world!" until the user hits Q:

import UI.NCurses

main :: IO ()
main = runCurses $ do
    setEcho False
    w <- defaultWindow
    updateWindow w $ do
        moveCursor 1 10
        drawString "Hello world!"
        moveCursor 3 10
        drawString "(press q to quit)"
        moveCursor 0 0
    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' -> if p ev' then return () else loop