The University of Sheffield
Department of Computer Science

COM2108 Functional Programming

Summary This module introduces the principles of functional programming, using the Haskell programming language. It introduces types and classes, function definitions, list comprehension, recursive and higher order functions, eager and lazy evaluation, and basic data types.
Session Autumn 2021/22
Credits 10
Assessment

Threshold assessment:

  • Timed in-semester assessments for threshold assessment. These assessments will assess the learning outcomes to a threshold (pass) level only.

Grading assessment:

  • An assignment, including a programming component and written report. This assignment will assess the module learning outcomes beyond the bare pass level.
Lecturer(s) Dr Emma Norling
Resources
Aims

This unit aims to:

  • Present the principles of functional programming;
  • Enhance student’s knowledge of recursion and recursive function design;
  • Introduce concepts of pattern matching, lazy evaluation, partial application and higher order functions;
  • Outline higher-level topics in functional programming.
Objectives

By the end of the unit, a candidate will be able to:

  • explain the functional model of programming;
  • design and implement recursive functions using base and recursive cases;
  • demonstrate the use of partial and higher-order function application techniques;
  • design and implement solutions to real world problems using a functional paradigm.
Content

Basic functional programming and Haskell

  • Introduction to functional programming: functions, parameters, arguments, binding, environments and types;
  • Built-in types such as Integers, Reals and Lists;
  • Recursive function definitions: tail recursion and general recursion;
  • Function definition using multiple equations, patterns and guards;
  • Anonymous functions.

Further topics in functional programming:

  • Higher order functions;
  • Function composition;
  • User-defined data structures and type classes;
  • Algebraic data types

Advanced functional programming:

  • Top-down design and bottom-up implementation of functional programs;
  • Partial function application
  • Lazy Programming
  • The IO Monad
  • Design Patterns in functional programming
Restrictions Not available to students who have taken COM2001.
Teaching Method
  • Teaching will consist of approximately 20 hours of lecture material, supported by approximately 20 hours of practical classes.
Feedback Feedback is available on a weekly basis in scheduled practical classes. Feedback for in-class tests and programming assignments will be available via Blackboard.
Recommended Reading
  • Graham Hutton, "Programming in Haskell", Cambridge University Press, Second Edition, 2016.
  • Bryan O'Sullivan, Don Stewart and John Goerzen, "Real World Haskell", O'Reilly Media, 2008. Free online access to full text at http://book.realworldhaskell.org/
  • Simon Thompson, "Haskell: The Craft of Functional Programming", (Second Edition). Addison- Wesley, 1999.