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 2023/24
Credits 10
Assessment

Threshold assessment:

  • Timed in-semester assessment for threshold assessment. This assessment 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 & Dr Andrew Lewis-Smith
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.
Learning Outcomes 

By the end of the module a student will be able to:

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