Numbers are values. Strings are values. Booleans are values. In Functional Programming, functions simply are simply values as well. This view on programming leads to an elegant and expressive programming paradigm which we will investigate in this course. During the course, we will use the programming language Haskell. The majority of the concepts we will consider applies in other (functional) languages as well.
Participants are not expected to be fluent in Haskell from the beginning. We will spend the first three weeks of the semester on a Haskell Ramp-Up. Things will progress rather fast, though. The majority of the semester will be used for the good stuff: intermediate and advanced topics, of which there are plenty.
This course will provide an introduction to Haskell (first half) and then touch on intermediate-level topics. We will discuss (topics in parentheses will be addressed if we'll find the time):
Discussion around this course and Haskell in general are encouraged in the forum. ⚠️ If you want to participate in the exercises, you absolutely need to register in the forum, as we use it to create/administer student accounts in this course. Thus, please stop by regularly, have a look, and say "hi".
We will provide weekly exercise sheets (hand-out: Friday, hand-in by Thursday night).
You are admitted to the final exam if you score at least ⅔ of the overall exercise points.
Scoring well in the exercises leads to bonus points in the final exam.
The course will use the de-facto standard Haskell compiler GHC and its interactive variant (also known as read-eval-print loop or REPL) GHCi. We strongly suggest you download and install the so-called Haskell Platform which includes both GHC and GHCi (and more). Available for virtually all operating systems, including Windows, Linux, macOS. Make sure to install the recent version.
The following introductory books and courses on Haskell are recommend reading — some of these are available online:
We will refer to additional material for the individual topics during the semester.
The Hello, World! of Haskell.
Prime number test. Efficient thanks to lazy evaluation of
Demonstrates the definition of user-defined operator
Compute the factorial n! of natural number n. Defines two equivalent variants of the function that demonstrate the use of conditional expressions (
Two equivalent formulations of an efficient power computation.
Demonstrates the use of guards, local definitions (
A demonstration of type synonyms (
A reimplementation of the
A reimplementation of the built-in
An implementation of MergeSort in Haskell. Builds on the
Definition of and functions over sum data types (
Definition and functions over product type
Defines algebraic data type
Defines abstract syntax trees for simple arithmetic expressions
Interpreter as well as compiler and VM are related:
(An equivalent function is already built into Haskell's Prelude: