Skip to content

Instantly share code, notes, and snippets.

@mmitou
Created July 12, 2013 09:49
Show Gist options
  • Select an option

  • Save mmitou/5983220 to your computer and use it in GitHub Desktop.

Select an option

Save mmitou/5983220 to your computer and use it in GitHub Desktop.
gtk2hsでHello, world
-- Initial Hello.cabal generated by cabal init. For further
-- documentation, see http://haskell.org/cabal/users-guide/
name: Hello
version: 0.1.0.0
synopsis: Hello world
-- description:
homepage: http://foobar
license: MIT
license-file: LICENSE
author: mmitou
maintainer: ito_ma@worksap.co.jp
-- copyright:
-- category:
build-type: Simple
cabal-version: >=1.8
executable Hello
main-is: Main.hs
-- other-modules:
build-depends: base ==4.6.*,
gtk ==0.12.4,
cairo ==0.12.4,
glib ==0.12.4,
pango ==0.12.4,
gio ==0.12.4
module Main where
import Graphics.UI.Gtk
main :: IO ()
main = do
initGUI
window <- windowNew
button <- buttonNew
set window [ containerBorderWidth := 10, containerChild := button ]
set button [ buttonLabel := "Hello World" ]
onClicked button (putStrLn "Hello!")
onDestroy window mainQuit
widgetShowAll window
mainGUI
  • cabal-dev init
  • Hello.cabalを編集する
  • cabal-dev configure
  • export PATH="${PWD}/cabal-dev/bin":${PATH}
  • cabal-dev install gtk2hs-buildtools
  • LANG=C cabal-dev install ** LANG=Cが無いと通らない
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment