We're using the Glasgow Haskell Compiler in 341, version 6.10.4. (The CSE linux machines have version 6.10.3 -- this should work fine as well.) GHC is the de facto standard version of Haskell.
At the command prompt type ghci to start it, or ghci MyFile.hs to start it and load MyFile.hs.
An advantage of running on the lab Linux machines is that we have the emacs Haskell mode package already downloaded -- see Using Linux and Emacs in CSE 341.
Run Haskell by typing ghci or ghci MyFile.hs in a command window. You can also run Haskell on a .hs file by double-clicking on the file name.
Alternately, if you're just experimenting and don't have a source file,
you can run Haskell via the "Start" menu. It's here:
All Programs / DEV TOOLS & LANGUAGES / GHC / 6.10.4 / GHCi
There are also local copies of documentation under
Programs / DEV TOOLS & LANGUAGES / GHC / 6.10.4
Haskell is available for Windows, Mac, and Linux. Get the Haskell Platform rather than the bare ghci, since the Haskell Platform includes the HUnit unit testing package that we'll be using in 341. Here's the download page: http://hackage.haskell.org/platform/.
A newer version of ghci came out Dec 14 2009, but the Haskell Platform hasn't been updated yet. In any case, since 6.10.4 (or 6.10.3) works fine and is what is installed on the undergrad lab machines, that will be the official version for this offering of 341.
A few essential commands:
If you just want to try Haskell without loading any files, just start it up. For anything interesting, though, you'll want to have a file with defintions in it. A simple way to do this is to use your favorite editor to create a file (with the extension .hs) in your home directory or a subdirectory. Save the file but leave the editor open on it. Then start up Haskell in that same directory on that file. Try things out. If you want to edit your file, do so and save it, and then back in Haskell reload the file using :reload.
The above directions may be all you want for 341; and in any case I'd suggest starting out that way. For students comfortable with emacs (or who are willing to learn) running Haskell from emacs is more convenient in the long run. There are directions for installing and running this at Haskell mode for Emacs.
If you are running on the ugrad linux machines, we've got the emacs Haskell mode packages downloaded already. Just add the following line to the .emacs file in your home directory:
(load "/cse/courses/cse341/common/haskell-mode-2.4/haskell-site-file")
Unlike most programming languages, whitespace is significant in Haskell. So that you can see whether things are lining up properly use a fixed-pitch font when editing. Haskell has some rule about how tabs are processed, but I recommend that you avoid tabs in Haskell code and always use spaces instead.
For emacs, if you use the Haskell mode for Emacs, it will avoid using tabs in files. Otherwise, by default, Emacs inserts tabs in place of multiple spaces when it formats a region. Putting the following in your .emacs file turns this off:
(setq-default indent-tabs-mode nil)