The major goals of the course are to develop your skills and vocabulary for reasoning clearly about programs and programming, and to provide a toolbox of modern programming techniques that will be applicable in almost any language. To help in this process, we'll use a language called Haskell, which makes it easy to quickly and incrementally develop solutions to problems, while really making clear (and enforcing) the underlying core concepts.
Language
A number of resources are available to help you with the language; most are linked directly from haskell.org. Additional recommendations are welcome (by email to the course instruction, or by post on the Blackboard discussion forum).
References
- hoogle
- Search through documentation (e.g., map). You are encouraged to customize firefox (or even GHCi) to make this particularly simple.
- zvon.org
- Categorized lists of functions, data types, etc.
- quick reference
- Summarizes a number of common Haskell functions. Provided for exams.
- cheat sheet
- Explanations of how language constructs work, useful for nitty-gritty details once you have the basic idea. Written by Justin Bailey, and maintained at cheatsheet.codeslower.com.
- Haskell wiki
- Links to anything that you might want to know about Haskell (and lots that you don't!)
- Haskell 98 report
- The full language description. Part II (Libraries) is useful. Part I is very formal and can be hard to decipher.
Learning
In addition to the textbook and course notes, there are plenty of other ways to learn about Haskell. The Haskell wiki maintains a list; here are some that have seemed particularly useful in the CS 8 context.
- Learn Haskell in 10 Minutes
- The name says it all—a quick overview
- Yet Another Haskell Tutorial
- Fairly comphrensive tutorial covering all of Haskell (including parts we won't discuss). Also serves as a good reference.
- Real World Haskell
- Lots of good examples of putting Haskell to use. Freely available, or buy a hard copy.
GHC
We will be using the Glasgow Haskell Compiler (GHC). We will generally be using it in its interactive interpreter mode (GHCi), but it is also possible to use it to compile stand-alone applications. The GHC documentation page has an official user's guide and library reference, along with collaborative documentation (FAQs, etc.).
GHC is installed in the Sudikoff Mac labs, but I know many of you will also want to be able to work on your own machines. While the general installation process is described at the GHC site; CS sysadmins Tim Tregubov, Sandy Brash, and Wayne Cripps have tested, simplified, and customized the process for CS 8 students.
SOE Graphics
On top of GHC, we will be using the SOE Graphics package developed for our textbook. Due to some implementation details, we use some platform-specific versions and import statements. When Hudak writes
import SOEGraphics
we replace it with
import Graphics.SOE.Gtk
for Macs and
import SOE
for Windows and Linux. Since I use a Mac and the instructional labs have Macs, you will see me using the Gtk version; if you are using a Windows or Linux machine, you will need to change the import statements accordingly. You'll also need to make sure the SOE.hs file (see below) is in the same folder, and start ghci from the command-line rather than using "open with" on the .hs file.
To use SOE on your own machine, you must download all of the software related to the SOE book. A version is available on the book's web page. There are some other minor library changes made since the book was published, but we have packaged updated versions:
We recommend that you set up a cs8 folder for all your class work, and unzip the downloaded file there, giving an SOE folder with a src subfolder containing all the code from the book. If you use Windows/Linux and create your own subfolders to organize your code (different assignments, different lecture notes, etc.), make sure that SOE.hs is available to those files importing SOE, and start ghci from the command-line.
The SOE/src code is in Literate Haskell, which allows text to be written around the code. The suffix is ".lhs" rather than ".hs". The program lhs2.hs can be used to turn .lhs files into .hs files. Instructions are included in the comments at the start of the file. (If you look at an .lhs file, you'll see that lines of code to be compiled start with ">", while lines beginning with "<" are in the text, but not necessarily executable, and those beginning with "|" are also in the text, but are often just expressions or code fragments.)
Unix
We will not be teaching you how to use Unix in this course, apart from the basics needed to get around on the lab machines and Terminal window. A good start is the Basic Unix Guide. However, you will probably find it quite useful to explore a bit further, especially if you intend to pursue further work in computer science. (CS 23 will definitely give you the chance to do that.)
Editor
You must edit programs using an editor that can handle plain text, and it is recommended to use one that knows something about programming language text. If you already know (or want to learn) emacs or vi, those are fine choices. Otherwise, you might want to install jEdit, which has a Haskell-specific editing mode (syntax highlighting, etc.). TextWrangler is also a fine choice for Macs. TextEdit (Mac) or Notepad (Windows) would be okay; Word might be painful. Other recommendations are welcome.
There is also an Eclipse plugin for Haskell. Some have not been able to use the Run command successfully; in that case, you can use Eclipse just as an editor. You might need to set preference (Window | Preferences... | Functional Programming > Haskell > Compiler > GHC compiler) to point to the executable. Feel free to use the Blackboard discussion forum to post about your experiences.
If you're editing a file in some separate editor, keep a separate GHCi window
open and enter :r in it whenever you'd like to reload the file. (Note that Emacs can link an editing window to a GHCi window.)
Note: make sure that your editor uses spaces for indendation rather than tabs. White space is important, and intermingling might cause compatibility issues in running your code on different machines (e.g., when it's being graded).