Topics: The goal of the course. Course Materials. Organization. Evaluation orders. Lazyness. Type classes.
Reading: Chapters 1-6, Chapters 8-10 (mostly repetition of what you have seen in Introduction to Functional Programming at Chalmers). Note that it is ~200 pages, so start reading now if you need an update!
- Applicative Functors are introduced in Real World Haskell Chapter 10, used more later in the same book Chapter 16.
- Haskell -- The Craft of Functional Programming: Chapter 12 on overloading, Chapter 16 on abstract types, and Chapter 17 on laziness.
- The Haskell School of Expression: Chapter 12 on type classes, Chapter 14 on streams, Section 18.1 on higher-order types.
Topics: Developing EDSL for describing shapes (e.g., squares, disc, etc.) and signals (to represent change of values over time). Shape animation. Deep vs. shallow embedding. Compositionality and abstraction.
Reading: DSL for the Uninitiated by Debasish Ghosh, Chapters 5 has a EDSL for pretty printing, Chapter 9 for file searching and Chapter 13 one for arithmetic expressions.
- Shape: extend the library with colored shapes
- Shape: define derived opertations
- Signal: define
mapSas a derived operation
Topics: Side-effects in pure functional programming. Monads. Monads for error handling, logging, and state. Monads and EDSL.
Reading: Chapters 14
- Chapter 15
- Monads for functional programming by Philip Wadler (the interpreter for arithmetic expressions is taken from this paper)
Topics: Functors. Applicative functors. Relation among functors, applicative functors, and monads. More example of monads (modeling IO).
Reading: Chapters 10 (Section Introducing Functors), FUNCTIONAL PEARL Applicative programming with effects (Page 1 - 6)
- Functors: Page 1 and 2 from "Functional Pearl: F for Functor" by R. Hinze, J. Hackett, and D. W. H. James
- Applicative functors: FUNCTIONAL PEARL Applicative programming with effects
- Blog on Functors are containers by B. Milewski. This blog post explains Functors, Applicative Functors, and Monads using the concept of containers.
- Intermediate embedding: Beauty in the Beast, A Functional Semantics for the Awkward Squad by W. Swierstra and T. Altenkirch Sections 1, 2 and 3.
Topics: Another application of monads, namely parsing. Refinement of implementation by program derivation. The focus here is on learning outcome "Spec: use specifictaion based development techniques".
Topics: we learn how to build complicated monads from simple building blocks. We cover the reader and state monad transformers. We apply them to write a interpreter for simple expressions.
Reading: Chapters 18 on Monad Transformers.
- Monad Transformers and Modular Interpreters by Sheng Liang, Paul Hudak, and Mark Jones.
Topics: 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 wanting more practice of the kind of problems typically included in the written exams.
Assistants on charge: TBA
Topics: This lecture looks into the consequences of the application order of
ExceptTmonad transformers in the interpreter. The lecture also shows how to create your own monad transformers -- for that, we show an implementation for
The reading material is the same as lecture 6 (see above).
Topics: In this lecture, we will see a use of monads for controlling effects in order to provide security for Haskell programs. We will focus on how to preserve sensitive data when executed by untrusted code, i.e., code written by someone else.
- Reading: Functional Pearl: Two can keep a secret, If one of them uses Haskell by A. Russo
Topics: In this lecture, we look at program verification by proving properties by induction. We also explore property-based testing as increasing the confidence on program correctness.
Reading: Chapter 11. Chapter 2 in the book The Fun of Programming.
Topics: We look how to do type-inference (type-checking) in DSL using GADTs. We describe existential and singleton types.
Topics: In the first part of the lecture, we will discuss associated types, kinds, data kinds, type families, and singleton types. In the second part, the lecture briefly look back at the learning outcomes and how they relate to the different parts of the course and what parts of the Real world Haskell book are covered. Then we go through a few examples chosen by popular vote by the participants.
Optional reading: Fun with Type Functions by O. Kiselyov, S. Peyton-Jones, and C. Shan
- Topics: First instance of the excercise session with exam questions.
- Topics: Second instance of the excercise session with exam questions.