Informatics 1: Functional Programming


This is a course in the School of Informatics suitable for first-year undergraduate students (SCQF level 8). The course teaches the basics of functional programming using the language Haskell. The main goal is to acquaint the student with fundamental programming concepts such as recursion, abstraction, higher-order functions and data types, whilst emphasizing the practical use of such constructs. For further details see the course catalogue entry.

Informatics 1: Functional Programming is part of Informatics 1, the first-year programme for all undergraduate degrees in the School of Informatics. During semester 1, students should also be taking Informatics 1: Computation & Logic.

Lectures · Exercises · Tutorials · Advanced Tutorial · Labs · Videos · Forum
Books · Haskell · Atom · Exams · Feedback · Contact · Competition · Playlist

Slides and reading: Here are the annotated slides and code examples for each lecture. The pages in the two course textbooks that correspond to each lecture are indicated.

Week Subject Annotated slides, videos, code etc. Reading in Thompson / Lipovača
1. Introduction. Functions and lists. Monday slides / (Functional Programming is Black Magic, Land of Lisp music video)
Tuesday slides and code / more slides (just started) and more code
Sects. 1.2-11,1.14; 2.1,2.3-4,2.7; 3.2-3,3.7 /
pp. xv-7, 23-26
2. Guest Lecture: Set Theory
Just one FP lecture this week!
Monday slides / video failed! Sects. 5.5-6 /
pp. 7-13, 15-18
3. Comprehensions and recursion
Three FP lectures this week!
Monday slides (continuing from Friday) and code / video contains only audio!
Tuesday slides and code
Friday slides (continuing from Tuesday) and code / more slides
Sects. 3.1, 3.4-5; 4.1,4.4-5; 5.2; 6.2; 7.1-4 /
pp. 18-22, 35-42, 51-53
4. More fun with recursion. Higher-order functions.
Four FP lectures this week!
Monday slides and code
Tuesday slides and code / more slides (just started) and more code
Thursday slides (continuing from Tuesday) and code
Friday slides and code
Sects. 4.2,4.7; 7.5; 10.1-4; 11.1-4; 17.1-2,17.6 /
pp. 13-14, 42-45, 53-78, 80-85
5. Algebraic data types Monday slides and code
Tuesday slides and code (continuing from Monday) / more slides and more code / video contains no audio!
Sects 4.3; 5.1,5.3; 14.2-4 /
pp. 96-97, 109-113, 117-119, 121-122, 127-130
6. CLASS TEST on Monday
Expression trees
Tuesday slides and code (continuing from last Tuesday) Catch up with the reading!
7. Data representation Monday slides and code
Tuesday slides and code (continuing from Monday)
Sects. 15.1,15.2; 16.1,16.2,16.4,16.7,16.8 /
pp. 87-89, 104-107, 113-114, 135-137
8. Data abstraction.
Type classes
Monday slides and code
Tuesday slides and code
Sects. 13.1-5; 14.6 /
pp. 27-33,122-127,138-140,141-143
9. IO and monads Monday slides and code (continuing from Tuesday) / more slides and more code ("Haskell is useless" discussion)
Tuesday slides (continuing from Monday) and code
Sects. 8.3-5; 18.4-5 /
pp. 153-162, 272-278, 280-287, 292-296
10. No FP lectures this week! Catch up with the reading!
11. MOCK EXAM; Logic and programs Monday revision with live coding and the result
Tuesday slides
Sects. 9.1,9.2,9.5 /
these slides

Lectures: During Semester 1, 14:10–15:00 Mondays in George Square Lecture Theatre and 11:10–12:00 Tuesdays in David Hume Tower Lecture Theatre A.

