Lectures

Work in progress

The lectures below are step by step migrated from the previous course instance (labelled "2010:" below) to the current 2011 instance.

Lecture 1 - Course Intro and Haskell Recap

  Mon study week 1, 13.15 - 15.00 in ED

In this lecture we do a quick recap of Haskell and talk about things like referential transparency, laziness, and type classes. We also look at a first simple example of a domain specific embedded language.

Slides

[odp] [pdf]

Code

Signal   [code]

Reading

Related papers

Lecture 2 - Case study: Shapes

  Thu study week 1, 10.00 - 11.45 in EF

In this lecture we develop a domain specific embedded language for describing shapes. We talk about the distinction between a deep and a shallow embedding, about compositionality and abstraction.

Slides

[odp] [pdf]

Code

Matrix   [code]
Signal   [code]
Signal.Shallow   [code]
Signal.Deep   [code]
Signal.Example   [code]
Shape   [code]
Shape.Shallow   [code]
Shape.Deep   [code]
ANSI   [code]
Render   [code]
Animate   [code]
Example   [code]

Reading

Exercises

Lecture 3 - Monads

  Mon study week 2, 13.15 - 15.00 in ED

This lecture introduces monads by looking at how to design a simple library for input/output.

Code

Program.Shallow   [code]
Program.Deep1   [code]
Program.Deep2   [code]
Program   [code]
Game   [code]
Coord   [code]
Snake   [code]

Exercises

Reading

Related papers

Lecture 4 - Parsing

  Thu study week 2, 10.00 - 11.45 in EF

In this lecture we look at another application of monads, namely parsing. We also see how to refine the implementation of a library. Starting from a naive translation from syntax to semantics, we derive intermediate representations for an efficient implementation.

Slides

Koen's slides

Code

Parsers   [code]
Parser0   [code]
Parser1   [code]
Parser2   [code]
Parser3   [code]
Example   [code]

Exercises

Reading

Related papers

Lecture 5 - Monad transformers

  Mon study week 3, 13.15 - 15.00 in ED

We learn how to build complicated monads from simple building blocks.

Code

MonadT_API_summary   [code]
Interpreter0   [code]
Interpreter1   [code]
Interpreter2   [code]
Interpreter3   [code]
Interpreter4   [code]
Examples   [code]
Parser   [code]

Exercises

Reading

Related papers

Lecture 6 - More monad transformers + some program verification

  Thu study week 3, 10.00 - 11.45 in EF

We look at the different stackings of the monad transformers in the Interpreter4 example (from last lecture). And we start looking at program verification: proving, specifying and testing correctness of programs.

Slides

[pdf]

Code

InsertionSort   [code]

Reading

Related papers

Lecture 7 - More testing and coverage checking

  Mon study week 4, 13.15 - 15.00 in ED

In this lecture we continue the work on QuickCheck, mainly looking at how to generate test data. We also check out how the program coverage tool hpc can be used to see what parts of a program has been tested.

Code

ParserTests   [code]

Reading

Links

Lecture 8 - Type based modelling

  Thu study week 4, 10.00 - 11.45 in EF

We look at two recent extensions to Haskell: Type families and GADTs.

Code

Expr   [code]
Typed   [code]
Parser   [code]
Array   [code]
Array/Properties   [code]
Array/Example   [code]
Array/ShowInstances   [code]
Array/EqInstances   [code]

Reading

Related papers

Lecture 9 - Feldspar: guest lecture by Emil Axelsson

  Mon study week 5, 13.15 - 15.00 in ED

Digital signal processing (DSP) appears in a wide range of applications, ranging from biomedicine and audio processing to radio base stations. In many of those applications, speed is a major concern, which means that a great deal of signal processing code is written in very low-level machine-oriented languages. Such low-level code is hard to develop and maintain, and it is also difficult to move between different hardware platforms. We are developing a domain-specific language for DSP that aims to allow signal processing code to be developed at a higher level of abstraction. The language, Feldspar, is embedded in Haskell, and it offers a high-level programming interface similar to ordinary list processing in Haskell. In this lecture, I will mostly focus on Feldspar's implementation, which uses an interesting combination of a deep and shallow embedding. I will also show some basic examples.

Code

Frontend   [code]
Lambda   [code]
Examples/Feldspar   [code]
Examples/Lang   [code]
Examples/Vector   [code]

Slides

[pdf]

Links

Lecture 10 - Concurrency and Parallelism

  Thu study week 5, 10.00 - 11.45 in EF

In this lecture we look at concurrent and parallel programming in Haskell. Topics include: Haskell "sparks", threads and Software Transactional Memory (STM).

Slides

[pdf] [odp]

Code

MutVar   [code]

Reading

Links

Lecture 11 - Programs and proofs in Agda: guest lecture by Nils Anders Danielsson

  Mon study week 6, 13.15 - 15.00 in ED

In dependently typed languages such as Agda one can both write programs and prove propositions which refer to the programs. I will introduce Agda by implementing a very simple theorem prover, and formally prove that it is sound.

Code

Prelude   [code]
Proof-by-reflection   [code]

Links

Lecture 12 - Looking back

  Mon study week 8, 13.15 - 15.00 in ED

In this lecture we look back at the learning outcomes and how they relate to the different parts of the course and what parts of the RWH book are covered. Some other relevant topics did not fit but I include references and code below.

Code

MaybeT/Deep   [code]
MaybeT/Shallow   [code]

Code

FFI   [code]
foreign.c
Cont   [code]
Memo   [code]
Generics   [code]
NoGenerics   [code]

Links