From 9db05f4fa6e4f1a486353278394b10eb68793852 Mon Sep 17 00:00:00 2001 From: Ryan Scott Date: Sat, 4 Mar 2023 16:00:13 -0500 Subject: [PATCH] singletons-{th,base}: Require building with GHC 9.6 Checks off one box in #540. --- .github/workflows/haskell-ci.yml | 84 ++++++++++++++++++--------- README.md | 2 +- cabal.haskell-ci | 1 + cabal.project | 2 +- haskell-ci.yml.patch | 13 +++++ singletons-base/CHANGES.md | 1 + singletons-base/README.md | 2 +- singletons-base/singletons-base.cabal | 16 ++--- singletons-th/CHANGES.md | 1 + singletons-th/README.md | 2 +- singletons-th/singletons-th.cabal | 10 ++-- singletons/singletons.cabal | 9 +-- 12 files changed, 94 insertions(+), 49 deletions(-) create mode 100644 haskell-ci.yml.patch diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index fd683ac9..b4fecf89 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -8,9 +8,9 @@ # # For more information, see https://github.com/haskell-CI/haskell-ci # -# version: 0.15.20220822 +# version: 0.15.20230304 # -# REGENDATA ("0.15.20220822",["github","cabal.project"]) +# REGENDATA ("0.15.20230304",["github","cabal.project"]) # name: Haskell-CI on: @@ -33,14 +33,19 @@ jobs: compilerVersion: "8.4" setup-method: hvr-ppa allow-failure: false - - compiler: ghc-9.4.1 + - compiler: ghc-9.6.0.20230302 compilerKind: ghc - compilerVersion: 9.4.1 + compilerVersion: 9.6.0.20230302 setup-method: ghcup allow-failure: false - - compiler: ghc-9.2.4 + - compiler: ghc-9.4.4 compilerKind: ghc - compilerVersion: 9.2.4 + compilerVersion: 9.4.4 + setup-method: ghcup + allow-failure: false + - compiler: ghc-9.2.7 + compilerKind: ghc + compilerVersion: 9.2.7 setup-method: ghcup allow-failure: false - compiler: ghc-9.0.2 @@ -101,8 +106,9 @@ jobs: mkdir -p "$HOME/.ghcup/bin" curl -sL https://downloads.haskell.org/ghcup/0.1.18.0/x86_64-linux-ghcup-0.1.18.0 > "$HOME/.ghcup/bin/ghcup" chmod a+x "$HOME/.ghcup/bin/ghcup" + "$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml; "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false) - "$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false) + "$HOME/.ghcup/bin/ghcup" install cabal 3.9.0.0 || (cat "$HOME"/.ghcup/logs/*.* && false) else apt-add-repository -y 'ppa:hvr/ghc' if [ $((GHCJSARITH)) -ne 0 ] ; then apt-add-repository -y 'ppa:hvr/ghcjs' ; fi @@ -113,7 +119,8 @@ jobs: mkdir -p "$HOME/.ghcup/bin" curl -sL https://downloads.haskell.org/ghcup/0.1.18.0/x86_64-linux-ghcup-0.1.18.0 > "$HOME/.ghcup/bin/ghcup" chmod a+x "$HOME/.ghcup/bin/ghcup" - "$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false) + "$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml; + "$HOME/.ghcup/bin/ghcup" install cabal 3.9.0.0 || (cat "$HOME"/.ghcup/logs/*.* && false) fi env: HCKIND: ${{ matrix.compilerKind }} @@ -132,20 +139,20 @@ jobs: echo "HC=$HC" >> "$GITHUB_ENV" echo "HCPKG=$HOME/.ghcup/bin/$HCKIND-pkg-$HCVER" >> "$GITHUB_ENV" echo "HADDOCK=$HOME/.ghcup/bin/haddock-$HCVER" >> "$GITHUB_ENV" - echo "CABAL=$HOME/.ghcup/bin/cabal-3.6.2.0 -vnormal+nowrap" >> "$GITHUB_ENV" + echo "CABAL=$HOME/.ghcup/bin/cabal-3.9.0.0 -vnormal+nowrap" >> "$GITHUB_ENV" else HC=$HCDIR/bin/$HCKIND echo "HC=$HC" >> "$GITHUB_ENV" echo "HCPKG=$HCDIR/bin/$HCKIND-pkg" >> "$GITHUB_ENV" echo "HADDOCK=$HCDIR/bin/haddock" >> "$GITHUB_ENV" - echo "CABAL=$HOME/.ghcup/bin/cabal-3.6.2.0 -vnormal+nowrap" >> "$GITHUB_ENV" + echo "CABAL=$HOME/.ghcup/bin/cabal-3.9.0.0 -vnormal+nowrap" >> "$GITHUB_ENV" fi HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))') echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV" echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV" echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV" - echo "HEADHACKAGE=false" >> "$GITHUB_ENV" + if [ $((! GHCJSARITH && HCNUMVER >= 90600)) -ne 0 ] ; then echo "HEADHACKAGE=true" >> "$GITHUB_ENV" ; else echo "HEADHACKAGE=false" >> "$GITHUB_ENV" ; fi echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV" env: HCKIND: ${{ matrix.compilerKind }} @@ -173,6 +180,18 @@ jobs: repository hackage.haskell.org url: http://hackage.haskell.org/ EOF + if $HEADHACKAGE; then + cat >> $CABAL_CONFIG <> $CABAL_CONFIG <> cabal.project - if [ $((! GHCJSARITH && HCNUMVER >= 90400)) -ne 0 ] ; then echo "packages: $GITHUB_WORKSPACE/source/./singletons-th" >> cabal.project ; fi - if [ $((! GHCJSARITH && HCNUMVER >= 90400)) -ne 0 ] ; then echo "packages: $GITHUB_WORKSPACE/source/./singletons-base" >> cabal.project ; fi + if [ $((! GHCJSARITH && HCNUMVER >= 90600)) -ne 0 ] ; then echo "packages: $GITHUB_WORKSPACE/source/./singletons-th" >> cabal.project ; fi + if [ $((! GHCJSARITH && HCNUMVER >= 90600)) -ne 0 ] ; then echo "packages: $GITHUB_WORKSPACE/source/./singletons-base" >> cabal.project ; fi cat cabal.project - name: sdist run: | @@ -228,20 +247,23 @@ jobs: touch cabal.project touch cabal.project.local echo "packages: ${PKGDIR_singletons}" >> cabal.project - if [ $((! GHCJSARITH && HCNUMVER >= 90400)) -ne 0 ] ; then echo "packages: ${PKGDIR_singletons_th}" >> cabal.project ; fi - if [ $((! GHCJSARITH && HCNUMVER >= 90400)) -ne 0 ] ; then echo "packages: ${PKGDIR_singletons_base}" >> cabal.project ; fi + if [ $((! GHCJSARITH && HCNUMVER >= 90600)) -ne 0 ] ; then echo "packages: ${PKGDIR_singletons_th}" >> cabal.project ; fi + if [ $((! GHCJSARITH && HCNUMVER >= 90600)) -ne 0 ] ; then echo "packages: ${PKGDIR_singletons_base}" >> cabal.project ; fi if [ $((GHCJSARITH || ! GHCJSARITH && HCNUMVER >= 80200)) -ne 0 ] ; then echo "package singletons" >> cabal.project ; fi if [ $((GHCJSARITH || ! GHCJSARITH && HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi - if [ $((! GHCJSARITH && HCNUMVER >= 90400)) -ne 0 ] ; then echo "package singletons-th" >> cabal.project ; fi - if [ $((! GHCJSARITH && HCNUMVER >= 90400)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi - if [ $((! GHCJSARITH && HCNUMVER >= 90400)) -ne 0 ] ; then echo "package singletons-base" >> cabal.project ; fi - if [ $((! GHCJSARITH && HCNUMVER >= 90400)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi + if [ $((! GHCJSARITH && HCNUMVER >= 90600)) -ne 0 ] ; then echo "package singletons-th" >> cabal.project ; fi + if [ $((! GHCJSARITH && HCNUMVER >= 90600)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi + if [ $((! GHCJSARITH && HCNUMVER >= 90600)) -ne 0 ] ; then echo "package singletons-base" >> cabal.project ; fi + if [ $((! GHCJSARITH && HCNUMVER >= 90600)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi cat >> cabal.project <> cabal.project + fi $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(singletons|singletons-base|singletons-th)$/; }' >> cabal.project.local cat cabal.project cat cabal.project.local @@ -249,8 +271,8 @@ jobs: run: | $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all cabal-plan - - name: cache - uses: actions/cache@v2 + - name: restore cache + uses: actions/cache/restore@v3 with: key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }} path: ~/.cabal/store @@ -269,10 +291,16 @@ jobs: run: | cd ${PKGDIR_singletons} || false ${CABAL} -vnormal check - if [ $((! GHCJSARITH && HCNUMVER >= 90400)) -ne 0 ] ; then cd ${PKGDIR_singletons_th} || false ; fi - if [ $((! GHCJSARITH && HCNUMVER >= 90400)) -ne 0 ] ; then ${CABAL} -vnormal check ; fi - if [ $((! GHCJSARITH && HCNUMVER >= 90400)) -ne 0 ] ; then cd ${PKGDIR_singletons_base} || false ; fi - if [ $((! GHCJSARITH && HCNUMVER >= 90400)) -ne 0 ] ; then ${CABAL} -vnormal check ; fi + if [ $((! GHCJSARITH && HCNUMVER >= 90600)) -ne 0 ] ; then cd ${PKGDIR_singletons_th} || false ; fi + if [ $((! GHCJSARITH && HCNUMVER >= 90600)) -ne 0 ] ; then ${CABAL} -vnormal check ; fi + if [ $((! GHCJSARITH && HCNUMVER >= 90600)) -ne 0 ] ; then cd ${PKGDIR_singletons_base} || false ; fi + if [ $((! GHCJSARITH && HCNUMVER >= 90600)) -ne 0 ] ; then ${CABAL} -vnormal check ; fi - name: haddock run: | - if [ $((! GHCJSARITH)) -ne 0 ] ; then $CABAL v2-haddock $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all ; fi + if [ $((! GHCJSARITH)) -ne 0 ] ; then $CABAL v2-haddock --disable-documentation $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all ; fi + - name: save cache + uses: actions/cache/save@v3 + if: always() + with: + key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }} + path: ~/.cabal/store diff --git a/README.md b/README.md index 76ca7d38..c1ebf321 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ windows for requirements on the compiler version needed to build each library: GHC language extensions, even more so than `singletons` itself. As such, it is difficult to maintain support for multiple GHC versions in any given release of either library, so they only support the latest major GHC version - (currently GHC 9.4). + (currently GHC 9.6). Any code that uses the singleton-generation functionality from `singletons-th` or `singletons-base` needs to enable a long list of GHC extensions. This list diff --git a/cabal.haskell-ci b/cabal.haskell-ci index 0f5a9817..fbe9092c 100644 --- a/cabal.haskell-ci +++ b/cabal.haskell-ci @@ -2,5 +2,6 @@ distribution: bionic no-tests-no-benchmarks: False unconstrained: False jobs-selection: any +github-patches: haskell-ci.yml.patch -- Needed to avoid https://github.com/haskell/cabal/issues/5423 haddock-components: libs diff --git a/cabal.project b/cabal.project index e171fd22..9c6c4de3 100644 --- a/cabal.project +++ b/cabal.project @@ -5,4 +5,4 @@ packages: ./singletons source-repository-package type: git location: https://github.com/goldfirere/th-desugar - tag: b64e24b67c91991f5d9b97b055d05693fd99cb9b + tag: c33d1dfae5e064be1c143929fd65ce9a10412468 diff --git a/haskell-ci.yml.patch b/haskell-ci.yml.patch new file mode 100644 index 00000000..df0e4666 --- /dev/null +++ b/haskell-ci.yml.patch @@ -0,0 +1,13 @@ +diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml +index 209f0e3..b4fecf8 100644 +--- a/.github/workflows/haskell-ci.yml ++++ b/.github/workflows/haskell-ci.yml +@@ -37,7 +37,7 @@ jobs: + compilerKind: ghc + compilerVersion: 9.6.0.20230302 + setup-method: ghcup +- allow-failure: true ++ allow-failure: false + - compiler: ghc-9.4.4 + compilerKind: ghc + compilerVersion: 9.4.4 diff --git a/singletons-base/CHANGES.md b/singletons-base/CHANGES.md index 32d193c3..0141d6a6 100644 --- a/singletons-base/CHANGES.md +++ b/singletons-base/CHANGES.md @@ -3,6 +3,7 @@ Changelog for the `singletons-base` project 3.2 [????.??.??] ---------------- +* Require building with GHC 9.6. * The kinds of the promoted `Error` and `ErrorWithoutStackTrace` functions have been monomorphized to `Symbol`. A previous release generalized the kinds of these arguments to allow passing arguments besides `Symbol`s, but this change diff --git a/singletons-base/README.md b/singletons-base/README.md index 7ce1beff..685facc4 100644 --- a/singletons-base/README.md +++ b/singletons-base/README.md @@ -18,7 +18,7 @@ that code with `singletons-base`. `singletons-base` uses code that relies on bleeding-edge GHC language extensions. As such, `singletons-base` only supports the latest major version -of GHC (currently GHC 9.4). For more information, +of GHC (currently GHC 9.6). For more information, consult the `singletons` [`README`](https://github.com/goldfirere/singletons/blob/master/README.md). diff --git a/singletons-base/singletons-base.cabal b/singletons-base/singletons-base.cabal index 251062b3..29ccff2a 100644 --- a/singletons-base/singletons-base.cabal +++ b/singletons-base/singletons-base.cabal @@ -8,7 +8,7 @@ author: Richard Eisenberg , Jan Stolarek bug-reports: https://github.com/goldfirere/singletons/issues stability: experimental -tested-with: GHC == 9.4.1 +tested-with: GHC == 9.6.1 extra-source-files: README.md, CHANGES.md, tests/README.md, tests/compile-and-dump/GradingClient/*.hs, tests/compile-and-dump/InsertionSort/*.hs, @@ -38,7 +38,7 @@ description: . @singletons-base@ uses code that relies on bleeding-edge GHC language extensions. As such, @singletons-base@ only supports the latest major version - of GHC (currently GHC 9.4). For more information, + of GHC (currently GHC 9.6). For more information, consult the @singletons@ @@. . @@ -65,20 +65,20 @@ source-repository head custom-setup setup-depends: - base >= 4.17 && < 4.18, - Cabal >= 3.0 && < 3.9, + base >= 4.18 && < 4.19, + Cabal >= 3.0 && < 3.11, directory >= 1, filepath >= 1.3 library hs-source-dirs: src - build-depends: base >= 4.17 && < 4.18, + build-depends: base >= 4.18 && < 4.19, pretty, singletons == 3.0.*, singletons-th >= 3.2 && < 3.3, - template-haskell >= 2.19 && < 2.20, + template-haskell >= 2.20 && < 2.21, text >= 1.2, - th-desugar >= 1.14 && < 1.15 + th-desugar >= 1.15 && < 1.16 default-language: GHC2021 other-extensions: TemplateHaskell exposed-modules: Data.Singletons.Base.CustomStar @@ -155,7 +155,7 @@ test-suite singletons-base-test-suite main-is: SingletonsBaseTestSuite.hs other-modules: SingletonsBaseTestSuiteUtils - build-depends: base >= 4.17 && < 4.18, + build-depends: base >= 4.18 && < 4.19, bytestring >= 0.10.9, deepseq >= 1.4.4, filepath >= 1.3, diff --git a/singletons-th/CHANGES.md b/singletons-th/CHANGES.md index fd985da8..b4069fbc 100644 --- a/singletons-th/CHANGES.md +++ b/singletons-th/CHANGES.md @@ -3,6 +3,7 @@ Changelog for the `singletons-th` project 3.2 [????.??.??] ---------------- +* Require building with GHC 9.6. * Derived `POrd` and `SOrd` instances (arising from a use of `deriving Ord`) now use `(<>) @Ordering` in their implementations instead of the custom `thenCmp :: Ordering -> Ordering -> Ordering` function. While most code will diff --git a/singletons-th/README.md b/singletons-th/README.md index 306a5f9d..0b832ebb 100644 --- a/singletons-th/README.md +++ b/singletons-th/README.md @@ -14,7 +14,7 @@ which describes how promotion works in greater detail. `singletons-th` generates code that relies on bleeding-edge GHC language extensions. As such, `singletons-th` only supports the latest major version -of GHC (currently GHC 9.4). For more information, +of GHC (currently GHC 9.6). For more information, consult the `singletons` [`README`](https://github.com/goldfirere/singletons/blob/master/README.md). diff --git a/singletons-th/singletons-th.cabal b/singletons-th/singletons-th.cabal index 67fc6920..a1e7b736 100644 --- a/singletons-th/singletons-th.cabal +++ b/singletons-th/singletons-th.cabal @@ -8,7 +8,7 @@ author: Richard Eisenberg , Jan Stolarek bug-reports: https://github.com/goldfirere/singletons/issues stability: experimental -tested-with: GHC == 9.4.1 +tested-with: GHC == 9.6.1 extra-source-files: README.md, CHANGES.md license: BSD3 license-file: LICENSE @@ -26,7 +26,7 @@ description: . @singletons-th@ generates code that relies on bleeding-edge GHC language extensions. As such, @singletons-th@ only supports the latest major version - of GHC (currently GHC 9.4). For more information, + of GHC (currently GHC 9.6). For more information, consult the @singletons@ @@. . @@ -52,14 +52,14 @@ source-repository head library hs-source-dirs: src - build-depends: base >= 4.17 && < 4.18, + build-depends: base >= 4.18 && < 4.19, containers >= 0.5, mtl >= 2.2.1 && < 2.4, ghc-boot-th, singletons == 3.0.*, syb >= 0.4, - template-haskell >= 2.19 && < 2.20, - th-desugar >= 1.14 && < 1.15, + template-haskell >= 2.20 && < 2.21, + th-desugar >= 1.15 && < 1.16, th-orphans >= 0.13.11 && < 0.14, transformers >= 0.5.2 default-language: GHC2021 diff --git a/singletons/singletons.cabal b/singletons/singletons.cabal index 3911c370..c0fbf11f 100644 --- a/singletons/singletons.cabal +++ b/singletons/singletons.cabal @@ -15,8 +15,9 @@ tested-with: GHC == 8.0.2 , GHC == 8.8.4 , GHC == 8.10.7 , GHC == 9.0.2 - , GHC == 9.2.4 - , GHC == 9.4.1 + , GHC == 9.2.7 + , GHC == 9.4.4 + , GHC == 9.6.1 , GHCJS==8.4 extra-source-files: README.md, CHANGES.md license: BSD3 @@ -58,7 +59,7 @@ source-repository head library hs-source-dirs: src - build-depends: base >= 4.9 && < 4.18 + build-depends: base >= 4.9 && < 4.19 default-language: Haskell2010 exposed-modules: Data.Singletons Data.Singletons.Decide @@ -75,5 +76,5 @@ test-suite singletons-test-suite other-modules: ByHand ByHand2 - build-depends: base >= 4.9 && < 4.18, + build-depends: base >= 4.9 && < 4.19, singletons