This is the eighteenth 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 April and May 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, Juspay and GitHub via the Haskell Foundation. 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 in any way. 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 and Rodrigo Mesquita. Moreover, we are delighted that Jaro Reinders will be joining the team for an internship over the next few months. Many others within Well-Typed are contributing to GHC more occasionally.

Releases

  • Ben prepared and released GHC 9.6.2.
  • Zubin prepared and released GHC 9.2.8.

Frontend

  • Sam implemented GHC proposal #433 adding Unsatisfiable. This is an alternative to TypeError, but with more predictable behaviour, and with a few usability enhancements (such as not being required to manually write out class method definitions in an instance with an Unsatisfiable context).

  • Sam fixed a panic (ltPSize) in the typechecker, relating to termination checks for superclasses involving type families (#23171).

  • Matthew minimised a program which exhibited very slow constraint solving (#23158). This problem was subsequently fixed by Simon Peyton Jones in his refactoring of the handling of equality constraints (!10123).

  • Matthew fixed a bug under which -Wunused-packages would sometimes incorrectly warn that GHC.Prim was unused (!10278).

  • Sam fixed a variety of panics in the typechecking of invalid newtype declarations involved in recursive groups (#23308).

  • Sam fixed a bug in which the pattern match checker would not propagate long-distance information in generated code (#23445). In practice, this fixes certain incorrect inexhaustive pattern warnings for pattern matches occurring inside the body of a record update.

Error messages and warnings

  • Sam finished up work by Soham Chowdhury improving error messages for incorrect import statements (!8895). For example, import Data.Type.Equality ( (~) ) now gives an error message suggesting “Perhaps you meant type (~)”, as opposed to simply saying that (~) is not in scope.

  • Sam improved the error messages for ambiguous occurrences, such as mentioning a record field selector when multiple data constructors have a field with that name in scope (!10355).

  • Sam migrated error messages in GHC.Tc.Module to the new diagnostic infrastructure. In the process, the consistency checks between an hs-boot or hsig file and its implementation were tightened up a bit, fixing a couple of shortcomings of validity checking in Backpack (#23342, #23344).

  • Sam helped two contributors finish their work migrating error messages to the new diagnostic infrastructure. Thanks to Hai Nguyen Quang for handling GHC.Tc.Validity (!6511) and Gregory Gerasev for handling GHC.Rename.Splice and GHC.Rename.Pat (!8292).

Backend

  • Finley enabled compression of info-table provenance entries (IPE). This decreases the size of binaries generated with -finfo-table-map by about 20% by using zstd (!9893).

  • Zubin ensured that GHC uses compact string representations when serialising things into interface files, and that these strings are not duplicated and reallocated multiple times (#22744, !10403).

  • Matthew identified and fixed a bug with -fdicts-strict which could cause runtime loops when compiling with -O2 (!10282).

  • Ben and Rodrigo fixed tagging issues with nullary data constructors which could lead to segfaults (#23231, !10165).

  • Andreas diagnosed a GHCi segfault (#23404), identifying the missing backport (!10061).

  • Rodrigo updated the documentation of UnliftedFFI to account for the deprecation of ArrayArray# (!10344).

Runtime system

  • Ben has been investigating the memory ordering issues observed in #23222 and believes that he has now found the culprit.

  • Andreas investigated the compatibility of cloning heap objects with the debug runtime system. This surfaced some incompatibilities in the way the debug RTS handles static thunks, which can result in segmentation faults.

  • Matthew refined the memory retention behaviour to account for pinned and compacted objects. This ensures the RTS doesn’t overestimate how much memory it needs when there are many such objects (#23221).

  • Ben fixed a bug in the aligned allocation codepath where large alignments could result in overflow of a block (#23400)

Packaging

  • Matthew fixed broken links to documentation on the downloads.haskell.org webpage (#23121).

  • Matthew added a CI job to create vanilla (non fully-static) alpine binary distributions.

  • Zubin ensured that we actually test 32-bit GHC binaries when testing the GHCup configuration.

GHC build system

  • Rodrigo worked on multiple toolchain selection support (#19877), paving the way to a runtime-retargetable GHC. This ongoing work includes numerous patches to how GHC configures and uses toolchains (#23361, !10431, !10513).

  • Matthew and Rodrigo added unit-id hashes to packages built by Hadrian (!10119). This moves us towards reinstallable boot packages (e.g. a reinstallable ghc library), as it allows us to detect potentially unsound situations (#20742).

  • Matthew made hadrian call haddock with a response file, in order to avoid over-long line errors on Windows (!10307).

head.hackage

  • Matthew added an aarch64 job to the head.hackage CI.

  • Ben has been moving head.hackage’s build infrastructure to instead use the excellent foliage tool, allowing freezing the head.hackage Hackage repository with cabal-install’s index-state field.

Core libraries

  • Ben has been working with the Core Libraries Committee and other stakeholders to begin disentangling GHC’s internal implementation from the interfaces exposed by base. See Haskell Foundation Tech Proposal #47.

  • Ben has been working on introducing infrastructure to more closely test interface stability of base and related packages.

GHC Proposals