Skip to content

Switch default-language to GHC2021 instead of Haskell2010#12018

Open
Bodigrim wants to merge 1 commit into
masterfrom
ghc2021
Open

Switch default-language to GHC2021 instead of Haskell2010#12018
Bodigrim wants to merge 1 commit into
masterfrom
ghc2021

Conversation

@Bodigrim

Copy link
Copy Markdown
Collaborator

Let's scrap 1000+ lines of language extensions.

Template B: This PR does not modify behaviour or interface

Include the following checklist in your PR:

  • Patches conform to the coding conventions.
  • Is this a PR that fixes CI? If so, it will need to be backported to older cabal release branches (ask maintainers for directions).

@Bodigrim Bodigrim force-pushed the ghc2021 branch 4 times, most recently from 0305ba5 to 80807e7 Compare June 24, 2026 23:03
@philderbeast

philderbeast commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

This is possible now with the recent narrowing of the support window for GHC versions that build this project.

Since: 9.2.1
-- -XGHC2021

As discussed in #11723.

The last GHC 9.2 was released more than 3 years ago, which leaves us with GHC 9.4+.
-- #11966 (comment)

@philderbeast

Copy link
Copy Markdown
Collaborator

@Bodigrim could you please add a "Manual QA Note" to the description saying how we can validate locally with older versions of GHC?

validate-old-ghcs:
name: Validate old ghcs ${{ matrix.extra-ghc }}
# latest/latest doesn't have the old packages the old ghcs depend on
runs-on: ubuntu-22.04
needs: validate
strategy:
matrix:
extra-ghc:
["9.2.8", "9.0.2", "8.10.7", "8.8.4", "8.6.5", "8.4.4", "8.2.2", "8.0.2"]
## GHC 7.10.3 does not install on ubuntu-latest with ghcup.
## Older GHCs are not supported by ghcup in the first place.
fail-fast: false

I tried quickly and failed to replicate the "validate-old-ghcs" step locally:

$ ghc --numeric-version
8.2.2

$ sh validate.sh -s build
Resolving dependencies...
Error: [Cabal-7107]
Could not resolve dependencies:
[__0] trying: Cabal-3.17.0.0 (user goal)
[__1] next goal: base (dependency of Cabal)
[__1] rejecting: base-4.10.1.0/installed-4.10.1.0 (conflict: Cabal => base>=4.17 && <5)
[__1] rejecting: base; 4.22.0.0, 4.21.2.0, 4.21.1.0, 4.21.0.0, 4.20.2.0, 4.20.1.0, 4.20.0.1, 4.20.0.0, 4.19.2.0, 4.19.1.0, 4.19.0.0, 4.18.3.0, 4.18.2.1, 4.18.2.0, 4.18.1.0, 4.18.0.0, 4.17.2.1, 4.17.2.0, 4.17.1.0, 4.17.0.0, 4.16.4.0, 4.16.3.0, 4.16.2.0, 4.16.1.0, 4.16.0.0, 4.15.1.0, 4.15.0.0, 4.14.3.0, 4.14.2.0, 4.14.1.0, 4.14.0.0, 4.13.0.0, 4.12.0.0, 4.11.1.0, 4.11.0.0, 4.10.1.0, 4.10.0.0, 4.9.1.0, 4.9.0.0, 4.8.2.0, 4.8.1.0, 4.8.0.0, 4.7.0.2, 4.7.0.1, 4.7.0.0, 4.6.0.1, 4.6.0.0, 4.5.1.0, 4.5.0.0, 4.4.1.0, 4.4.0.0, 4.3.1.0, 4.3.0.0, 4.2.0.2, 4.2.0.1, 4.2.0.0, 4.1.0.0, 4.0.0.0, 3.0.3.2, 3.0.3.1 (constraint from non-reinstallable package requires installed instance)
[__1] fail (backjumping, conflict set: Cabal, base)
After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: Cabal, base
$ cabal build all --enable-tests --enable-benchmarks --project-file=cabal.validate.project --with-compiler=ghc-8.2.2
Resolving dependencies...
Error: [Cabal-7107]
Could not resolve dependencies:
[__0] trying: Cabal-3.17.0.0 (user goal)
[__1] next goal: base (dependency of Cabal)
[__1] rejecting: base-4.10.1.0/installed-4.10.1.0 (conflict: Cabal => base>=4.17 && <5)
[__1] rejecting: base; 4.22.0.0, 4.21.2.0, 4.21.1.0, 4.21.0.0, 4.20.2.0, 4.20.1.0, 4.20.0.1, 4.20.0.0, 4.19.2.0, 4.19.1.0, 4.19.0.0, 4.18.3.0, 4.18.2.1, 4.18.2.0, 4.18.1.0, 4.18.0.0, 4.17.2.1, 4.17.2.0, 4.17.1.0, 4.17.0.0, 4.16.4.0, 4.16.3.0, 4.16.2.0, 4.16.1.0, 4.16.0.0, 4.15.1.0, 4.15.0.0, 4.14.3.0, 4.14.2.0, 4.14.1.0, 4.14.0.0, 4.13.0.0, 4.12.0.0, 4.11.1.0, 4.11.0.0, 4.10.1.0, 4.10.0.0, 4.9.1.0, 4.9.0.0, 4.8.2.0, 4.8.1.0, 4.8.0.0, 4.7.0.2, 4.7.0.1, 4.7.0.0, 4.6.0.1, 4.6.0.0, 4.5.1.0, 4.5.0.0, 4.4.1.0, 4.4.0.0, 4.3.1.0, 4.3.0.0, 4.2.0.2, 4.2.0.1, 4.2.0.0, 4.1.0.0, 4.0.0.0, 3.0.3.2, 3.0.3.1 (constraint from non-reinstallable package requires installed instance)
[__1] fail (backjumping, conflict set: Cabal, base)
After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: Cabal, base

