From b14d102f319fd4733415be15af734c85b9194456 Mon Sep 17 00:00:00 2001 From: Li-yao Xia Date: Thu, 28 Aug 2025 18:08:39 +0200 Subject: [PATCH 1/4] cabal: Update maintainer --- StrictCheck.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/StrictCheck.cabal b/StrictCheck.cabal index 512b361..8ea5a67 100644 --- a/StrictCheck.cabal +++ b/StrictCheck.cabal @@ -11,7 +11,7 @@ homepage: https://github.com/kwf/StrictCheck#readme license: MIT license-file: LICENSE author: Kenneth Foner, Hengchu Zhang, and Leo Lampropoulos -maintainer: kwf@very.science +maintainer: lysxia@gmail.com copyright: (c) 2018 Kenneth Foner, Hengchu Zhang, and Leo Lampropoulos category: Testing build-type: Simple From cfd31af1b38eafde048798bb9d17fb4b08b940ce Mon Sep 17 00:00:00 2001 From: Li-yao Xia Date: Thu, 28 Aug 2025 18:25:42 +0200 Subject: [PATCH 2/4] ci: Add Gitub Actions script --- .github/workflows/haskell-ci.yml | 214 +++++++++++++++++++++++++++++++ StrictCheck.cabal | 3 +- cabal.haskell-ci | 1 + 3 files changed, 217 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/haskell-ci.yml create mode 100644 cabal.haskell-ci diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml new file mode 100644 index 0000000..d52cdc0 --- /dev/null +++ b/.github/workflows/haskell-ci.yml @@ -0,0 +1,214 @@ +# This GitHub workflow config has been generated by a script via +# +# haskell-ci 'github' 'StrictCheck.cabal' +# +# To regenerate the script (for example after adjusting tested-with) run +# +# haskell-ci regenerate +# +# For more information, see https://github.com/haskell-CI/haskell-ci +# +# version: 0.19.20250821 +# +# REGENDATA ("0.19.20250821",["github","StrictCheck.cabal"]) +# +name: Haskell-CI +on: + push: + branches: + - master + pull_request: + branches: + - master +jobs: + linux: + name: Haskell-CI - Linux - ${{ matrix.compiler }} + runs-on: ubuntu-24.04 + timeout-minutes: + 60 + container: + image: buildpack-deps:jammy + continue-on-error: ${{ matrix.allow-failure }} + strategy: + matrix: + include: + - compiler: ghc-9.12.2 + compilerKind: ghc + compilerVersion: 9.12.2 + setup-method: ghcup + allow-failure: false + - compiler: ghc-9.6.7 + compilerKind: ghc + compilerVersion: 9.6.7 + setup-method: ghcup + allow-failure: false + - compiler: ghc-9.2.8 + compilerKind: ghc + compilerVersion: 9.2.8 + setup-method: ghcup + allow-failure: false + fail-fast: false + steps: + - name: apt-get install + run: | + apt-get update + apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5 + - name: Install GHCup + run: | + mkdir -p "$HOME/.ghcup/bin" + curl -sL https://downloads.haskell.org/ghcup/0.1.50.1/x86_64-linux-ghcup-0.1.50.1 > "$HOME/.ghcup/bin/ghcup" + chmod a+x "$HOME/.ghcup/bin/ghcup" + - name: Install cabal-install + run: | + "$HOME/.ghcup/bin/ghcup" install cabal 3.16.0.0 || (cat "$HOME"/.ghcup/logs/*.* && false) + echo "CABAL=$HOME/.ghcup/bin/cabal-3.16.0.0 -vnormal+nowrap" >> "$GITHUB_ENV" + - name: Install GHC (GHCup) + if: matrix.setup-method == 'ghcup' + run: | + "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false) + HC=$("$HOME/.ghcup/bin/ghcup" whereis ghc "$HCVER") + HCPKG=$(echo "$HC" | sed 's#ghc$#ghc-pkg#') + HADDOCK=$(echo "$HC" | sed 's#ghc$#haddock#') + echo "HC=$HC" >> "$GITHUB_ENV" + echo "HCPKG=$HCPKG" >> "$GITHUB_ENV" + echo "HADDOCK=$HADDOCK" >> "$GITHUB_ENV" + env: + HCKIND: ${{ matrix.compilerKind }} + HCNAME: ${{ matrix.compiler }} + HCVER: ${{ matrix.compilerVersion }} + - name: Set PATH and environment variables + run: | + echo "$HOME/.cabal/bin" >> $GITHUB_PATH + echo "LANG=C.UTF-8" >> "$GITHUB_ENV" + echo "CABAL_DIR=$HOME/.cabal" >> "$GITHUB_ENV" + echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV" + 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" + echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV" + env: + HCKIND: ${{ matrix.compilerKind }} + HCNAME: ${{ matrix.compiler }} + HCVER: ${{ matrix.compilerVersion }} + - name: env + run: | + env + - name: write cabal config + run: | + mkdir -p $CABAL_DIR + cat >> $CABAL_CONFIG <> $CABAL_CONFIG < cabal-plan.xz + echo 'f62ccb2971567a5f638f2005ad3173dba14693a45154c1508645c52289714cb2 cabal-plan.xz' | sha256sum -c - + xz -d < cabal-plan.xz > $HOME/.cabal/bin/cabal-plan + rm -f cabal-plan.xz + chmod a+x $HOME/.cabal/bin/cabal-plan + cabal-plan --version + - name: checkout + uses: actions/checkout@v4 + with: + path: source + - name: initial cabal.project for sdist + run: | + touch cabal.project + echo "packages: $GITHUB_WORKSPACE/source/." >> cabal.project + cat cabal.project + - name: sdist + run: | + mkdir -p sdist + $CABAL sdist all --output-dir $GITHUB_WORKSPACE/sdist + - name: unpack + run: | + mkdir -p unpacked + find sdist -maxdepth 1 -type f -name '*.tar.gz' -exec tar -C $GITHUB_WORKSPACE/unpacked -xzvf {} \; + - name: generate cabal.project + run: | + PKGDIR_StrictCheck="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/StrictCheck-[0-9.]*')" + echo "PKGDIR_StrictCheck=${PKGDIR_StrictCheck}" >> "$GITHUB_ENV" + rm -f cabal.project cabal.project.local + touch cabal.project + touch cabal.project.local + echo "packages: ${PKGDIR_StrictCheck}" >> cabal.project + echo "package StrictCheck" >> cabal.project + echo " ghc-options: -Werror=missing-methods -Werror=missing-fields" >> cabal.project + if [ $((HCNUMVER >= 90600)) -ne 0 ] ; then echo "package StrictCheck" >> cabal.project ; fi + if [ $((HCNUMVER >= 90600)) -ne 0 ] ; then echo " ghc-options: -Werror=unused-packages" >> cabal.project ; fi + echo "package StrictCheck" >> cabal.project + echo " ghc-options: -Werror=incomplete-patterns -Werror=incomplete-uni-patterns" >> cabal.project + cat >> cabal.project <> cabal.project.local + cat cabal.project + cat cabal.project.local + - name: dump install plan + run: | + $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all + cabal-plan + - name: restore cache + uses: actions/cache/restore@v4 + with: + key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }} + path: ~/.cabal/store + restore-keys: ${{ runner.os }}-${{ matrix.compiler }}- + - name: install dependencies + run: | + $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --dependencies-only -j2 all + $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dependencies-only -j2 all + - name: build w/o tests + run: | + $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all + - name: build + run: | + $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --write-ghc-environment-files=always + - name: tests + run: | + $CABAL v2-test $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --test-show-details=direct + - name: cabal check + run: | + cd ${PKGDIR_StrictCheck} || false + ${CABAL} -vnormal check + - name: haddock + run: | + $CABAL v2-haddock --disable-documentation --haddock-all $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all + - name: unconstrained build + run: | + rm -f cabal.project.local + $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all + - name: save cache + if: always() + uses: actions/cache/save@v4 + with: + key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }} + path: ~/.cabal/store diff --git a/StrictCheck.cabal b/StrictCheck.cabal index 8ea5a67..2f98abb 100644 --- a/StrictCheck.cabal +++ b/StrictCheck.cabal @@ -17,6 +17,7 @@ category: Testing build-type: Simple cabal-version: >=1.10 extra-source-files: README.md +tested-with: GHC == 9.12.2, GHC == 9.6.7, GHC == 9.2.8 source-repository this type: git @@ -32,7 +33,7 @@ library containers >= 0.5 && < 0.9, generics-sop >= 0.3.2 && < 0.6, bifunctors >= 5.5 && < 5.7, - template-haskell >= 2.12 && < 2.24 + template-haskell >= 2.18 && < 2.24 exposed-modules: Test.StrictCheck Test.StrictCheck.Curry, Test.StrictCheck.Consume, diff --git a/cabal.haskell-ci b/cabal.haskell-ci new file mode 100644 index 0000000..e1f1b77 --- /dev/null +++ b/cabal.haskell-ci @@ -0,0 +1 @@ +branches: master From 0f859e53cd30393529558b23932c3a5d7e21f526 Mon Sep 17 00:00:00 2001 From: Li-yao Xia Date: Thu, 28 Aug 2025 18:33:37 +0200 Subject: [PATCH 3/4] Resolve some warnings about incomplete patterns --- src/Test/StrictCheck/Produce.hs | 6 +++--- src/Test/StrictCheck/TH.hs | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Test/StrictCheck/Produce.hs b/src/Test/StrictCheck/Produce.hs index 1b449ee..36f1317 100644 --- a/src/Test/StrictCheck/Produce.hs +++ b/src/Test/StrictCheck/Produce.hs @@ -167,9 +167,9 @@ draws inputs = go [inputs] pick :: [a] -> Gen (a, [a]) pick as = do index <- choose (0, length as - 1) - let (before, picked : after) = splitAt index as - return (picked, before ++ after) - + case splitAt index as of + (before, picked : after) -> return (picked, before ++ after) + _ -> error "pick: empty list" --------------------------------------------- diff --git a/src/Test/StrictCheck/TH.hs b/src/Test/StrictCheck/TH.hs index 4e1effb..6c579c1 100644 --- a/src/Test/StrictCheck/TH.hs +++ b/src/Test/StrictCheck/TH.hs @@ -75,13 +75,13 @@ constructor2PatternDec ty idx (NormalC conName argTypes) = do constructor2PatternDec ty idx (InfixC argType1 conName argType2) = do let argTypes = [argType1, argType2] (npPat, names) <- productPattern (map snd argTypes) - when (length names /= 2) $ - reportError "The impossible happened: Infix Pattern have more than 2 binders" - let nm1 : nm2 : _ = names - return - ( PatSynSigD patDecName (patternTypeDec (map snd argTypes) ty), - infixPatternDec idx patDecName nm1 nm2 npPat - ) + case names of + nm1 : nm2 : [] -> + return + ( PatSynSigD patDecName (patternTypeDec (map snd argTypes) ty), + infixPatternDec idx patDecName nm1 nm2 npPat + ) + _ -> fail "The impossible happened: Infix Pattern have more than 2 binders" where patDecName = mkName (nameBase conName ++ "%") constructor2PatternDec _ _ _ = From cc1f521f197bdee54f0eda4d0abd68acdebe404d Mon Sep 17 00:00:00 2001 From: Li-yao Xia Date: Thu, 28 Aug 2025 18:40:55 +0200 Subject: [PATCH 4/4] cabal: Remove unused test dependencies --- StrictCheck.cabal | 3 --- 1 file changed, 3 deletions(-) diff --git a/StrictCheck.cabal b/StrictCheck.cabal index 2f98abb..710733b 100644 --- a/StrictCheck.cabal +++ b/StrictCheck.cabal @@ -80,8 +80,5 @@ test-suite test-strictcheck PatternSynonyms ghc-options: -Wall -fno-warn-unused-imports -O2 build-depends: base, - HUnit, - generics-sop, - deepseq, StrictCheck, QuickCheck