Tags: GHC | May 3, 2022 |
This post is to announce the first public release of a paper we wrote about modularizing GHC (PDF)
As you may know, I’ve been involved into several refactorings of GHC (adding some module hierarchy, ditching DynFlags, etc.). I have been asked a few times to write a document providing an overview of the design that we wanted to reach.
I dutily started to write this document more than two years ago. It started as a compilation of issues about the current design. However it was a bit difficult to state refactoring principles: for example, it seems obvious to me that SDoc
mustn’t be coupled with DynFlags
, but why? What’s the underlying principle?
Later I found out that I was in fact reinventing Domain-Driven Design (DDD). So I’ve started to reframe the paper as applying DDD principles to GHC. However the paper was put on hold, mostly because welcoming a baby sucked most of my time and energy to work on it.
A few weeks ago, we figured out with John (who had read the draft) that the paper could help a HSoC applicant: https://github.com/haskell-org/summer-of-haskell/issues/143 With the invaluable help of John and Jeff, we strove to make a first release of the paper in less than a week. We obviously failed to meet this deadline. But a few more weeks later, it’s finally there: “Modularizing GHC” paper (PDF) (in case you missed the link above)
It’s an odd paper because it’s a mix of:
- an audit report: a compilation of design issues, with some historical perspectives
- a proposal: a proposed design for GHC, based on DDD
- an experience report: our experience with refactoring GHC, and some method hints for doing it efficiently
- an exposition of DDD to a FP audience, using GHC as an example
Note that in the first draft I planned to also include mentions of Cabal. It was finally left out because it was a highway to despair, and the paper was already very long. We also only briefly mention Hadrian. Both could deserve their own paper of this kind.
This post has been discussed on: