Skip to content

Hadrian flavours should be more compositional

Currently Hadrian's notion of a flavour is a very rudimentary: flavours have names and fully define a build configuration. As a consequence, we have reproduced an unfortunate characteristic of the make build system: an exponential explosion of flavours.

However, in the Flavour module we have grown a number of "flavour transformers" which modify flavours in various ways:

  • enableDebugInfo enables native debug information in the boot libraries and GHC
  • werror enables -Werror in the stage2 build
  • enableTickyGhc builds GHC with Ticky-Ticky support
  • splitSections enables section splitting
  • enableThreadSanitizer enables TSAN in the stage2 build and GHC executable

In principle this is great: you can take a simple base flavour and compositionally add features to it with these combinators. However, we currently provide no way to do so from the command-line. You rather need to edit UserSettings.hs, defining your own flavour in Haskell (using these combinators).

I propose that we extend the syntax accepted by the --flavour command-line flag to allow specification of "transformers", in addition to a base flavour. For instance, one might write:

hadrian/build-cabal --flavour=perf+werror+tickyGhc

which would be equivalent to defining a flavour werror $ enableTickyGhc performance. This would be easy to implement and allow us to eliminate all of the LLVM flavours currently defined in the Hadrian tree (turning them into a single flavour transformer).

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information