hadrian-util: An experiment in a more usable hadrian UX

Ben Gamari ben at well-typed.com
Sun Jan 5 18:30:34 UTC 2020

Hi everyone,

For the past few months I have been using Hadrian for the majority of my
GHC builds. In due course I have encountered a few papercuts:

 * hadrian/cabal.build.sh is quite wordy (#16250); moreover, you need to
   be in the source root to invoke it (#16667)

 * editing hadrian.settings is quite difficult due to the lack of
   availability of tab-completion in vim

 * maintaining multiple build roots is quite error-prone since you must
   remember which build flavour you used for each (#16481, #16638)
 * there is no equivalent to setting `stage=2` in `mk/build.mk` to make
   the stage-1-freeze persistent

To address these I cobbled together a small wrapper, hadrian-util. I
have this installed in my home-manager environment with a shell alias,
`hu`, meaning that building GHC is as easy as typing `hu run` anywhere
in the tree.

As discussed in the README, `hadrian-util` supports multiple build
roots, has a moderately convenient interface for manipulating
hadrian.settings (with completion!) and has enough persistent state to
eliminate most of the error-prone boilerplate from Hadrian invocations
without being confusing.

There is the question of what the long-term future of hadrian-util
should be. Arguably it is merely a hack papering over some of the
shortcomings of Hadrian's current UX; perhaps eventually these will be
fixed. However, in the meantime, I've found that hadrian-util makes
hadrian quite pleasant to use.

I hope others also find this useful.


- Ben
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 487 bytes
Desc: not available
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20200105/0949004a/attachment.sig>

More information about the ghc-devs mailing list