Personal tools

Cookbook/Graphical user interfaces

From HaskellWiki

< Cookbook(Difference between revisions)
Jump to: navigation, search
(smaller headlines)

Latest revision as of 11:34, 9 July 2009


[edit] 1 wxHaskell

wxHaskell is a portable and native GUI library for Haskell based on the wxWidgets Library.

Hello World example:

module Main where
import Graphics.UI.WX
main :: IO ()
  = start hello
hello :: IO ()
  = do f    <- frame    [text := "Hello!"]
       quit <- button f [text := "Quit", on command := close f]
       set f [layout := widget quit]

This code was taken from "a quick start with wxHaskell".

[edit] 2 Gtk2Hs

Gtk2Hs is a GUI Library for Haskell based on GTK. Gtk2Hs Tutorial.

Hello world example:

import Graphics.UI.Gtk
main :: IO ()
main = do
    w <- windowNew
    b <- buttonNew
    set b [buttonLabel := "Quit"]
    onClicked b $ widgetDestroy w
    set w [windowTitle := "Hello", containerBorderWidth := 10]
    containerAdd w b
    onDestroy w mainQuit
    widgetShowAll w

For more examples, see: Applications and libraries/Games

[edit] 3 HOpenGL

HOpenGL is a Haskell binding for the OpenGL graphics API (GL 1.2.1 / GLU 1.3) and the portable OpenGL utility toolkit GLUT. There is a Haskell OpenGL Tetris program at [[1]] by Jim.

See also: Applications and libraries/Games

[edit] 4 SDL

There are some Haskell bindings to SDL at Hackage.