Haskell and Hacking: Reflections on the GHC Contributors’ Workshop and ZuriHac

I recently had the opportunity to give a talk at the 2023 GHC Contributors’ Workshop, held at the Rapperswil-Jona campus of the Eastern Switzerland University of Applied Sciences (OST). The aim of this workshop was to help people learn how to work on the Glasgow Haskell Compiler (GHC), understand its internals better, and ultimately, increase the number of GHC contributors.

Now that I have returned from the workshop, I’ll use this blog post to recall my experiences and reflect on how the workshop went. Many thanks to David Thrane Christiansen, ex-Galwegian and Executive Director of the Haskell Foundation, and Farhad Mehta, professor at OST, for organizing the event and inviting me to speak.

Workshop details

The workshop was a three-day event that was held immediately prior to ZuriHac 2023, an annual Haskell-themed hackathon held in the same location (which I also attended). The GHC Contributors’ Workshop had approximately 58 participants in total, whereas ZuriHac had many more attendees (likely hundreds more, by my estimation). As a result of the workshop’s smaller size, the entirety of the event took place in one OST classroom.

During the workshop, I gave an introductory talk on GHC development, which covered topics such as GHC’s build system, the different phases of the compiler pipeline, the coding conventions used in GHC, and how to effectively write a GHC patch. A recording of the talk can be found here, and my slides can be found here. Other presenters gave talks on more specific components of GHC, such as its typechecker and runtime system, as well as Haskell ecosystem tools like the Haskell Language Server, Cabal, and Hackage.

Each day of the workshop was filled with talks, so participants who wanted to do focused GHC hacking were encouraged to find another OST classroom to work in, or to continue their hacking during ZuriHac. Workshop participants were a mix of students and Haskell industry professionals, most of whom were based in Europe.

How did it go?

I was extremely pleased with the workshop overall. GHC development is a topic that is near and dear to my heart, and being able to share my passion with GHC newcomers was a delight. The workshop had a variety of people, some who I had met before at previous workshops, some who I had spoken to online but never met in person, and some who I had never met at all.

Due to the smaller size of the workshop, I was able to answer audience questions in much greater depth than in a typical conference setting, which went a long way in making the event feel more tailored to the participants’ needs. I am especially grateful to David’s efforts to single-handedly stream the entire workshop on YouTube (from his laptop, no less!), which allowed online participants to follow along and ask questions.

With so many GHC beginners and experts gathered in the same place, the conversations that happened during the workshop, over lunch, and by Lake Zürich in the evenings were always engaging. Some of the more interesting things that I learned and discussed during the event include:

  • GHC has new WebAssembly and JavaScript backends, which will make it easier than ever to run Haskell applications natively in a browser. After watching the lead developers of these two backends speak at the workshop, I am excited to try building some of my own Haskell projects with these backends soon to see what does (and does not) work.

These backends are already quite fully featured, but there is still a major caveat: using these backends requires building a cross-compiled GHC. I am keeping an eye out for ongoing work to make GHC runtime-retargetable, which is a prerequisite to making the Wasm/JS backends “just work” from an ordinary build of GHC.

  • A group of people interested in metaprogramming formed an impromptu “Staged Working Group”, which included GHC developers and people from the Lean and Racket language communities. The goal of this working group is to sketch how we could improve Template Haskell, which has long been a pain point in Haskell development. We successfully identified several challenges in making Template Haskell better (which you can read about here), and we informally agreed to meet up again to plan next steps.
  • There is a lot of excitement around the Haskell Language Server (HLS), especially after an HLS maintainer presented a talk on the subject during the workshop. During my own presentation, I boldly claimed that you could develop GHC from within HLS and it would “just work.” This may have been too bold a prediction, since someone tried developing GHC in HLS right after and immediately found a bug. But, quite happily, the bug was fixed by another workshop attendee!
  • I had the chance to speak with Vladislav Zaviolav, who is spearheading the effort towards dependent types in GHC. Most of his recent work has been in cleaning up unpleasant corners of Haskell’s type system, which will make implementing dependent types in the future much easier.

    During the workshop, I helped shepherd one of his patches to implement invisible binders in type-level declarations in GHC, which I am quite excited about. It’s possible that this work will help make some of Galois’s own code cleaner in the future!

I was also pleased to discover that many participants were familiar with Galois and wanted to know more about how the work I do at Galois intersects with GHC development. While GHC development is mostly a hobby for me, there have been times where I have encountered GHC bugs while working on tools like SAW, so having more GHC contributors does pay dividends in both a personal and professional setting.

Aside from the workshop, I also had the opportunity to attend ZuriHac in person for the first time, which was also delightful. ZuriHac was not only a good time in general, it also gave GHC Contributors’ Workshop participants more time to actually put the knowledge they gained during the workshop into practice. In many ways, this is where the real value of the workshop became evident, as ZuriHac gave me an opportunity to do one-on-one mentoring while workshop participants wrote their first-ever patches to GHC. Jumping into a project as large as GHC for the first time can be intimidating, so my hope is that having lots of GHC experts around made the process much less scary.

At the end of ZuriHac, there were a grand total of 25 GHC merge requests submitted by someone who attended the GHC Contributors’ Workshop. Of those merge requests, two of them were authored by someone who I mentored during ZuriHac. Not bad for just one week!

Final thoughts

The GHC Contributors’ Workshop was a blast, and I’d happily go back for another edition. If you are interested in GHC development, you should consider doing so as well.