except for the following swaps with Inf1-CL:

  • Week 2: Inf1-CL Tue 26 Sep (11:10–12:00, DHT LTA) instead of Inf1-FP
  • Week 3: Inf1-FP Fri 6 Oct (14:10–15:00, DHT LTA) instead of Inf1-CL
  • Week 4: Inf1-FP Thu 12 Oct (11:10–12:00, DHT LTA) and Fri 13 Oct (14:10–15:00, DHT LTA) instead of Inf1-CL
  • Week 10: Inf1-CL Mon 20 Nov (14:10–15:00, GSLT) and Tue 21 Nov (11:10–12:00, DHT LTA) and instead of Inf1-FP

You are very strongly advised to attend all lectures!

Link: Lecture locations.

Exercises: Tutorial exercises are published here at least a week before the corresponding tutorial. This work does not contribute towards your mark for the course but it is absolutely essential for your understanding of the material.

You can discuss your work on these exercises with other students, and ask questions on the course discussion forum. Or in the CompSoc chatroom. If you are having difficulties, drop in to the lab when a demonstrator is on duty. Or go to InfBase, the Informatics student help desk. Or attend an InfPALS session.

The CamlBack system, hosted at UCLA, can provide automated feedback on most of your tutorial exercises. It may help you to make better progress on the exercises before your tutorial but it is not a substitute for tutorial attendance. CamlBack is still under development and for some kinds of exercises the feedback will be more helpful than for others.

Link: CamlBack (select language Haskell and login as guest); notes on CamlBack.

Tutorials: These start in week 3 and take place each week until week 10, led by a tutor. If you are ill or otherwise unable to attend one week then email the tutor, and if possible attend another tutorial group in the same week.

Some tutorial groups are designated as "beginner friendly". Students who have no programming experience, or who are less confident, may wish to request allocation to these. There will be a beginner-friendly tutorial in each tutorial timeslot so timetabling conflicts should not prevent anybody from switching into, or out of, a beginner-friendly tutorial.

All tutorial groups will cover the same tutorial exercises but the beginner-friendly tutorials will proceed more carefully, as required by the students in the group, to make sure that all students are keeping up. The tutorials that are not labelled as beginner-friendly will tend to proceed more quickly.

Link: Tutorial group times, places and membership.

Students are expected to prepare for each tutorial, which includes completing the tutorial exercises and the reading.

You must attempt the work before the tutorial and bring with you a copy of the work you have done. Tutorials are mandatory, and the only way to learn is to do the work before the tutorial, not at the tutorial. Students who have not done the work in advance may be sent away. Programming is not a spectator sport!

Advanced Tutorial: There will be an extra drop-in tutorial starting in week 4 for students who would like to go beyond what will be covered in the normal tutorials. This tutorial is for you if you had no significant trouble solving the non-optional exercises and have made a serious attack on at least the first of the optional exercises. This is in addition to and separate from your normal tutorial session and tutorial exercises!

  • Friday 4:10-5:00pm, Appleton Tower 5.04

If you decide to attend, then you should bring your solutions to the tutorial exercise with you!

Labs: The workstations in AT 5.05 / 6.06 are reserved for Inf1-FP for a few hours every weekday. A lab demonstrator will be available at the times indicated to assist with the coursework.

Reserved for Inf1-FP Demonstrator available Location
Mondays 3:00–5:00pm 3:00–4:00pm AT 5.05
Tuesdays 2:00–4:00pm 2:00–3:00pm AT 6.06
Wednesdays 2:00–4:00pm 2:00–3:00pm AT 6.06
Thursdays 2:00–4:00pm 2:00–3:00pm AT 6.06
Fridays 3:00–5:00pm 3:00–4:00pm AT 5.05

Every student should attend the lab during week 2 in order to complete the lab exercise. Please go on the day indicated in the list below. If you have a conflict, just go on a different day in week 2 - no need to inform anybody. After week 2, the labs are run on a drop-in basis and you can go as often as you like.

Link: Lab assignments during week 2

Videos: Recordings of lectures are available via Learn. These recordings supplement lectures by allowing you to review the material presented and revise for the exam.

Links: Some video lectures from Microsoft on Haskell; Introduction to Functional Programming using Haskell: MOOC by Erik Meijer

