Informatics 1: Functional Programming


This is a taught 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 at the same time emphasizing the practical use of such constructs by applying them within a graphical environment. 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 · Revision Tutorials · Advanced Tutorials · Labs
Videos · Books · Haskell · Exams · Forum · Contact · Feedback · Competition

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

Week Subject Slides (code, etc.) Reading in Thompson / Lipovača
1. Introduction. Functions. Mon-Tue slides (Mon video, Tue video, Functional Programming is Black Magic, Land of Lisp music video) Sects. 1.2-11,1.14; 2.1,2.3-4,2.7; 3.2-3,3.7 /
pp. xv-7; 23-26
2. Lists, comprehensions, recursion
Three FP lectures this week!
Mon slides (video, code), Thu slides (video missing, code), Fri slides (video missing) Sects. 3.4; 4.4-5; 5.2,5.5-6; 6.2; 7.1-4 /
pp. 7-13,15-22,35-42,51-53
3. More fun with recursion
Just one FP lecture this week
Mon slides (video, code) Sects. 3.1,3.5; 4.1-2,4.7; 7.5; 17.1-2,17.6 /
pp. 13-14,42-45,53-58
4. Map, filter, fold Thu slides (video, code), Fri slides (video, code) Sects. 10.1-4; 11.1-4 /
pp. 59-78,80-85
5. Lambda, sections, algebraic data types Mon slides (video), Tue/Fri slides with notes (Tue video, Fri video, code) Sects. 4.3; 5.1,5.3 /
pp. 109-113,127-130
6. Expression trees
CLASS TEST on Tuesday
Mon slides with notes (video, code) Sects. 14.2-4 /
pp. 96-97,117-119,121-122,130-135
7. Abstract types Mon/Tue slides with notes (code) 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. Type classes Mon slides with notes (code), Thu slides (video, code) Sects. 13.1-5; 14.6 /
pp. 27-33,122-127,138-140,141-143
9. IO and monads Mon slides (code), Tue slides (video, "Haskell is useless" discussion, code) Sects. 8.3-5; 18.4-5 /
pp. 153-162, 272-278, 280-287, 292-296
10. MOCK EXAM; IO and monads
Just one FP lecture this week
Mon slides (video, code) Catch up on your reading!
11. Scala (guest lecture); Logic and programs; Programming competition presentation Tue slides Sects. 9.1,9.2,9.5 /
these slides

Mock Exam

Date:Monday 23 – Friday 27 November 2015
Time/place: Check your allocation

You must attend for your allocated session and only that session. Any request to change your allocation for a specified good reason should be sent to Gregor Hall in the ITO.

Lectures: 14.10–15.00 Mondays and 11.10–12.00 Tuesdays in Appleton Tower, Lecture Theatre 4 during Semester 1, except for the following swaps with Inf1-CL:

  • Inf1-FP Tue 29 Sep ↔ Inf1-CL Thu 1 Oct (11.10–12.00, AT LT5)
  • Inf1-FP Tue 6 Oct ↔ Inf1-CL Fri 2 Oct (14.10–15.00, AT LT5)
  • Inf1-FP Mon 12 Oct / Tue 13 Oct ↔ Inf1-CL Thu 15 Oct (11.10–12.00, AT LT5) / Fri 16 Oct (14.10–15.00, AT LT5)
  • Inf1-FP Tue 10 Nov ↔ Inf1-CL Thu 12 Oct (11.10–12.00, AT LT5)
  • Inf1-FP Tue 24 Nov ↔ Inf1-CL Fri 23 Oct (14.10–15.00, AT LT5)

(To keep up with these swaps it is probably easiest to just refer to the list of lectures here under Course Activities.)

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. 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.

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 the end of semester, except for week 10. If you are ill or otherwise unable to attend one week then email your tutor, and if possible attend another tutorial group in the same week.

Link: Tutorial group times, places and membership.

If you wish to move to a different tutorial group, please follow these instructions. Or visit the ITO on level 1 of Forrest Hill.

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!

Revision Tutorials: There will be extra drop-in tutorials starting in week 4 for students who find that they require extra help, and continuing up until the week before the exam. This is in addition to and separate from your normal tutorial session and tutorial exercises!

  • Wednesday 2:10-3:00pm, Forrest Hill 1.B32
  • Extra revision tutorial: Wednesday 9 December, 2:10-3:00pm, Forrest Hill 1.B32

If you decide to attend, then to get the most out of the session you should attempt the exercises before the tutorial and bring your solutions with you!

Advanced Tutorials: There will also be extra drop-in tutorials 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. Again, this is in addition to and separate from your normal tutorial session and tutorial exercises!

  • Friday 4:10-5:00pm, Forrest Hill 1.B31

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

Labs: Most of the workstations in Forrest Hill room 1.B30 are reserved for Inf1-FP for a few hours every weekday. Follow signs from the Forrest Hill stairs to "Drill Hall Computers" and sit in the block of desks that is straight ahead as you come into the room. A lab demonstrator will be available at the times indicated to assist with the coursework.

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

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 - scroll halfway down, until you reach "LABORATORY COMPULSORY GROUP 1" etc.

Videos: Recordings of lectures are available online at the links below. Please note that these recordings supplement lectures by allowing you to review the material presented and revise for the exam. They are not intended as a substitute for attending and participating in the lectures themselves.

Links: Video recordings; some video lectures from Microsoft on Haskell.

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.


  • If you are using your own machine, we recommend that you download and install the "Haskell Platform" from here and Emacs from here. Instructions about how to install Haskell mode in Emacs are here; the haskell-setup.txt file referred to is here. Haskell mode is already installed in Emacs on DICE but it is not currently installed in Emacs on the open access Windows machines.
  • 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. Finally, the university's Information Services department run free Mobile Device Clinics that offer help installing software on Windows and Mac OS X laptops.
  • has everything you could possibly want to know about Haskell, including the definition of the language, a list of books on the subject, links to conferences/workshops, various libraries, and more! Have a look at "A Gentle Introduction to Haskell".
  • Documentation of Haskell's predefined functions is in HackageDB, which also includes documentation on the rest of the Haskell library. The library can conveniently be searched using Hoogle.
  • Some handy functions that will be used in the tutorial exercises are listed here.

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

  • The class test is a 35-minute closed-book hand-written exam held on Tuesday 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 10 as practice for the final exam; it does not contribute towards the final mark for the course.
  • The final exam is an 2-hour open-book programming exam held on Tuesday 15 December in the computer labs in Forrest Hill. It is held in two sittings (9:30–11:30 and 14:30–16:30) and each student will be allocated one sitting by the ITO. You must attend your allocated sitting and only that sitting. The final exam contributes 90% towards the final mark for the course.

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

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 page for Inf1-FP; Piazza signup for Inf1-FP

Contact: The course lecturer is Don Sannella and the course teaching assistant is Karoliina Lehtinen. 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 Karoliina 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.

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.)

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.

E-mail your entry to Karoliina Lehtinen by midnight Wednesday 25 November 2015. (Disambiguation: The deadline is 1 minute before 00:01 on Thursday.) The winning entries will be announced at the beginning of the lecture on Tuesday 1 December 2015.

Links: Entries from 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