Software
Home Ordering Info Lecture Slides Demos Bugs/Errata Software Solutions to Exercises


The code originally used in The Haskell School of Expression relied on a graphics library called SOEGraphics, which in turn depended on a more primitive, but not-very-portable, graphics library called HGL.

We now recommend down-loading the source code for SOE below, which imports a new graphics library called simply SOE.  The SOE library uses a highly-portable graphics package based on OpenGL.  Alternatively, there is a version based on Gtk, although it is not quite as portable as the former.  In both cases we recommend using GHC (and GHCi) as the Haskell compiler (and interpreter).  Both methods for installing SOE are described below.

Acknowledgements:  Thanks to Paul Liu for writing the GLFW package, and to Duncan Coutts for writing the Gtk2Hs library for SOE (some of the code from that is in fact used in GLFW).

Note:  If you encounter any problems with the graphics packages, please send email to both Paul Liu (hai.liu@yale.edu) and Paul Hudak (paul.hudak@yale.edu).

GHC

We recommend using the Glasgow Haskell Compiler (GHC) version 6.8 or later. The easiest way to install GHC is by downloading the latest Haskell Platform, which includes an installation package called Cabal.  If you install GHC in some other way, you may have to install Cabal on your own -- see http://www.haskell.org/haskellwiki/Cabal-Install

OpenGL

This is the recommended way to use SOE, relying on the OpenGL and GLFW packages for better cross-platform support than was previously available.

Step 1: Install the Haskell packages that SOE depends on.  To do this, open a command prompt and enter:

cabal install GLFW

This will download, configure, and install the GLFW Haskell package into your system.  It may also automatically download and install the OpenGL Haskell package for you if your system does not already have it.

Step 2: Download the SOE source code from:  SOE-20120121.zip

The SOE source code requires no installation once GLFW is installed.  Simply place the SOE code where you want it, load any module into GHCi, and hope for the best!

Note for OS X users: running graphics applications from GHCi is no longer supported. Instead, one has to compile a graphics program using GHC in order to run it (see example/GMIExamples.lhs for an example). Running non-graphics operations, such as MIDI playing, from GHCi may be fine and not affected.

Gtk2Hs

Instead of using OpenGL / GLFW, an alternative way to run SOE source code is to use the module Graphics.SOE.Gtk instead of the SOE.hs included in the source above.  To do this, follow the installation instructions for Gtk2Hs at http://www.haskell.org/gtk2hs, then import the module Graphics.SOE.Gtk instead of SOE.hs in your code.

Although both platforms have their advantages from a graphics point of view, keep in mind that:

  1. Gtk2Hs is bigger than GLFW (8.5MB vs. 120KB download, and 84MB vs. 1.8MB installed).

  2. Gtk2Hs for Windows requires exactly version 6.6.1 of GHC.

  3. You can try compiling Gtk2Hs from source for other versions of GHC, but that is sometimes not so easy. 
    Unfortunately, it is a must for the Mac and any Linux distribution not supported by Gtk2Hs.