Please read our student and staff community guidance on COVID-19
Skip to main content Skip to navigation

CS141 Functional Programming

In CS118 you have learnt to write programs in the eager, object-oriented style using Java. However, Java is just one of many programming languages and object-oriented programming is just one of many programming paradigms. You may think of programming languages as tools: a hammer is different from a screwdriver and both serve different purposes which they are good at. Programming languages are the same: different languages exist for different purposes and it is easier or harder to accomplish certain tasks in one or the other. As a Computer Scientist, you need to know which tools are at your disposal and when to use them.

In this module, you will learn about the functional programming paradigm. For this, we will use Haskell, which is a lazy, purely functional programming language. Writing programs in Haskell is very different than writing programs in Java and over the course of this module you will learn how to do that. In turn, this adds a powerful tool to your programming arsenal, you will gain a much deeper understanding of programming, and skills from this module can be applied in other languages, functional or not. In other words, you will become a better programmer!

The module is assessed by two pieces of coursework worth 15% and 25% respectively as well as an exam worth 60% of the module. There are weekly lab sessions which support the lecture content with exercises (these are not assessed).

The first coursework is about implementing the board game Mastermind in Haskell along with an AI which can beat the game in no more than 5 guesses! We make extensive use of test-driven development so that you get a good idea of how complete and correct your solution is before submitting it. See the screenshot at the bottom of this page for what that looks like when you have completed the second coursework!

The second coursework is about implementing a clone of the Scratch environment. The GUI for this runs in a web browser while all of the logic that runs programs written in this environment is implemented in a server-side Haskell program. We again make use of test-driven development so that you can see exactly how well you are progressing!

15 CATS (7.5 ECTS)
Term 2

Michael Gale


Online material