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.
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.
This lecture introduces functors and monads by looking at how to design a simple library for input/output.
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".
We learn how to build complicated monads from simple building blocks.
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.
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.
We look at program verification: proving, specifying and testing correctness of programs.
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.
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.
We look at GADTs in more detail using an embedded DSL with two types to illustrate the different options.
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".
Type families and associated types in Haskell
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.
Second instance of the excercise session with exam questions.
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.)