Textbooks and Other Resources
Online Textbooks/Readings
There is no textbook to buy for this course. However, I will assign outside reading from the following sources, which are available online for free. The outside reading complements the lectures and is often able to go into more depth than we have time for in class.
I use the letters M, H, S, and P on the schedule to indicate reading assignments from these three sources.
M: Math Primer by Andrzej Wąsowski – A very clean and concise refresher on math that is relevant to this course.
H: Introduction to Haskell by Brent Yorgey – An excellent, concise introduction to Haskell. If you’re new to Haskell, don’t skip this reading!
S: Denotational Semantics: A Methodology for Language Development by David Schmidt – A freely available book on denotational semantics, domain theory, and language design. This reading is a bit heavier than the others.
P: Practical Foundations for Programming Languages by Robert Harper – A satisfyingly rigorous treatment of programming languages. Uses some non-standard terminology, which I’ll clarify in class. The chapters I’ll assign are all available in the abbreviated online edition.
Discrete Math
Programming languages is one of the more theoretical disciplines within computer science. As such, this class requires a fluency in discrete mathematics. The most important topics for this class will be (sorted by importance):
- Set theory – Essential!
- Formal languages – Essential!
- Proof methods – The most important “sophisticated” proof technique is structural induction.
- First-order logic
Fluency with a few mathematical notations is also important:
- Context-free grammars in BNF – Used for defining syntax.
- Inference rules – Used to define operational semantics, type systems, and many other kinds of relations on syntactic terms.
Haskell
Throughout the course, we will use the functional programming language Haskell. In particular, we will use Haskell as a metalanguage for describing programming language concepts. It is therefore absolutely essential that you develop your Haskell programming skills!
I recommend that you consult multiple Haskell tutorials/manuals in addition the assigned reading. Even better is if you’re able to find a way to write Haskell programs outside of class, for example, to help you solve problems in your other classes or in your research.
Installing GHC
The Haskell compiler we’ll be using is GHC. You’ll also need a tool called cabal
for installing Haskell packages (see below). The easiest way to install GHC and cabal varies by platform.
On Windows, install Haskell Platform, which includes both GHC and cabal.
On Mac, use Homebrew. First install Homebrew itself, if you don’t already have it on your system. Then install GHC and cabal with the following commands:
> brew install ghc
> brew install cabal-install
On Linux, use whatever package manager is standard on your distribution (e.g. apt
on Ubuntu, dnf
on Fedora). The cabal package you want is probably called cabal-install
. Make sure that the GHC version installed is at least 8.4.
An alternative way to manage your GHC and cabal installations on any system is using Stack. This is what I do since I use Stack to manage the dependencies for all of my Haskell projects.
Haskell Packages
Hackage is the central package archive for the Haskell community. It contains lots of useful libraries, many of which may be useful if you go on to use Haskell beyond this class.
The easiest way to install packages from Hackage is using the cabal
tool, which you hopefully installed above. First run the following command to download the list of packages on Hackage.
cabal update
Then you can install new packages by running the following command.
cabal install [package-name]
If you use Haskell for projects outside of class, it’s worth checking out Stack, which can be used to locally and automatically manage the packages your project depends on. This is useful because it makes it much easier for others to run your project, and because it helps avoid conflicts between incompatible packages that can arise when all packages are installed globally.
Installing Doctest
Doctest is a useful tool for running examples written in the comments of a Haskell file as unit tests. We’ll use this in some Homework assignments.
After you’ve installed GHC and cabal, you can install doctest
with the following commands:
cabal update
cabal install doctest
Important: You will also need to add the directory that cabal installs its binaries into to your $PATH
. Here are my best guesses as to where that will be:
- Linux:
~/.cabal/bin
- Mac:
~/.cabal/bin
or~/Library/Haskell/bin
- Windows:
C:\Program Files\Haskell\bin
Other Haskell Tutorials and Reference Manuals
Haskell: The Confusing Parts – An FAQ especially for folks coming to Haskell from a C/Java background, which I guess will be many of the people in this class.
A Gentle Introduction to Haskell – Famous for being not-so-gentle, but a really great and concise resource for refining your understanding of Haskell, once you get the basics down.
Real World Haskell – O’Reilly’s book-length introduction to Haskell focusing on practical applications. Available for free online.
Haskell Wikibook – An easy-to-navigate and thorough resource. Check out the chapter on the denotational semantics of Haskell programs, which is especially relevant for this class.
Haskell Style
The Haskell wiki contains several pages concerned with style. Start with the general programming guidelines. Answers to more specific questions can be found by perusing the Style category listing.
For low-level questions of layout, I like the pragmatic advice in Johan Tibell’s Haskell style guide.