CSE301: Functional Programming

Course description

In this course, we will study functional programming, and will learn how to take advantage of the features of modern typed functional programming languages. We will study in depth the notions of algebraic data types, higher-order functions, polymorphism, and side-effects. The practice sessions will be done in Haskell, but concepts presented in the course can be applied in many other languages such as OCaml, SML or Python.

Prerequisites: CSE201 and CSE203

General information

Fall 2023 Schedule:

Instructors:

Labs Lectures Project


Assessment

Your grade is computed based on:

where regularly asking questions during labs or lectures or on the Moodle Q & A forum will earn you full credit for participation. Attendance at labs is mandatory except for medical reasons or with prior permission. Attendance at lectures is strongly encouraged.

The formative assignments are meant purely for learning, and you will receive full credit so long as you make a reasonable attempt at completing them. Collaboration on formative assignments is also allowed and encouraged, although you should understand everything that you submit and acknowledge your collaborators (as well as any online forums or tools such as ChatGPT).

The in-class exam will be during week 6, and will cover a selection of the topics discussed in lectures and labs during weeks 1-5. Note that it will be a paper exam, without access to computers. (More information and sample questions will be provided closer to the date of the exam.)

The final project will be introduced during the last week of the course, due after the holiday break. Working in groups is possible for the final project with prior approval. Each project group will give a brief presentation, scheduled within the first two weeks of November.

Getting up and running with Haskell

The Glasgow Haskell Compiler (GHC) is an open source compiler and interpreter for Haskell. It includes the following programs that may be run from the command line:

Documentation on all of these programs and more is available at the GHC User’s Guide.

GHC 9.6.2 is already installed on the lab machines. You can verify this by running

$ ghc --version

in a terminal. We will be using the interpreter ghci more often than the compiler ghc. You can run it as follows:

$ ghci
GHCi, version 9.6.2: https://www.haskell.org/ghc/  :? for help
Prelude> 

To install GHC for yourself (e.g., on your laptop), the easiest approach may be to use ghcup. In addition to installing GHC, ghcup will also install the Cabal library manager and build system, and optionally Stack, which is a newer tool for developing Haskell projects.

In any case, make sure that you install a stable release of GHC, version 9.6.2 or higher.

Lecture notes, textbooks, and online resources

Whereas labs are designed to provide more practical programming experience, lectures cover the theoretical foundations of functional programming. I will attempt to provide lecture notes reasonably in advance of (or eventually after) the lectures, with the understanding that they may not be an exact transcript of what happened during lecture, and that I reserve the right to modify them at any point to incorporate corrections/improvements/additions. I will also post a copy of any slides that I use, eventually incorporating bug fixes. Of course you are welcome to take your own notes during lectures!

Although there is no course textbook, the following books may be helpful to complement the lectures:

Copies of both books are available on reserve at the Bibliothèque Centrale. (The book webpage for Programming in Haskell also provides links to slides and videos based on Hutton’s Functional Programming course at Nottingham University.)

There are also several good books on Haskell that are freely available online:

You may also find these links useful:

Finally, if you enjoy this course and want to go further, you may be interested in the course INF551 taught by Samuel Mimram, and the associated book.


Labs


Lectures

(The schedule of topics is provisional and subject to change.)


Project

This year’s project is about writing a text adventure game on and around trees.