Forum: Piazza provides an online forum for Inf1-FP in which you can post questions and answers on anything related to the course. The course lecturer, teaching assistant, tutors and demonstrators will also read and answer questions.

Links: Piazza course page; Piazza signup

Books: You will need one of the following textbooks:

Section/page references in both books that correspond roughly to the lectures are given above. Read at least these. It would be better to read more than these pages, to get the context and to understand related concepts. If you find a topic in one of the books hard to understand, try the other one.

All of the following books were also written for beginning students, and may provide a useful alternative perspective.


Atom and other editors

  • Writing programs in Haskell is easier if you use an editor that supports Haskell. Atom is the one that is recommended for this course; others are allowed, but on the exam you will only be able to use an editor that is already installed in DICE.
  • You will need to configure Atom to work with Haskell the first time you use it in DICE, following these instructions. You will need to do this at the beginning of the lab exercise in week 2 of the semester at latest.
  • If you want to use your own machine to do the exercises, please follow these instructions to install and configure Haskell and Atom. Now working for Windows too!!
  • If you can't get these things working on your own machine, one option is remote access to DICE, where everything works, using an ssh client or NX. Or install DICE on a virtual machine.
  • Or you can use Haskell with any text editor, but without the integration offered by Atom, as demonstrated in this short video.

Examinations: Assessment for Inf1-FP is done through two exams.

  • The class test is a 35-minute closed-book hand-written exam held on Monday of week 6 in place of the lecture. The class test contributes 10% towards the final mark for the course. Your marked paper will be returned to you in your week 7 tutorial.
    Link: class test (solutions)
  • There is a 2-hour open-book mock programming exam during week 11 as practice for the final exam; it does not contribute towards the final mark for the course.
    For this, you must attend for your allocated session and only that session. Link: mock exam (solutions)
  • The final exam is an 2-hour open-book programming exam held in December in the computer labs. The final exam contributes 90% towards the final mark for the course.
    Links: first sitting (template, solutions); second sitting (template, solutions); resit (template, solutions)

Links: past papers; instructions for programming exam; marks and grades.

Feedback will be provided on all of your work, with the exception of the final exam.

  • Tutorial exercises (formative): feedback is given orally on your attempts at tutorial exercises during your tutorial. On some exercises, automated feedback is available online from the CamlBack system.
  • Class test: this will be marked and returned to you in your tutorial in week 7. The numerical scores are accompanied by brief written feedback in cases where your solution is deficient.
  • Mock exam (formative): this will be marked by computer and the result returned to you during week 11 as an approximate indication of your performance. (The final exam will be marked by a human, using this automated testing as the starting point.)

Contact: The course lecturer is Don Sannella and the course teaching assistant is Stefan Fehrenbach. The best time to speak to Don is at the end of a lecture, or come to his weekly Inf1-FP office hour before the Tuesday lecture:

  • Tuesday 10-11am, Informatics Forum room 5.12

If contacting Don or Stefan by email please use your University address. Much better is to ask your question on Piazza since usually other students will have the same question. Questions sent by email will be re-posted on Piazza if the answer may be of interest to other students.

Programming Competition: Each year the course concludes with a programming competition, with an actual prize draw and first prize sponsored by software company Galois. The competition centers round the drawing of fractal-based images. This provides students with an excellent opportunity to show off the skills they have learned during the course, and to set loose their creativity in an unconstrained environment. Every year students have gone on to amaze the course organizers—and themselves—with ingenious and beautiful drawings and fractals, and this year is certainly not going to be different.

Links: Entries from 2017; 2016; 2015; 2014; 2013; 2012; 2011; 2010; 2009; 2008; 2007; 2006; 2005.

Home : Teaching : Courses : Inf1 

Informatics Forum, 10 Crichton Street, Edinburgh, EH8 9AB, Scotland, UK
Tel: +44 131 651 5661, Fax: +44 131 651 1426, E-mail:
Please contact our webadmin with any comments or corrections. Logging and Cookies
Unless explicitly stated otherwise, all material is copyright © The University of Edinburgh