Last weekend, Well-Typed again offered a ZuriHac “Advanced Track,” comprising two independent sessions on “Optics” and “Memory usage.” Furthermore, Ben Gamari appeared as a panelist in the GHC Discussion at ZuriHac.

Thanks a lot to the organisers of ZuriHac for all their work and for creating a wonderful event. Thanks as well to all the other speakers and attendees.

The videos of our sessions as well as the materials used in them are available online, so those who could not attend during the event itself can still do so by following the links below.

Optics in the abstract (by Adam Gundry)

Watch video on YouTubeSlidesRepository with exercises

Haskell programming often involves manipulating data structures. Optics are a compositional abstraction representing “notions of substructure” as first-class values. For example, lenses capture the notion of one data structure containing another, and there are more general optics for read-only, write-only, optional or repeated substructures. Judicious use of optics can lead to succinct, expressive code, yet optics also have a reputation of being impenetrable.

In this workshop, we will explore optics-the-concept in general and the optics library in particular. This library provides interfaces for defining, combining and using various kinds of optics. Crucially, these interfaces are abstract, so they can be understood without reference to the underlying implementation.

We will also discuss how optics can help in addressing the limitations of Haskell’s record system, in conjunction with language extensions such as DuplicateRecordFields, OverloadedLabels and the forthcoming RecordDotSyntax and NoFieldSelectors.

Finally, we will use optics as a case study to reflect on library design in Haskell. How can we build libraries that capture powerful concepts and yet remain easy to use by Haskellers with a wide range of skill levels?

This workshop is suitable for Haskell programmers with a knowledge of basic Haskell concepts (polymorphic functions, data types, type classes). It does not require familiarity with advanced type system features such as higher-rank types or type families.

Understanding memory usage with eventlog2html and ghc-debug (by Matthew Pickering and Ben Gamari)

Watch video on YouTubeRepository with materials and exercises

Profiling memory usage of applications has historically been a difficult task, thankfully in recent years the profiling tools have become more sophisticated and now it is quite easy to work out memory usage issues, if you know how to ask the right question.

In this workshop, we look at two profiling tools which can give you both high and low level insight into the memory usage of your application. Firstly, by using eventlog2html we will understand how to get a high-level overview of your program’s memory usage. Then using these insights we will then learn how to use ghc-debug in order to answer some more precise questions about memory usage.

The presentation does not require any advanced knowledge but is delving into the internals, so you should be comfortable with that.

Other ZuriHac videos

Please also check out the YouTube playlist for the whole event, with all the keynotes and several talks from other tracks.

Last year’s Well-Typed lectures on “Generic Programming” and “Haskell and InfoSec” remain available as well.

Well-Typed courses and services

If you are interested in our courses or other services, check our Training page, Consultancy page, or just send us an email.