INFOFP 2024-2025 Functional Programming

This course introduces functional programming through the programming language Haskell. In contrast with the language C# – introduced in Imperatief/Game/Mobiel programmeren – which is based on statements, organized in methods and classes, functional programming is based entirely on expressions and functions. This shifts the focus from how a program operates to what it does.

Concrete topics treated in this course include higher-order functions, parametric and ad-hoc polymorphism (also known as generics and overloading in other programming languages), algebraic data types and pattern matching. These ideas appear not only in Haskell, but in other modern languages such as Scala, Swift or Kotlin. An important part of the course is devoted to reasoning about programs, either by equations or by induction.

The language Haskell imposes a strong separation between pure computations and those with side-effects, such as input and output. Monads are introduced to model the idea of sequential computation in a functional language. Similar abstractions such as functors are also part of the contents of this course.

Lecturers

Matthijs Vákár and Frank Staals

For any enquiry about the course, please mention [INFOFP] in the title.

Teaching Objectives

By the end of the course you will be able to

Announcements

2023-08-16, GHC Installation Instructions

To successfully complete the course you will need

GHC
A Haskell compiler, and
cabal
A tool to install Haskell libraries (in particular the ‘gloss’ library you will need for the final project in the course).

Installing GHC is, or at least was, often somewhat troublesome. Fortunately, the situation has improved a bit with respect to earlier years. We currently recommend that you install GHC using a tool called ‘ghcup’. In particular, you can follow these instructions to install ‘ghc’ and ‘cabal’.

If you want as you type error checking and intelligent completions in your editor, you may also want to install HLS, the Haskell Language server. You can also do so using ghcup.

Schedule

There are weekly lectures (2 × 2 hour), instructions (1 × 2 hour) and practicals (1 × 2 hour). Attendance is not strictly mandatory (albeit strongly recommended).

You are expected to work on your own in addition to these hours!

The lectures, instructions, and practicals typically take place at the Utrecht Science Park (‘de Uithof’). In particular, the weekly schedule is:

Literature

We will use the book “Programming in Haskell” by Graham Hutton. Each lecture typically corresponds to (a part of) a chapter from this book. You are expected to read this part of the book on your own.

There is plenty of additional reading material available on the internet. In particularly, you may find the following material useful:

Exams

There will be a midterm and a final exam. The exams are closed book, and focus on “pen-and-paper” type programming questions.

You can find the exams of several previous years here.

Assignments

There are two kinds of mandatory assignments:

In addition to those mandatory assignments, there is an optional assignment to be made in groups to get some extra points in the grade. The assignment involves exploring and presenting some language extension or Haskell library.

Grading

The final grade depends on the two exams and the assignments.

The final grade is computed as F = min( 0.5 × T + 0.5 × P + 0.05 × O, 10 ).

The final result of the course is: