Lecture 1 - Course Intro and Haskell Recap
Mon study week 1,
13.15 - 15.00 in ES52
In this lecture we do a quick recap of Haskell and talk about things
like referential transparency, laziness, and type classes. (We didn't get to the first simple example of a domain specific embedded language: Signal.)
Slides
[odp]
[pdf]
Code
Reading
- The World: Ch. 1-6, Ch. 8-10 (mostly repetition of intro. FP). Note that it is ~200 pages, so start reading now if you need an update!
- Optional: Applicative Functors are introduced in RWH10, used more later in RWH16
- Optional: The Craft: Chapter 12 on overloading, Ch. 16 on abstract types, Ch. 17 on laziness
- Optional: The School: Chapter 12 on type classes, Ch. 14 on streams, Section 18.1 on higher-order types
Related papers
Lecture 2 - Case study: Shapes
Thu study week 1,
10.00 - 11.45 in ES52
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]
Code
Reading
- The code above: read it or try to reproduce it.
- The World: Not quite the same terminology but, Ch. 5 has an EDSL for pretty printing, Ch. 9 one for file searching and Ch. 13 one for arithmetic expressions.
- The School: Chapter 2 (the inspiration for this lecture)
Exercises
- Extend the library to allow coloured shapes.
- Improve rendering resolution by sampling two pixels per character,
using "o" for the bottom pixel, "°" (degree
sign) for the top pixel, and "8" for when both pixels are
set.
Lecture 3 - Monads
Mon study week 2,
13.15 - 15.00 in ES52
This lecture introduces monads by looking at how to design a simple
library for input/output.
Code
Exercises
- Turn the snake game into a two player game.
- (More ambitious) Change the Program library to allow file I/O.
Reading
Related papers
Lecture 4 - Parsing
Thu study week 2,
10.00 - 11.45 in ES52
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
Code
Exercises
- Prove (some of) the laws stated in the paper (and in Parser0).
Reading
- Chapter 16 in RWH, until p. 390 or so; to get a feel for what parser combinators are.
- Parallel Parsing Processes by Koen Claessen.
Related papers
Lecture 5 - Monad transformers
Mon study week 3,
13.15 - 15.00 in ES52
We learn how to build complicated monads from simple building blocks.
Code
Exercises
- Implement the Program type from lecture 3 using monad transformers.
Reading
Related papers
Lecture 6 - Program verification (+ perhaps some more monad transformers)
Thu study week 3,
10.00 - 11.45 in ES52
We look at program verification: proving, specifying and testing correctness of programs. We may also look at the different stackings of the monad transformers in the
Interpreter4 example (from last lecture).
Slides
[pdf]
Code
Reading
Related papers
Lecture 7 - Type based modelling
Mon study week 5,
13.15 - 15.00 in ES52
We look at two recent extensions to Haskell: Type families and GADTs.
Code
Reading
Links
Related papers
Lecture 8 - Feldspar: guest lecture by Emil Axelsson
Thu study week 5,
10.00 - 11.45 in ES52
The slides below are from the 2012 version of the guest lecture and includes links to the current code. The abstract and the files linked are from 2011 (but still relevant).
(2011:) 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.
Slides
[html]
Links
Lecture 9 - More testing and coverage checking
Mon study week 6,
13.15 - 15.00 in ES52
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
Reading
Links
Lecture 10 - Advanced Functional Programming: An Agda Tutorial
Thu study week 6,
10.00 - 11.45 in ES52
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 11 - Programs and proofs in Agda: guest lecture by Nils Anders Danielsson
Mon study week 7,
13.15 - 15.00 in ES52
In dependently typed languages such as
Agda
one can both write programs and prove propositions which refer
to the programs. Building on Patrik's introduction to Agda from
last week I will implement a very simple theorem prover, and
formally prove that it is sound.
Code
Lecture 12 - Looking back
Thu study week 7,
10.00 - 11.45 in ES52
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
Code
Links