Advanced Haskell

2 days

A course for developers who have made their first steps in Haskell and written a few programs, and who now want to unleash the full power of the language.

This course looks behind the scenes of a Haskell programmer and discusses how Haskell is implemented and the compiler works, thereby making it easier to understand the memory requirements and performance of programs. Furthermore, the course introduces libraries for parallelism and concurrency, discusses more advanced patterns for structuring Haskell code such as applicative functors and monad transformers, and explains how more advanced type system features can be employed to capture complex invariants of your code, making programs correct by construction.

This course is designed such that Fast Track to Haskell covers all its prerequisites.


Day 1

Datatype Internals and Data Structures

  • Persistent vs. ephemeral data structures
  • How Haskell data is represented in memory
  • Tools to visualize the memory representation
  • Lists
  • Finite maps
  • Implementation of finite maps
  • Sequences
  • Arrays
  • Unboxed types
  • Mutable arrays
  • Strings, ByteStrings and Text

Lazy Evaluation and Profiling

  • Evaluation by reduction
  • Evaluation strategies
  • Strictness
  • Space leaks
  • Garbage collection
  • Examples of space-inefficient programs
  • GHC’s Core language
  • How to control strictness
  • The NFData class

Parallelism and Concurrency (if time permits)

  • Parallelism vs. Concurrency
  • Overview of approaches
  • Evaluation strategies
  • Pitfalls in paralleliing programs
  • Sparks
  • Debugging parallel programs using ThreadScope
  • The Par monad
  • Basic concurrency primitives
  • Lightweight Haskell threads
  • MVars for shared data
  • Network programming basics
  • Software Transactional Memory

Day 2

Monads and More

  • Recap: the Monad interface
  • Monad laws
  • The ST monad for local mutable state
  • Combining monadic effects
  • Multi-parameter type classes
  • Applicative functors
  • WriterT, ReaderT, ErrorT, StateT
  • Functional dependencies
  • Type families
  • Monoids

Type-level Programming

  • GADTs (Generalized Algebraic Datatypes)
  • An interpreter for well-typed expressions
  • GADTs and type inference
  • Existential types and information hiding
  • Lists indexed by their length
  • From types to kinds
  • Type-level functions using type families
  • Singleton types
  • The Equality type
  • Learning by testing
  • (Semi-)Decidable equality
  • Representing datatypes
  • Heterogeneous lists


The base price of this course is GBP 3000 (single lecturer) or GBP 4500 (two lecturers). The base price excludes VAT and any other applicable taxes as well as travel costs which depend on the location of the course venue.

We generally recommend two lecturers, as it will allow a better ratio between lecturers and participants during the exercises, and will thereby encourage particpants to ask more questions. We strongly encourage to use two lecturers if there are more than five participants.

We offer on-site consulting in combination with on-site courses at a reduced daily rate.

If you are interested in this course, or for more information, please e-mail us with as many details as possible.

Why Well-Typed

Our teachers have more than a decade of experience with Haskell, functional programming, compiler design, and related areas. They have been training people at all experience levels, both in academia and in industry.

The insight they brought about how to think in Haskell was great and something that would be very difficult to get from a book or online.

— Anonymous