Lectures

Work in progress

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

Lecture 1 - Course Intro and Haskell Recap

  Mon study week 1, 13.15 - 15.00 in TimeEdit

In this lecture we do a quick recap of Haskell and talk about things like referential transparency, laziness, type classes, and we take a brief look at a first simple example of a domain specific embedded language: Signal. The code from the lectures is slowly migrating from this homepage to a new AFP course page on github. You are very welcome to help with the migration.

Slides

[odp] [pdf]

Links

Reading

Related papers

Lecture 2 - EDSL case study: Shapes

  Thu study week 1, 10.00 - 11.45 in TimeEdit

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

Slides

[odp] [pdf]

Links

Reading

Exercises

Lecture 3 - Functors and Monads

  Mon study week 2, 13.15 - 15.00 in TimeEdit

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

Links

Exercises

Reading

Related papers

Lecture 4 - Monads and Parsing

  Thu study week 2, 10.00 - 11.45 in TimeEdit

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. The focus here is on learning outcome "Spec: use specifictaion based development techniques".

Slides

Koen's slides

Links

Exercises

Reading

Related papers

Lecture 5 - Parsing and Monad transformers

  Mon study week 3, 13.15 - 15.00 in TimeEdit

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

Links

Exercises

Reading

Related papers

Lecture 6 - Monad Transformers

  Thu study week 3, 10.00 - 11.45 in TimeEdit

This lecture was spent working through the StateT and ErrorT monad transformers in the interpreter example before the break and transforming looking at the Monad and Parser laws after the break. The code and the recommended reading material can be found above in lecture 5.

Lecture 7 - Looking forward!

  Mon study week 4, 13.15 - 15.00 in TimeEdit

In this lecture / excercise session we will work through old AFP exam questions in groups to identify important topics and practice collaborative problem solving and discussion. This is in response to student comments from last year wanting more practice of the kind of problems typically included in the written exams.

Lecture 8 - Program verification

  Thu study week 4, 10.00 - 11.45 in TimeEdit

We look at program verification: proving, specifying and testing correctness of programs.

Slides

[pdf]

Links

Reading

Related papers

Lecture 9 - Guest lecture by Emil Axelsson on EDSLs

  Mon study week 5, 13.15 - 15.00 in TimeEdit

Title: Designing EDSLs by combining Deep and Shallow Embeddings

I will present a design pattern for embedded DSLs (EDSLs) where a combination of deep and shallow embeddings is used in order to get most advantages from both approaches. This approach has been successfully used in Feldspar which is an EDSL for high-performance numeric computations. I will also introduce Feldspar and discuss some details of its implementation.

Links

Related papers

Lecture 10 - More testing and coverage checking

  Thu study week 5, 10.00 - 11.45 in TimeEdit

In this lecture we continue the work on QuickCheck, mainly looking at how to generate and shrink test data. We base the work on a compiler example and show how the program coverage tool hpc can be used to see what parts of a program has been tested.

Links

Reading

Lecture 11 - Type based modelling, part 1

  Mon study week 6, 13.15 - 15.00 in TimeEdit

We look at GADTs in more detail using an embedded DSL with two types to illustrate the different options.

Links

Reading

Lecture 12 - Advanced Functional Programming: An Agda Tutorial

  Thu study week 6, 10.00 - 11.45 in TimeEdit

In dependently typed languages such as Agda one can both write programs and proofs about the programs. Agda can be seen as a "next generation Haskell".

Links

Lecture 13 - Type based modelling, part 2

  Mon study week 7, 13.15 - 15.00 in TimeEdit

Type families and associated types in Haskell

Reading

Links

Related papers

Lecture 14 - Program derivation: Maximum segment sum (guest lecture)

  Thu study week 7, 10.00 - 11.45 in TimeEdit

One of the most important advantages of functional programming languages is that they allow us to construct programs from specifications by *calculation*. The expressivity of functional programming enables the formulation of specifications as (usually very inefficient) programs, which can then be optimized by equational reasoning using algebraic identities, in a process reminiscent of high-school mathematics. In this lecture, we will introduce a number of such algebraic identities, and use them in the presentation of a "canonical" example of program calculation: computing a linear-time solution to the maximum segment sum problem.

Micro-bio: Cezar Ionescu is currently a PostDoc on "Increasingly Correct Scientific Computing" in the FP group at Chalmers. Before that he worked for several years at the Potsdam Institute for Climate Impact Research where he applied AFP in the form of Haskell, C++, Agda and Idris to Computational Vulnarability Assessment, Scientific Computing and Economic Models.

Reading:

Lecture 15 - Looking forward, part 2

  Mon study week 8, 13.15 - 15.00 in TimeEdit

Second instance of the excercise session with exam questions.

Lecture 16 - Looking back

  Thu study week 8, 10.00 - 11.45 in TimeEdit

In this lecture we briefly 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. Then we go through a few examples chosen by popular vote by the participants. (2015: RWmonad, Newtype deriving, Continuation monad.)

Links

[Chalmers]
[GU]