Running Haskell
This page is organized as follows:
- Running Haskell on Eustis
- Running Haskell on Your Own Machine
- Getting Test Output for Homework
- Troubleshooting
- Advanced Topics
We recommend using the GHC system for this class.
Running Haskell on Eustis
Most students will find it easiest to use their own computer system for class work. However, if you do not have your own computer, you could use the eustis.eecs.ucf.edu system.
You can login to your account at eustis.eecs.ucf.edu using your NID as your login. Your default password is of the form Pyymmdd, where yymmdd is your birth year, month and day.
To access Eustis, use an ssh client like putty from anywhere on campus. From off-campus, you will need a VPN connection to UCF first. For a VPN account and help, go to http://www.noc.ucf.edu/VPN/default.htm
Starting Haskell
On Eustis, the GHC system is found in /usr/bin/, which should be in your PATH by default. (Thus you shouldn't have to do anything special to set this up.)
To run GHC, simply issue the command ghci at the shell's prompt.
Exiting Haskell
To quit ghci, use :quit.
Running Haskell on Your Own Machine
The GHC system is most convenient to use on your own computer.
Getting Haskell for your Own Machine
The GHC system used for this course is available on many platforms, including Linux, Macintosh, and Windows. You can download it from haskell.org. Follow the installation instructions carefully. You may need to put the ghc/2014.2.0.0/bin directory in your PATH environment variable. (To set environment variables in Windows XP/Vista/7, start the control panel, then click on "System", then the "Advanced" tab, then click on "Environment Variables". Windows 8 is similar.)
If you find more details about a system that you had trouble with, see the course staff. If you fix such a problem yourself, please let us know how you fixed the problem.
Getting Test Output for Homeworks
Homework problems require you to capture the output of our testing tool. It is possible to copy and paste from a shell in some systems. If you use a Windows machine, you can use WinGHCi, which is available from https://code.google.com/p/winghci/ and copy and paste the output from there.
However, another way to do this may be easier, which is to use the runhaskell command and direct the output to a file. (The runhaskell command should be prt of the Haskell distribution, which should be in your PATH.) For example you can execute a command like the following, where you replace WhateverTests.hs with the name of the appropriate testing file.
runhaskell WhateverTests.hs > whatever-output.txt
Then the contents of the output, in whatever-output.txt can be read into a text editor and copied and pasted into the specified place on webcourses for the homework.
Troubleshooting
Type Errors
If you get a type error message, look at the source code in the given location and see if you can understand why that code may be wrong (in some cases).
Other Problems
If you are having a problem not described above, or if the solutions listed above are not working for you, you can look at the webcourses2 discussions, where we often post answers to other people's questions. If none of that help then please don't hesitate to contact the course staff.
Advanced Topics
There are a variety of programming environments for Haskell that are described below.
Leksah
is an IDE that only supports Haskell.Haskell Eclipse Plugin
The EclipseFP plugin for Eclipse is good if you like working in Eclipse.
Running Haskell from Within Emacs
To run Haskell from within Emacs, see https://github.com/haskell/haskell-mode#readme. This is what Gary uses in class.
Windows Keystrokes in Emacs
If you like to use the standard Windows keystrokes for cut, paste, and copy, customize Emacs to use CUA-mode by default. (This assumes that you have Emacs version 22 or later. Use the menu "Options", select "Customize Emacs", and from there the select "Top Level Customizations". then select the "Convenience" group by clicking on the "go to group" link, and then go to the Cua group, and click on the "Value Menu" for enabling this customization.
If the above doesn't work, or if you have a version of Emacs previous to 22, put the following in your emacs initialization file, ~/.emacs.el. (The lines that start with a semicolon are comments, and can be omitted.)
(if (< emacs-major-version 22) (progn ;; Make emacs more like standard windows applications in terms of ;; mouse selections (this is similar to pc-select). ;; One advantage is this is that it makes Dragon Dictate work with Emacs. (require 'cua) ;; Make the behavior of emacs on C-c, C-v, C-x, and C-z to be ;; just like that of be as in standard window apps, so you can use ;; these keys to copy, paste, and select when there is a selection ;; active, then uncomment the following. (CUA-mode t) ;; Make C-c leave the region active, which is what happens under Windows. (setq CUA-mode-keep-region-after-copy t) ) ;; The same for emacs version 22 (and hopefully higher...) ;; but not for aquamacs, which already has it. (if (not (featurep 'aquamacs)) (progn (cua-mode) (setq cua-enable-cua-keys t) (setq cua-mode-keep-region-after-copy t) ) ) )
Alternatively, you can use Gary Leavens's .emacs.el file which includes the above lines and several other things. It should be saved into .emacs.el in your home directory. (On Windows you may not have a home directory yet, so pick one. You also have to set HOME in the environment; this is automatic in Unix and hence on Mac OS X, but needs to be done by hand in Windows.)
Making Emacs find your Customization File
On Linux to have emacs find your ~/.emacs.el file you just have to have it in your home directory. On Windows machines, if the emacs is not finding your ~/.emacs.el file, it is because it doesn't know where your home directory is. To do this, you have to set your environment variable HOME to the right directory.
For Vi Users
If you are a vi user, you may want to use viper-mode in emacs to get the vi keystrokes and still use all the wonderful features of Emacs. To do this, put the following in your .emacs.el file:
(viper-mode)
Last modified Tuesday, February 3, 2015.
This web page is for COP 4020 at the University of Central Florida. The details of this course are subject to change as experience dictates. You will be informed of any changes. Please direct any comments or questions to Gary T. Leavens at leavens@eecs.ucf.edu. Some of the policies and web pages for this course are quoted or adapted from other courses I have taught, in partciular, Com S 342.