A Haskell binding for GLFW http://haskell.org/haskellwiki/GLFW
|Latest on Hackage:||0.5.2.5|
This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow stackage.org to host generated Haddocks.
(http://www.glfw.org). It provides an alternative
to GLUT for OpenGL based Haskell programs.
SOE (http://www.cs.yale.edu/homes/hudak/SOE/) now
depends on this package.
The website for this Haskell module is at Haskell Wiki site:
See separate file "Changlog.txt".
The package comes together with a (partial) source distribution
of GLFW v2.7.9, which is compiled and installed together with
the Haskell package.
If you already have the Haskell package cabal-install, you can
simply do "cabal install GLFW", and it will download the latest
source from HackageDB, configure, compile, and install it
Otherwise, you may follow the standard Cabal package installation
1. To configure the module, type
runhaskell Setup.hs configure
runhaskell Setup.hs configure --user --prefix=DIR
if you want to install the package to your user's directory
instead of the system one (replace DIR with your own directory
2. To build the module, type
runhaskell Setup.hs build
3. To install, type
runhaskell Setup.hs install
In the process it builds all GLFW C library source code. You may
use "runhaskell Setup.hs build --verbose" to see the actual
4. Optionally to build its Haddock documentation, type
runhaskell Setup.hs haddock
For Windows users, you may have to include GHC's gcc-lib directory
in your PATH environment, e.g., c:\ghc\ghc-7.6.3\gcc-lib, before
configuring the GLFW module, otherwise it'll complain about missing
program for ld.
For Linux users there is an option to link to a system wide GLFW
dynamical library instead of compilation from source. It can be
done by providing "--flags=dynamic" as an option to cabal configure
For Mac users, unfortunately interactively running GLFW programs
from GHCi would result in a crash if you use GHC 7.6.3 or older.
The only sensible way is to compile and run the program, or use
GHC 7.8 or newer.
The package is tested with GHC 7.4.2 and GHC 7.6.3 on all
three platforms (Linux, Win32/MinGW, and Mac OS X). Though it may
work with older versions of GHC or even Hugs, they are not tested.
It installs a new Haskell package called "GLFW" and the actual
module to import is "Graphics.UI.GLFW". You'll need to pass
"-package GLFW" to GHC if you want to compile it.
GLFW itself is well documented (see GLFW website), and the
Haskell module API is documented via Haddock.
Not all functions are fully tested, and there are still a
few GLFW C functions missing from the Haskell module, namely
the image loading functions. They are excluded because image
handling is a separate issue, and low level buffer manipulation
would obscure their use further. Texture loading from TGA
format is supported both from file and from memory (via a
The Haskell module also provides basic text rendering while
GLFW doesn't. It comes from a free 8x16 font which is made
into a TGA texture, stored as a Haskell string in the file
GLFW.hs (also the reason for its big size). Text rendering
is only possible with Alpha enabled. Again, see SOE.hs from
the SOE package for sample usage.
GLFW doesn't work well with GHC threads, forkIO or threadDelay.
So avoid them if you can.
You may send your bug report and feature request to the package
maintainer: Paul H. Liu <email@example.com>.
Lastest GLFW development is hosted in a darcs repository. You
may obtain it by
darcs pull http://code.haskell.org/GLFW
There is also a mailinglist for GLFW deveopers at
Last Updated: Thu Oct 3 PST 2013
* Bump version to 0.5.2.5
Sun Mar 27 13:01:28 PDT 2016 Sergei Trofimovich <firstname.lastname@example.org>
* Allow OpenGL-3
Mon Jul 6 00:17:26 PDT 2015 email@example.com
* Change tab to space
Mon Jul 6 00:14:07 PDT 2015 firstname.lastname@example.org
* Bump version to 0.5.2.4
Mon Jul 6 00:13:52 PDT 2015 email@example.com
* Comptability fix for GHC 7.8.4
Tue Jun 23 11:52:53 PDT 2015 firstname.lastname@example.org
* Update for ghc 7.10.1
Specifically adressing the change that we now have "class (Applicative m) => Monad m" in base.
Tue Aug 5 15:45:35 PDT 2014 email@example.com
* Bump version to 0.5.2.2
Tue Aug 5 15:45:31 PDT 2014 firstname.lastname@example.org
* Add NOINLINE to stablize top-level IORefs
Tue Aug 5 11:44:50 PDT 2014 email@example.com
* Bump version to 0.5.2.1
Tue Aug 5 11:43:24 PDT 2014 firstname.lastname@example.org
* Add IOKit framework for OS X and some minor fix
Thu Oct 3 23:59:17 PDT 2013 email@example.com
* Bump version to 0.5.2.0
Thu Oct 3 23:26:34 PDT 2013 firstname.lastname@example.org
* Upgrade to glfw C version 2.7.9
Thu Oct 3 23:25:39 PDT 2013 email@example.com
* Compatibility fix to work with Cabal 1.18
Sat Nov 3 21:41:09 PDT 2012 firstname.lastname@example.org
* Bump version to 0.5.1.0 for release
Sat Nov 3 21:39:46 PDT 2012 email@example.com
* Enable 64-bit fix for MouseWheelCallback
Thu Aug 30 20:07:02 PDT 2012 firstname.lastname@example.org
* Use Int for MouseWheelCallback
Wed Jun 13 21:53:39 PDT 2012 email@example.com
* use C types for FFI
Sat Jun 2 03:58:54 PDT 2012 Marc Sunet <firstname.lastname@example.org>
* Previous GLint was not quite working (linker error). Now fixed.
Sat Jun 2 03:38:31 PDT 2012 Marc Sunet <email@example.com>
* GLint warning fixed.
Mon May 28 02:46:56 PDT 2012 Marc Sunet <firstname.lastname@example.org>
* Update to version 2.7.5
C sources updated, nothing to be done on the Haskell side.
Fixed a warning about unsafePerformIO being deprecated. Using the new function from System.Unsafe.
There are still a few warnings about GLint that could be supressed.
Fri Jan 27 11:07:48 PST 2012 email@example.com
* merge the source of StateT into Setup.hs since mtl is not a default library; bump up version
Sat Jan 21 01:08:46 PST 2012 firstname.lastname@example.org
* update API doc for windowCloseCallback
Sat Jan 21 01:05:06 PST 2012 email@example.com
* update SOE url
Fri Jan 20 13:17:21 PST 2012 firstname.lastname@example.org
* cosmetic changes before new release
Fri Jan 20 09:55:56 PST 2012 email@example.com
* update README
Fri Jan 20 02:45:53 PST 2012 Marc Sunet <firstname.lastname@example.org>
* Minor docs edit. I mentioned that AutoPollEvent is enabled by default.
Fri Jan 20 01:34:45 PST 2012 email@example.com
* use a record for confState
Fri Jan 20 01:34:19 PST 2012 firstname.lastname@example.org
* update README
Fri Jan 20 01:06:41 PST 2012 email@example.com
* re-org haddock comments
Thu Jan 19 22:55:43 PST 2012 firstname.lastname@example.org
* fix example to match new param API
Thu Jan 19 14:24:38 PST 2012 email@example.com
* revert back to atexit on x11
Thu Jan 19 12:37:13 PST 2012 Marc Sunet <firstname.lastname@example.org>
* Fixed X11 build.
X11 build now detects the directory where the X11 files are installed and passes that as an include
directory to gcc.
Edited .cabal file so that the X11 section is triggered on FreeBSD, not only on Linux.
Wed Jan 18 01:32:08 PST 2012 Marc Sunet <email@example.com>
* Added myself to the maintainer list.
Mon Jan 16 14:10:07 PST 2012 firstname.lastname@example.org
* clean up Setup.hs, and put back the x-cc-name hack for OS X
Sat Jan 14 03:40:41 PST 2012 Marc Sunet <email@example.com>
* Setup.hs now successfully passes the extra libs to the install process.
The extra libs were being passed to the build process, but not the install one, so applications would
fail to link properly.
I haven't figured out how to pass data between hooks, so as a workaround I made the build hook write
the extra libs to a temporary file which is then read by the install hook. The install hook reads the
extra libs, creates a modified PackageDescription and then delegates the rest of the work to the real
Sat Jan 14 02:46:18 PST 2012 Marc Sunet <firstname.lastname@example.org>
* Setup.hs now passes the extra libraries to the build process.
Sat Jan 14 01:37:47 PST 2012 Marc Sunet <email@example.com>
* Added Setup.hs sysctl check.
Sat Jan 14 01:31:30 PST 2012 Marc Sunet <firstname.lastname@example.org>
* Setup.hs flags auto detection.
I have also edited the .cabal file to add some default flags for Linux.
Wed Jan 11 10:58:17 PST 2012 Marc Sunet <email@example.com>
* Hint and Param type families.
openWindowHint and getParam substituted by param families.
Mon Jan 9 02:00:58 PST 2012 Marc Sunet <firstname.lastname@example.org>
* Added default-language: Haskell98 to cabal file.
Sun Jan 8 21:19:49 PST 2012 email@example.com
* mark safe foreign calls
Sun Jan 8 21:18:51 PST 2012 firstname.lastname@example.org
* WindowCloseCallback now returns Bool instead of ()
Sun Jan 8 21:04:46 PST 2012 email@example.com
* get rid of compilation warning
Thu Jan 5 06:45:05 PST 2012 Marc Sunet <firstname.lastname@example.org>
* Documentation + glVersion
Documentation has been extended. Added the gettable statevar 'glVersion'.
Thu Jan 5 05:51:37 PST 2012 Marc Sunet <email@example.com>
* windowPos statevar added
Thu Jan 5 02:51:59 PST 2012 Marc Sunet <firstname.lastname@example.org>
* WindowParam missing constructors added.
I have added the missing values to the WindowParam enum. In the original glfw library WindowHint and
WindowParam share enum values, so I prepended a P to WindowParam constructors to avoid name clashes.
The result isn't very clean, but I suppose that since WindowHint is used more frequently it should be
Thu Jan 5 02:20:40 PST 2012 Marc Sunet <email@example.com>
* WindowHint and openWindowHint redesign
Redesigned WindwoHint and openWindowHint. Also added the Profile enum.
Wed Jan 4 02:30:25 PST 2012 firstname.lastname@example.org
* require Cabal >= 1.10, and fix building on 32-bit OS X
Tue Jan 3 10:06:50 PST 2012 Marc Sunet <email@example.com>
* WindowHint - OpenGL context info
Added the following constructors to WindowHint: OpenGLVersionMajor, OpenGLVersionMinor,
OpenGLForwardCompat, OpenGLContext, OpenGLProfile.
Mon Jan 2 15:01:31 PST 2012 firstname.lastname@example.org
* add an example (same one I wrote on HaskellWiki)
Mon Jan 2 14:27:45 PST 2012 email@example.com
* use default hook when x-cc-name is not available
Mon Jan 2 14:20:10 PST 2012 firstname.lastname@example.org
* replace atexit with on_exit on x11
Mon Sep 26 01:59:21 PDT 2011 email@example.com
* upgrade to glfw-2.7.2, build darwin through gcc, and bump our version to 0.5.0.0
Mon Sep 26 01:52:52 PDT 2011 firstname.lastname@example.org
* fix compilation warnings
Mon Sep 26 01:09:24 PDT 2011 email@example.com
* change texture rendering direction to counter-clockwise in renderChar
Wed Sep 16 11:00:09 PDT 2009 firstname.lastname@example.org
* change CC option to fit Snow Leopard
Wed Aug 12 17:53:18 PDT 2009 email@example.com
* bugfix for the dynamic flag; bump version to 0.4.1 for release.
Wed Aug 12 12:53:09 PDT 2009 firstname.lastname@example.org
* update README.txt
Wed Aug 12 12:52:38 PDT 2009 email@example.com
* addition to Work around GHC FFI bug 2594 only in GHC < 6.10
Sun Aug 2 05:02:16 PDT 2009 firstname.lastname@example.org
* remove use of Int32 and make it compatible with OpenGL 22.214.171.124
Sat Jun 6 21:10:07 PDT 2009 email@example.com
* Work around GHC FFI bug 2594 only in GHC < 6.10
Sat Jun 6 00:03:14 PDT 2009 firstname.lastname@example.org
* Whitespace-only change to LICENSE.
Sat Jun 6 00:01:48 PDT 2009 email@example.com
* hlint cleanliness, Haddock comment improvements.
Fri Jun 5 22:37:10 PDT 2009 firstname.lastname@example.org
* Made small improvements to GLFW.cabal
Fri Jun 5 22:10:19 PDT 2009 email@example.com
* Made small improvements to Setup.hs
Wed Jun 3 06:41:31 PDT 2009 firstname.lastname@example.org
* cabal related adjustments
1. adjust to work properly with latest cabal.
2. add -mach=apple as a cc-option for OS X in order not to break GHC 6.10.2.
3. add a "dynamic" flag for Linux to link to GLFW dynamic libs already in system.
Tue Dec 2 19:46:37 PST 2008 email@example.com
* joystick-related cleanup
Mon Nov 3 15:03:56 PST 2008 firstname.lastname@example.org
* add derived instance for Ord for Key and SpecialKey
Sat Nov 1 17:50:32 PDT 2008 email@example.com
* fix 64-bug for mousePosCallback (with dirty hack)
Mon Oct 27 15:41:18 PDT 2008 firstname.lastname@example.org
* openWindow fixes
Thu Oct 2 03:04:13 PDT 2008 email@example.com
* marking more foreign imports safe
Thu Oct 2 00:26:39 PDT 2008 firstname.lastname@example.org
* 'deteced -> detected'
Thu Oct 2 00:25:35 PDT 2008 email@example.com
* some foreign imports cannot be marked unsafe
Tue Sep 30 11:25:57 PDT 2008 firstname.lastname@example.org
* miscellaneous simplification
Tue Sep 30 06:26:03 PDT 2008 email@example.com
* removed unnecessary stuff from foreign imports, added "unsafe"s
Tue Sep 30 00:57:00 PDT 2008 firstname.lastname@example.org
* bump to 0.4, miscellaneous cleanup
Sat Sep 13 16:20:00 PDT 2008 email@example.com
* workaround for correct mouse wheel values on 64-bit-machines
Sat Sep 6 12:17:51 PDT 2008 firstname.lastname@example.org
* fix mousePosCallback bug on 64-bit machines
Thu Sep 4 18:30:11 PDT 2008 email@example.com
* fix typo bug in disableSpecial, and improve some error msgs.
Wed Sep 3 19:39:52 PDT 2008 firstname.lastname@example.org
* GLFW-0.3 init release