The system to be used to run Hugs during the lab sessions is Linux (not Windows). This is the system the lab exams will be run on so I advise you not to use Windows even if you know how to run Hugs on it and to get familiar with Linux.

If the computer you are using is not booted into Linux, reboot the computer and pick Linux in the starting menu. Then enter your regular username name and password to log in.

In order to run Hugs on a Linux system you need to open a terminal window. This can be done using either a shortcut from your Desktop (icon Gnome Terminal) or the Applications menu (-> Accessories -> Terminal, depending on what window manager you are using). A terminal window is a command prompt.

When you open a terminal window the default/current working directory is your home directory. You can check this with the command pwd. If you type it in and the location (or path) displayed ends with your name (eg. /users/postoc/sozdowska), you are in your home directory. If not, you can change directories and go to your home directory with the command cd. The usage of the command cd is:

cd directory

where directory is the name of the directory which you wish to become the current working directory. Your home directory can be referred to as ~/ and hence the command to go to it is:

cd ~/

To start Hugs, simply type Hugs at the terminal (prompt).

You can now type in and evaluate expressions that use predefined functions, ie. functions defined in the standard prelude.

To use your own functions (user-defined functions) you first need to define them. This is done in a script, which is a file containing definitions, declarations and comments. You only need a text editor to write a script. You can use gedit on Linux. You can start it selecting Applications -> Accessories -> Text Editor from the panel menu. Gedit is used just as any other text editor on Windows (eg. Notepad or Wordpad). In order Hugs to be able to recognise your file as being a Haskell script, you need to save it with the extension .sh (eg. itoa.hs). Another very important thing is to save the script in your home directory, which should also be your current working directory, to make it possible for Hugs to load it. So be careful when saving your script to select the good location (ie. your home directory).

To start using your own functions, load the script where they are defined with the command

:load script.hs

where script.hs is the name of your file. If the working directory of your terminal window is different from the one your script is saved in, Hugs will not be able to load the script unless you provide the complete path to the script (eg. if the current working directory is /users/postoc/sozdowska and the script is saved in the folder /users, the command to load the script is

:load /users/script.hs


where /users/script.hs is the complete or absolute path leading to the location of the script).

Last but not least: there are loads of Linux tutorials on the web to help you to get familiar with Linux (for example, section 3.3 First Steps into Linux). Feel free to find out more about it should you have any difficulties.