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 <firstname.lastname@example.org>.
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 <email@example.com>
* Allow OpenGL-3
Mon Jul 6 00:17:26 PDT 2015 firstname.lastname@example.org
* Change tab to space
Mon Jul 6 00:14:07 PDT 2015 email@example.com
* Bump version to 0.5.2.4
Mon Jul 6 00:13:52 PDT 2015 firstname.lastname@example.org
* Comptability fix for GHC 7.8.4
Tue Jun 23 11:52:53 PDT 2015 email@example.com
* 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 firstname.lastname@example.org
* Bump version to 0.5.2.2
Tue Aug 5 15:45:31 PDT 2014 email@example.com
* Add NOINLINE to stablize top-level IORefs
Tue Aug 5 11:44:50 PDT 2014 firstname.lastname@example.org
* Bump version to 0.5.2.1
Tue Aug 5 11:43:24 PDT 2014 email@example.com
* Add IOKit framework for OS X and some minor fix
Thu Oct 3 23:59:17 PDT 2013 firstname.lastname@example.org
* Bump version to 0.5.2.0
Thu Oct 3 23:26:34 PDT 2013 email@example.com
* Upgrade to glfw C version 2.7.9
Thu Oct 3 23:25:39 PDT 2013 firstname.lastname@example.org
* Compatibility fix to work with Cabal 1.18
Sat Nov 3 21:41:09 PDT 2012 email@example.com
* Bump version to 0.5.1.0 for release
Sat Nov 3 21:39:46 PDT 2012 firstname.lastname@example.org
* Enable 64-bit fix for MouseWheelCallback
Thu Aug 30 20:07:02 PDT 2012 email@example.com
* Use Int for MouseWheelCallback
Wed Jun 13 21:53:39 PDT 2012 firstname.lastname@example.org
* use C types for FFI
Sat Jun 2 03:58:54 PDT 2012 Marc Sunet <email@example.com>
* Previous GLint was not quite working (linker error). Now fixed.
Sat Jun 2 03:38:31 PDT 2012 Marc Sunet <firstname.lastname@example.org>
* GLint warning fixed.
Mon May 28 02:46:56 PDT 2012 Marc Sunet <email@example.com>
* 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 firstname.lastname@example.org
* 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 email@example.com
* update API doc for windowCloseCallback
Sat Jan 21 01:05:06 PST 2012 firstname.lastname@example.org
* update SOE url
Fri Jan 20 13:17:21 PST 2012 email@example.com
* cosmetic changes before new release
Fri Jan 20 09:55:56 PST 2012 firstname.lastname@example.org
* update README
Fri Jan 20 02:45:53 PST 2012 Marc Sunet <email@example.com>
* Minor docs edit. I mentioned that AutoPollEvent is enabled by default.
Fri Jan 20 01:34:45 PST 2012 firstname.lastname@example.org
* use a record for confState
Fri Jan 20 01:34:19 PST 2012 email@example.com
* update README
Fri Jan 20 01:06:41 PST 2012 firstname.lastname@example.org
* re-org haddock comments
Thu Jan 19 22:55:43 PST 2012 email@example.com
* fix example to match new param API
Thu Jan 19 14:24:38 PST 2012 firstname.lastname@example.org
* revert back to atexit on x11
Thu Jan 19 12:37:13 PST 2012 Marc Sunet <email@example.com>
* 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 <firstname.lastname@example.org>
* Added myself to the maintainer list.
Mon Jan 16 14:10:07 PST 2012 email@example.com
* 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 <firstname.lastname@example.org>
* 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 <email@example.com>
* Setup.hs now passes the extra libraries to the build process.
Sat Jan 14 01:37:47 PST 2012 Marc Sunet <firstname.lastname@example.org>
* Added Setup.hs sysctl check.
Sat Jan 14 01:31:30 PST 2012 Marc Sunet <email@example.com>
* 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 <firstname.lastname@example.org>
* Hint and Param type families.
openWindowHint and getParam substituted by param families.
Mon Jan 9 02:00:58 PST 2012 Marc Sunet <email@example.com>
* Added default-language: Haskell98 to cabal file.
Sun Jan 8 21:19:49 PST 2012 firstname.lastname@example.org
* mark safe foreign calls
Sun Jan 8 21:18:51 PST 2012 email@example.com
* WindowCloseCallback now returns Bool instead of ()
Sun Jan 8 21:04:46 PST 2012 firstname.lastname@example.org
* get rid of compilation warning
Thu Jan 5 06:45:05 PST 2012 Marc Sunet <email@example.com>
* Documentation + glVersion
Documentation has been extended. Added the gettable statevar 'glVersion'.
Thu Jan 5 05:51:37 PST 2012 Marc Sunet <firstname.lastname@example.org>
* windowPos statevar added
Thu Jan 5 02:51:59 PST 2012 Marc Sunet <email@example.com>
* 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 <firstname.lastname@example.org>
* WindowHint and openWindowHint redesign
Redesigned WindwoHint and openWindowHint. Also added the Profile enum.
Wed Jan 4 02:30:25 PST 2012 email@example.com
* require Cabal >= 1.10, and fix building on 32-bit OS X
Tue Jan 3 10:06:50 PST 2012 Marc Sunet <firstname.lastname@example.org>
* WindowHint - OpenGL context info
Added the following constructors to WindowHint: OpenGLVersionMajor, OpenGLVersionMinor,
OpenGLForwardCompat, OpenGLContext, OpenGLProfile.
Mon Jan 2 15:01:31 PST 2012 email@example.com
* add an example (same one I wrote on HaskellWiki)
Mon Jan 2 14:27:45 PST 2012 firstname.lastname@example.org
* use default hook when x-cc-name is not available
Mon Jan 2 14:20:10 PST 2012 email@example.com
* replace atexit with on_exit on x11
Mon Sep 26 01:59:21 PDT 2011 firstname.lastname@example.org
* 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 email@example.com
* fix compilation warnings
Mon Sep 26 01:09:24 PDT 2011 firstname.lastname@example.org
* change texture rendering direction to counter-clockwise in renderChar
Wed Sep 16 11:00:09 PDT 2009 email@example.com
* change CC option to fit Snow Leopard
Wed Aug 12 17:53:18 PDT 2009 firstname.lastname@example.org
* bugfix for the dynamic flag; bump version to 0.4.1 for release.
Wed Aug 12 12:53:09 PDT 2009 email@example.com
* update README.txt
Wed Aug 12 12:52:38 PDT 2009 firstname.lastname@example.org
* addition to Work around GHC FFI bug 2594 only in GHC < 6.10
Sun Aug 2 05:02:16 PDT 2009 email@example.com
* remove use of Int32 and make it compatible with OpenGL 126.96.36.199
Sat Jun 6 21:10:07 PDT 2009 firstname.lastname@example.org
* Work around GHC FFI bug 2594 only in GHC < 6.10
Sat Jun 6 00:03:14 PDT 2009 email@example.com
* Whitespace-only change to LICENSE.
Sat Jun 6 00:01:48 PDT 2009 firstname.lastname@example.org
* hlint cleanliness, Haddock comment improvements.
Fri Jun 5 22:37:10 PDT 2009 email@example.com
* Made small improvements to GLFW.cabal
Fri Jun 5 22:10:19 PDT 2009 firstname.lastname@example.org
* Made small improvements to Setup.hs
Wed Jun 3 06:41:31 PDT 2009 email@example.com
* 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 firstname.lastname@example.org
* joystick-related cleanup
Mon Nov 3 15:03:56 PST 2008 email@example.com
* add derived instance for Ord for Key and SpecialKey
Sat Nov 1 17:50:32 PDT 2008 firstname.lastname@example.org
* fix 64-bug for mousePosCallback (with dirty hack)
Mon Oct 27 15:41:18 PDT 2008 email@example.com
* openWindow fixes
Thu Oct 2 03:04:13 PDT 2008 firstname.lastname@example.org
* marking more foreign imports safe
Thu Oct 2 00:26:39 PDT 2008 email@example.com
* 'deteced -> detected'
Thu Oct 2 00:25:35 PDT 2008 firstname.lastname@example.org
* some foreign imports cannot be marked unsafe
Tue Sep 30 11:25:57 PDT 2008 email@example.com
* miscellaneous simplification
Tue Sep 30 06:26:03 PDT 2008 firstname.lastname@example.org
* removed unnecessary stuff from foreign imports, added "unsafe"s
Tue Sep 30 00:57:00 PDT 2008 email@example.com
* bump to 0.4, miscellaneous cleanup
Sat Sep 13 16:20:00 PDT 2008 firstname.lastname@example.org
* workaround for correct mouse wheel values on 64-bit-machines
Sat Sep 6 12:17:51 PDT 2008 email@example.com
* fix mousePosCallback bug on 64-bit machines
Thu Sep 4 18:30:11 PDT 2008 firstname.lastname@example.org
* fix typo bug in disableSpecial, and improve some error msgs.
Wed Sep 3 19:39:52 PDT 2008 email@example.com
* GLFW-0.3 init release