CS_221 Functional Programming
Haskell and Graphics
The easiest way to work with the graphics library in the linux lab (without downloading the library):
If you work in a bash shell, then include the corresponding lines in the file
.bashrc inserting = after runhuggs, huggs respectively.
- Insert in your .cshrc file the lines
- alias runhuggs 'runhugs -P/compsci/saturn/staff/csulrich/graphics-2.0.4/lib/x11:'
- alias huggs 'hugs -P/compsci/saturn/staff/csulrich/graphics-2.0.4/lib/x11:'
- A sample file: HelloWorld.hs
- Run the sample file: runhuggs HelloWorld.hs
Also try: huggs HelloWorld.hs and call main to obtain the same result.
- The difference between runhuggs and hugs:
- runhuggs expects as argument a filename and executes the program main
(which must exist in the file).
- huggs is used exactly like hugs (with the advantage that you may
execute in addition graphics programs).
- Probably you will find huggs more convenient to use.
Downloading the graphics library:
- Windows: I'll put this here shortly (the downloading links at the hugs web page don't seem to work).
Installation instruction in linux:
- Unpack the tar file:
- tar -xvf graphics-2.0.4.src.tar.gz
- make -C graphics-2.0.4/lib/x11 system=Linux hugs_install=/usr/bin/hugs
It might be necessary to replace `/usr/bin/hugs' by the actual hugs
path (type `which hugs' to find out this path).
- runhugs -Pgraphics-2.0.4/lib/x11: graphics-2.0.4/demos/HelloWorld.hs
Back to cs221
Back to Information for Students
Back to my Homepage
Ulrich Berger, Monika Seisenberger, 26.10.03