|
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). OpenGL This is the recommended implementation of
the SOE source code. It runs under the latest release of GHC (which you
should install first), and depends on the Haskell OpenGL and GLFW packages for
better cross-platform support than was previously available. The support
code for computer music has also been updated to work with GHC. All of the
code has been tested on Windows, Linux and Mac OS X under GHC 6.6.1 and 6.8.2. It might
also work under other versions of GHC or Hugs, but has not been tested.
GLFW (see http://haskell.org/haskellwiki/GLFW) comes as Haskell package that must be installed before running SOE code. It is a Haskell front-end for the GLFW OpenGL framework, and provides an alternative to GLUT for OpenGL-based Haskell programs. The second download is a Haskell Cabal package that can be installed in the following way:
1. Make sure ghc (or ghc.exe) is in your PATH environment. On Windows
machines, you also need the gcc-lib directory to be in your PATH.
2. unpackage the source, go to its top directory where file GLFW.cabal exists, and type:
runhaskell Setup.hs configure
Or, if you want to install the Haskell package to your user's directory (DIR)
instead of the system default directory:
runhaskell Setup.hs configure --user --prefix=DIR
3. To build the Haskell module, type:
runhaskell Setup.hs build
4. To install the Haskell module, type:
runhaskell Setup.hs install
Note that GLFW requires Cabal 1.2 or later to build, which comes as default in
GHC 6.8 and later. If you are using GHC 6.6, please compile and install
Cabal 1.2 (and also FilePath which Cabal 1.2 depends on) first before installing
GLFW.
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! However, on MacOS X, you'll have to use the "EnableGUI trick" from wxHaskell (see http://wxhaskell.sourceforge.net/building-macosx.html). The software for that trick is included in the SOE download, so all you need to do is the following:
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:
|