GUI library for Haskell based on GTK+
Haskell C Other
Latest commit 21d3a12 Feb 6, 2017 @hamishmack hamishmack committed on GitHub Merge pull request #199 from Bira-oliverio/patch-1
Fixed pkg_config name for OS X Homebrew
Failed to load latest commit information.
cairo added filenames to cairo cabal file Dec 26, 2016
docs changed base url to point to github page Dec 19, 2016
gio Fix #183 Oct 29, 2016
glib Fix #183 Oct 29, 2016
gtk Export classes from EventM module Dec 11, 2016
pango Fix #183 Oct 29, 2016
tools Bump gtk2hs-buildtools version to Jan 14, 2017
.gitignore separated gtk2 and gtk3 versions Dec 25, 2016
.travis.yml Revert "Add an 8.0.2 Travis entry to demonstrate that it works" Jan 7, 2017
APICHANGES [project @ 2005-10-26 17:44:13 by duncan_coutts] Oct 26, 2005
AUTHORS Adding GLArea and GLContext Apr 30, 2016
COPYING.GPLv3 gnomevfs: updated license to LGPLv3, made all source file headers con… Jul 22, 2007
COPYING.LGPLv3 gnomevfs: updated license to LGPLv3, made all source file headers con… Jul 22, 2007
ChangeLog Add svgcairo package Jan 9, 2006
Gtk2Hs-DG.tex changed repository cloning command in tex document Dec 20, 2016
INSTALL Added Stack-friendly installation instructions. Mar 12, 2016
OLD_TODO Change TODO to OLD_TODO Sep 8, 2010
RELEASING Update release procedure Dec 3, 2013 Fixed pkg_config name for OS X Homebrew Feb 6, 2017 assume less in the bootstrapping script Jul 11, 2013
boring add a boring file Jan 29, 2012
cabal.project Bump version numbers for move to Cabal 1.24 May 22, 2016 Include haddock in travis tests Jun 3, 2016 Add support gtk.cabal-0 and gtk.cabal-3 Jul 7, 2013
sources.txt Add support gtk.cabal-0 and gtk.cabal-3 Jul 7, 2013


Build Status

Gtk2Hs is a GUI library for Haskell based on GTK+. GTK+ is an extensive and mature multi-platform toolkit for creating graphical user interfaces.

For all new application development you should consider using haskell-gi as it has much more complete bindings. Cairo and WebKitGTK JavaScriptCore do not have GObject introspection data so you will still need to use the Gtk2Hs packages for those (even when using haskell-gi for everything else).

Installing C libraries

The following commands will install most of the C libraries used by the Gtk2Hs and haskell-gi.


sudo dnf install gobject-introspection-devel webkitgtk3-devel webkitgtk4-devel gtksourceview3-devel


sudo apt-get install libgirepository1.0-dev libwebkitgtk-3.0-dev libwebkit2gtk-4.0-dev libgtksourceview-3.0-dev

Arch Linux

sudo pacman -S gobject-introspection gobject-introspection-runtime gtksourceview3 webkitgtk webkit2gtk

OS X MacPorts

sudo port install gobject-introspection webkit-gtk3 webkit2-gtk gtksourceview3 gtk-osx-application-gtk3 adwaita-icon-theme

You will also need to build a MacPorts compatible of GHC. First install GHC some other way then unpack the source for the GHC version you want to use and run:

sudo port install libxslt gmp ncurses libiconv llvm-3.5 libffi
./configure --prefix=$HOME/ghc-8.0.1 --with-iconv-includes=/opt/local/include --with-iconv-libraries=/opt/local/lib --with-gmp-includes=/opt/local/include --with-gmp-libraries=/opt/local/lib --with-system-libffi --with-ffi-includes=/opt/local/lib/libffi-3.2.1/include --with-ffi-libraries=/opt/local/lib --with-nm=/Applications/
make install

Then make sure the $HOME/ghc-8.0.1/bin is in your $PATH.

OS X Homebrew

Unlike MacPorts you will not need a custom build of GHC for homebrew since it uses the system libiconv. However some packaged (such as WebKitGTK) seem to be less well supported on Homebrew.

brew install gtk+3

And if you got an error about that pkg-config can not find libffi when installing haskell-gi or something like that, you need to find out where your brew installed libffi, and add the pkg_config(e.g. /usr/local/Cellar/libffi/3.0.13/lib/pkgconfig) directory to $PKG_CONFIG_PATH.

TIPS: If you installed GTK with homebrew, you do not need to install X11 on macOS. The one installed by brew was linked with GTK+'s Quartz backend, and you can use macOS's native display manager, keyboard, and pointing device.

Windows MSYS2

Install MSYS2 and Chocolatey. Then in a shell with administrator privileges:

choco install ghc
pacman -S mingw64/mingw-w64-x86_64-pkg-config mingw64/mingw-w64-x86_64-gobject-introspection mingw64/mingw-w64-x86_64-gtksourceview3 mingw64/mingw-w64-x86_64-webkitgtk3

Install Extra Tools

cabal update
cabal install alex happy
cabal install haskell-gi

(make sure ~/.cabal/bin is in PATH)

Building with stack

While you currently cannot have the tools automatically installed with stack you should be able to install them in the local stack. For instance here are the build instructions for building Leksah using stack:

git clone --recursive
cd leksah
stack install alex happy
stack install haskell-gi
stack install gtk2hs-buildtools
stack install