This is the twenty-first edition of our GHC activities report, which describes the work on GHC and related projects that we are doing at Well-Typed. The current edition covers roughly the months of October and November 2023. You can find the previous editions collected under the ghc-activities-report tag.

Many thanks to our sponsors who make this work possible: Anduril, Hasura and Juspay. In addition, we are grateful to Mercury for funding specific work on improved performance for GHC, HLS and related projects.

However, we need more sponsorship to sustain the team! If your company might be able to contribute funding to sustain this work, please read about how you can help or get in touch.

Of course, GHC is a large community effort, and Well-Typed’s contributions are just a small part of this. This report does not aim to give an exhaustive picture of all GHC work that is ongoing, and there are many fantastic features currently being worked on that are omitted here simply because none of us are currently involved in them. Furthermore, the aspects we do mention are still the work of many people. In many cases, we have just been helping with the last few steps of integration. We are immensely grateful to everyone contributing to GHC!

Team

The GHC team at Well-Typed consists of Ben Gamari, Andreas Klebinger, Matthew Pickering, Zubin Duggal, Sam Derbyshire, Finley McIlwaine and Rodrigo Mesquita. Many others within Well-Typed are contributing to GHC more occasionally.

Cabal

Thanks to funding from the Sovereign Tech Fund, several of our team members have been working on Cabal over the last few months, coming up with a plan to address longstanding architectural issues. Check out our post announcing the project and the detailed HF Tech Proposal.

Releases

  • Ben released GHC 9.8.1, the first release in a new major series.

  • Zubin released GHC 9.4.8, fixing a few bugs in the stable 9.4 series.

Frontend

  • Sam fixed a couple of oversights in the renamer, in the construction of import environments (#24084, !11443) and in the lookup of children for a fixity declaration (#24037, !11370).

  • Zubin fixed a GHC panic when -dynamic-too was used along with -fno-code and -fprefer-bytecode (#23944, !11436).

  • Zubin fixed a regression in error message reporting for certain cyclic module graphs (#24196, !11718).

Performance and optimisation

  • Andreas finished up a bugfix to the logic that determines whether to unpack a field of a datatype. GHC now correctly takes into consideration the runtime representation of the field (!9724).

  • Finley has been experimenting with ways to improve the observability of performance improvements resulting from type class specialisation. A side effect of these efforts is the addition of “late plugins”, which are compiler plugins that may access and modify the core of a module without affecting optimization or inlining (#24254, !11765).

  • Andreas finished up Jaro’s patch implementing common 64-bit operations in the 32-bit X86 NCG backend. This substantially improves the performance of common Int64/Word64 operations (such as comparison) on 32-bit x86 platforms (!10771).

  • Zubin fixed several memory leaks in GHCi (#24107, #23405, #24118, !11608).

  • Ben investigated a possible memory leak (#23949).

Runtime system

Linking

  • Ben fixed linking errors on Darwin by changing the logic that finds which linker to use (#21712, #24033, !11364).

  • Rodrigo fixed several bugs caused by a recent upgrade of the linker on Darwin (#24161, #24167, #24168, !11580).

  • Ben diagnosed a user-reported problem related to profiling and linking, identifying it as a duplicate of a known issue (#24194, #14291).

Documentation

  • Ben improved the discussion of -Wpartial-fields in the GHC user guide, clearing up some confusion (#24049, !11382).

  • Zubin fixed the generation of links to packages in the GHC users guide (#24151, !11602).

Libraries

  • Ben started migrating parts of base into ghc-internal, continuing efforts towards better separating GHC implementation details and experimental features from the more stable base library (!11400).

  • Ben began drafting a plan for making base (and potentially template-haskell) reinstallable packages. This would allow new GHC versions to compile programs using older library interfaces, greatly easing the pain of library-induced churn when upgrading GHC.

  • Ben fixed a deficiency in language-c that was affecting users of c2hs on Windows (c2hs issue 291, language-c PR 96).

  • Adam’s proposal to redesign HasField was accepted by the GHC Steering Committee.

Build system and CI

  • Ben finished up Matthew’s work ironing out remaining bugs in ghc-toolchain (!11135).

  • Rodrigo improved the error message reported when reading an invalid .target file (!11621).

  • Matthew restructured some dependencies within Hadrian so that the ghc library can be built without building the ghc executable in more contexts, e.g. during cross-compilation (!11404).

  • Matthew continued working on building stage 2 cross compilers. We are down to a few CI failures and hopefully this work will be completed early in the new year.

  • Matthew implemented infrastructure to monitor file sizes, such as the sizes of the object files and interface files that GHC produces (!11612).