@Bodigrim

Copy link
Copy Markdown
Collaborator Author

@philderbeast this PR does not change the support range of GHCs, the bound base>=4.17 && <5 remained unchanged. Validation against older versions of GHC is performed by CI.

validate-old-ghcs CI job runs sh validate.sh -s build with env.GHC_FOR_RELEASE (which is 9.10.3 at the moment) and only then executes sh validate.sh --lib-only -s lib-suite-extras --extra-hc "${{ env.EXTRA_GHC }}", where env.EXTRA_GHC points to versions from 8.0 to 9.2. Does it clarify?

validate-old-ghcs:
name: Validate old ghcs ${{ matrix.extra-ghc }}
# latest/latest doesn't have the old packages the old ghcs depend on
runs-on: ubuntu-22.04
needs: validate
strategy:
matrix:
extra-ghc:
["9.2.8", "9.0.2", "8.10.7", "8.8.4", "8.6.5", "8.4.4", "8.2.2", "8.0.2"]
## GHC 7.10.3 does not install on ubuntu-latest with ghcup.
## Older GHCs are not supported by ghcup in the first place.
fail-fast: false
steps:
- uses: actions/checkout@v6
- name: Install prerequisites for old GHCs
run: |
sudo apt-get update
sudo apt-get install libncurses5 libtinfo5
- name: Install extra compiler
run: ghcup install ghc ${{ matrix.extra-ghc }}
- name: GHCup logs
if: always()
run: cat /usr/local/.ghcup/logs/*
- name: Install primary compiler
uses: haskell-actions/setup@v2
id: setup-haskell
with:
ghc-version: ${{ env.GHC_FOR_RELEASE }}
cabal-version: latest
- name: GHC versions
run: |
ghc --version
"ghc-${{ matrix.extra-ghc }}" --version
# runner.os isn't sufficient for binary compatible caches
- name: Get runner OS/version for cache keys
id: get-osver
run: echo "osver=$ImageOS" >> "$GITHUB_OUTPUT"
# As we are reusing the cached build dir from the previous step
# the generated artifacts are available here,
# including the cabal executable and the test suite
- uses: actions/cache@v5
with:
path: |
${{ steps.setup-haskell.outputs.cabal-store }}
dist-*
key: ${{ steps.get-osver.outputs.osver }}-${{ env.GHC_FOR_RELEASE }}-${{ github.sha }}
restore-keys: ${{ steps.get-osver.outputs.osver }}-${{ env.GHC_FOR_RELEASE }}-
- name: Validate build
id: build
run: sh validate.sh ${{ env.COMMON_FLAGS }} -s build
- name: "Validate lib-suite-extras --extra-hc ghc-${{ matrix.extra-ghc }}"
env:
EXTRA_GHC: ghc-${{ matrix.extra-ghc }}
run: sh validate.sh ${{ env.COMMON_FLAGS }} --lib-only -s lib-suite-extras --extra-hc "${{ env.EXTRA_GHC }}"
# See the comment above about running all tests but still failing if one
# of them does; it also applies here.

@philderbeast

philderbeast commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Thanks @Bodigrim. With that prompting, I was able to run a few local validations.

$ ghc --numeric-version
9.14.1
$ ./validate.sh --extra-hc=ghc-8.2.2
$ ghc --numeric-version
9.4.8
$ ./validate.sh --extra-hc=ghc-9.14.1

Installing ghc-7.10.3 with ghcup install ghc 7.10.3 --install-targets "install STRIP_CMD=true":

$ ghc --numeric-version
9.14.1
$ ./validate.sh --extra-hc=ghc-7.10.3

@philderbeast

Copy link
Copy Markdown
Collaborator

Impressive diff, +61, -1,118 in 378 files.

@Bodigrim

Copy link
Copy Markdown
Collaborator Author

This can use another review please ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants