Programming I

Module aims

This course aims to introduce some of the fundamentals of programming for beginners using a strongly-typed functional programming language (Haskell) , of which most students will have little or no experience. The emphasis is on writing succinct and elegant code, without being bogged down in the syntax and semantics of a conventional procedural or object-oriented language. The course is taught using a problem-solving approach with students being encouraged to use the various language features to solve well-specified problems and to explore some fundamental algorithms and data structures in computer science.

Learning outcomes

Knowledge and Understanding

  • To recall the syntax and semantics of the Haskell language
  • To explain the key features of functional programming languages: recursion, lazy evaluation, lists, higher-order functions
  • To explain specific features of the Haskell language: partial application, data types, type classes and overloading, basic monadic I/O

Intellectual Skills

  • To design and implement functions for solving well-specified problems
  • To define and implement data types for solving a given problem that are both efficient and well-suited to the problem
  • To use the full range of Haskell’s language features to ensure succinct and elegant solutions to problems
  • To compare different solutions to the same problem using basic complexity arguments
  • To develop solutions for more open-ended problems where there is little or no guidance on design

Practical Skills

  • To use the available Haskell implementations (e.g. GHC, GHCi, Hugs) to implement and execute solutions to given problems
  • To learn about and use any available supporting tools for program development, analysis, debugging etc.
  • To use the supplied tools and frameworks for program testing and submission

Module syllabus

1. Basics

  •         Expressions
  •         Built-in types
  •         Sequences
  •         List comprehensions

2. Functions

  •         Function types
  •         Rules, guards and where clauses
  •         Recursion
  •         Lazy evaluation
  •         Scope

3. List processing

  •         Constructors
  •         Polymorhism
  •         Functions over lists
  •         Examples from the Haskell prelude

4. Higher-order functions

  •         Higher-order functions over lists
  •         Currying and partial application

5. User-defined data types

  •     Polymorphic data types
  •     Recursive data types
  •     Trees

6. Type classes

  •     Overloading
  •     Class definitions and instances
  •     Inheritance

7. Introduction to I/O

  •     I/O actions
  •     Sequencing
  •     Monads
  •     ‘do’ notation


None, other than basic pre-university mathematics.

Teaching methods

Weekly lectures, catch-up tutorials, small-group tutorials, timetabled laboratory sessions, supervised catch-up laboratory sessions.

There is also a series of optional lectures on Advanced Programming in Haskell.


There is an unassessed practice test (formative assessment only), a 'driving test' (20%) and a final 'main test' (80%), all of which are taken in the laboratory under exam conditions using the Lexis test administration system.

Students can also undertake independent self assessment through unassessed exercises, for which model answers are made available.

Reading list


Module leaders

Dr Anthony Field