If you need to build, test, deploy or develop [`ghc-lib`](https://github.com/digital-asset/ghc-lib) as used by Daml and utilizing the Digital Asset [GHC fork](https://github.com/digital-asset/ghc) these notes are for you.
Here are instructions for when working on Daml surface syntax, as implemented in the the digital-assert fork of `ghc`. (linked in via `ghc-lib`, see [ghc-lib](/bazel_tools/ghc-lib/).
3. Checkout the version of interest (usually `da-master-8.8.1`, which should match `GHC_REV` from [`$DAML_REPO/bazel_tools/ghc-lib/version.bzl`](https://github.com/digital-asset/daml/blob/main/bazel_tools/ghc-lib/version.bzl)) and update the submodules:
2.`direnv allow`, to enter the dev environment defined in `.envrc`. For help installing direnv, see [direnv](https://direnv.net). This should only be necessary the first time.
3.`hadrian/build.sh --configure --flavour=quickest -j`. This will give immediate feedback on build failures, but it takes about 2-3 minutes when successful.
4.`./_build/stage1/bin/ghc <EXAMPLE_FILE> -ddump-parsed | tee desugar.out`. `<EXAMPLE_FILE>` must be a file with extension `.hs`, which must begin with the pragma `{-# LANGUAGE DamlSyntax #-}`. A typical starting point is [`$GHC_REPO/Example.hs`](https://github.com/digital-asset/ghc/blob/da-master-8.8.1/Example.hs).
While working on GHC, you can integrate your changes directly into the `daml` project as follows, making sure to replace `$DAML_REPO` (resp. `$GHC_REPO`) with the path to the Daml (resp. GHC) repository on your machine:
2. Open a PR on the Daml repository, making sure that the SHA value in `GHC_REV` in [`$DAML_REPO/bazel_tools/ghc-lib/version.bzl`](https://github.com/digital-asset/daml/blob/main/bazel_tools/ghc-lib/version.bzl) corresponds to the last commit in the GHC PR.
3. To help your reviewers, please update the description of both PRs with a link to each other.
4. Once CI has passed on the Daml PR, you may merge the GHC PR.
5. Update the Daml PR so `GHC_REV` now points to the GHC PR **merge commit**.