From 0f7093078d44d88d14a7bf0476e4f55727d27d21 Mon Sep 17 00:00:00 2001 From: Teo Camarasu Date: Wed, 30 Oct 2024 17:24:44 +0000 Subject: [PATCH 1/2] Relax bounds --- json-sop.cabal | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/json-sop.cabal b/json-sop.cabal index 91fb3a3..0479ae2 100644 --- a/json-sop.cabal +++ b/json-sop.cabal @@ -23,17 +23,17 @@ library exposed-modules: Generics.SOP.JSON Generics.SOP.JSON.Model other-modules: Generics.SOP.Util.PartialResult - build-depends: base >= 4.11 && < 4.19, + build-depends: base >= 4.11 && < 4.21, generics-sop >= 0.2.3 && < 0.6, -- lens-sop changed API in 0.3 lens-sop >= 0.3 && < 0.4, tagged >= 0.7 && < 0.9, - aeson >= 1.4 && < 2.2, + aeson >= 1.4 && < 2.3, vector >= 0.10 && < 0.14, - text >= 1.1 && < 2.1, + text >= 1.1 && < 2.2, unordered-containers >= 0.2 && < 0.3, - time >= 1.4 && < 1.14, + time >= 1.4 && < 1.15, transformers >= 0.3 && < 0.7 hs-source-dirs: src default-language: Haskell2010 From 46e2ed4bbee177d56075b6a258781b94600661f1 Mon Sep 17 00:00:00 2001 From: Edsko de Vries Date: Thu, 31 Oct 2024 09:00:15 +0100 Subject: [PATCH 2/2] Update `tested-with`, CI, fix warnings --- .github/workflows/haskell-ci.yml | 96 ++++++++++++-------------- cabal.haskell-ci | 1 + json-sop.cabal | 9 ++- src/Generics/SOP/Util/PartialResult.hs | 7 +- 4 files changed, 55 insertions(+), 58 deletions(-) create mode 100644 cabal.haskell-ci diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index e160eec..7af8e2a 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -8,14 +8,18 @@ # # For more information, see https://github.com/haskell-CI/haskell-ci # -# version: 0.15.20230217 +# version: 0.19.20240708 # -# REGENDATA ("0.15.20230217",["github","cabal.project"]) +# REGENDATA ("0.19.20240708",["github","cabal.project"]) # name: Haskell-CI on: - - push - - pull_request + push: + branches: + - master + pull_request: + branches: + - master jobs: linux: name: Haskell-CI - Linux - ${{ matrix.compiler }} @@ -23,35 +27,40 @@ jobs: timeout-minutes: 60 container: - image: buildpack-deps:bionic + image: buildpack-deps:jammy continue-on-error: ${{ matrix.allow-failure }} strategy: matrix: include: - - compiler: ghc-9.4.4 + - compiler: ghc-9.10.1 compilerKind: ghc - compilerVersion: 9.4.4 + compilerVersion: 9.10.1 setup-method: ghcup allow-failure: false - - compiler: ghc-9.2.5 + - compiler: ghc-9.8.2 compilerKind: ghc - compilerVersion: 9.2.5 + compilerVersion: 9.8.2 setup-method: ghcup allow-failure: false - - compiler: ghc-9.0.2 + - compiler: ghc-9.6.6 compilerKind: ghc - compilerVersion: 9.0.2 + compilerVersion: 9.6.6 setup-method: ghcup allow-failure: false - - compiler: ghc-8.10.7 + - compiler: ghc-9.4.8 compilerKind: ghc - compilerVersion: 8.10.7 + compilerVersion: 9.4.8 + setup-method: ghcup + allow-failure: false + - compiler: ghc-9.2.8 + compilerKind: ghc + compilerVersion: 9.2.8 setup-method: ghcup allow-failure: false - - compiler: ghc-8.8.4 + - compiler: ghc-8.10.7 compilerKind: ghc - compilerVersion: 8.8.4 - setup-method: hvr-ppa + compilerVersion: 8.10.7 + setup-method: ghcup allow-failure: false fail-fast: false steps: @@ -59,23 +68,11 @@ jobs: run: | apt-get update apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5 - if [ "${{ matrix.setup-method }}" = ghcup ]; then - 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.9.0.0 || (cat "$HOME"/.ghcup/logs/*.* && false) - else - apt-add-repository -y 'ppa:hvr/ghc' - apt-get update - apt-get install -y "$HCNAME" - 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 cabal 3.9.0.0 || (cat "$HOME"/.ghcup/logs/*.* && false) - fi + mkdir -p "$HOME/.ghcup/bin" + curl -sL https://downloads.haskell.org/ghcup/0.1.30.0/x86_64-linux-ghcup-0.1.30.0 > "$HOME/.ghcup/bin/ghcup" + chmod a+x "$HOME/.ghcup/bin/ghcup" + "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false) + "$HOME/.ghcup/bin/ghcup" install cabal 3.12.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false) env: HCKIND: ${{ matrix.compilerKind }} HCNAME: ${{ matrix.compiler }} @@ -87,20 +84,13 @@ jobs: echo "CABAL_DIR=$HOME/.cabal" >> "$GITHUB_ENV" echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV" HCDIR=/opt/$HCKIND/$HCVER - if [ "${{ matrix.setup-method }}" = ghcup ]; then - HC=$HOME/.ghcup/bin/$HCKIND-$HCVER - 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.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.9.0.0 -vnormal+nowrap" >> "$GITHUB_ENV" - fi - + 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" + echo "CABAL=$HOME/.ghcup/bin/cabal-3.12.1.0 -vnormal+nowrap" >> "$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" @@ -150,14 +140,14 @@ jobs: - name: install cabal-plan run: | mkdir -p $HOME/.cabal/bin - curl -sL https://github.com/haskell-hvr/cabal-plan/releases/download/v0.6.2.0/cabal-plan-0.6.2.0-x86_64-linux.xz > cabal-plan.xz - echo 'de73600b1836d3f55e32d80385acc055fd97f60eaa0ab68a755302685f5d81bc cabal-plan.xz' | sha256sum -c - + curl -sL https://github.com/haskell-hvr/cabal-plan/releases/download/v0.7.3.0/cabal-plan-0.7.3.0-x86_64-linux.xz > 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@v3 + uses: actions/checkout@v4 with: path: source - name: initial cabal.project for sdist @@ -185,7 +175,7 @@ jobs: echo " ghc-options: -Werror=missing-methods" >> cabal.project cat >> cabal.project <> cabal.project.local + $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(json-sop)$/; }' >> cabal.project.local cat cabal.project cat cabal.project.local - name: dump install plan @@ -193,7 +183,7 @@ jobs: $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all cabal-plan - name: restore cache - uses: actions/cache/restore@v3 + uses: actions/cache/restore@v4 with: key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }} path: ~/.cabal/store @@ -223,7 +213,7 @@ jobs: rm -f cabal.project.local $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all - name: save cache - uses: actions/cache/save@v3 + uses: actions/cache/save@v4 if: always() with: key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }} 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 diff --git a/json-sop.cabal b/json-sop.cabal index 0479ae2..b5499bb 100644 --- a/json-sop.cabal +++ b/json-sop.cabal @@ -1,5 +1,5 @@ name: json-sop -version: 0.2.2 +version: 0.2.3 synopsis: Generics JSON (de)serialization using generics-sop description: This library contains generic serialization and deserialization functions @@ -13,7 +13,12 @@ maintainer: andres@well-typed.com category: Generics build-type: Simple cabal-version: >=1.10 -tested-with: GHC ==8.8.4 || ==8.10.7 || ==9.0.2 || ==9.2.5 || ==9.4.4 +tested-with: GHC==8.10.7 + , GHC==9.2.8 + , GHC==9.4.8 + , GHC==9.6.6 + , GHC==9.8.2 + , GHC==9.10.1 source-repository head type: git diff --git a/src/Generics/SOP/Util/PartialResult.hs b/src/Generics/SOP/Util/PartialResult.hs index 749902d..f8b2309 100644 --- a/src/Generics/SOP/Util/PartialResult.hs +++ b/src/Generics/SOP/Util/PartialResult.hs @@ -10,6 +10,7 @@ module Generics.SOP.Util.PartialResult ( import Control.Applicative import Control.Monad import Control.Monad.Trans.Class +import Data.Kind -- | Repeat f zero or more times -- @@ -22,7 +23,7 @@ import Control.Monad.Trans.Class -- try any more parsers for other constructors even if the parser for T1 -- now fails in parsing the arguments of T1. Instead, we want to give the -- error message about attempting to parse T1. -data Partial (f :: * -> *) (a :: *) = +data Partial (f :: Type -> Type) (a :: Type) = Fail [String] | PZero a | PSucc (f (Partial f a)) @@ -36,7 +37,7 @@ instance Functor f => Functor (Partial f) where fmap f (PSucc pa) = PSucc (fmap (fmap f) pa) instance Functor f => Monad (Partial f) where - return = PZero + return = pure #if !MIN_VERSION_base(4,13,0) fail = Fail . return #endif @@ -66,7 +67,7 @@ instance MonadTrans Partial where lift ma = PSucc (PZero `liftM` ma) instance Functor f => Applicative (Partial f) where - pure = return + pure = PZero f <*> a = do f' <- f ; a' <- a ; return (f' a') instance (MonadPlus f, Functor f) => Alternative (Partial f) where