diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index 894eff3..30bce63 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.17.20231010 +# version: 0.19.20240512 # -# REGENDATA ("0.17.20231010",["github","cabal.project"]) +# REGENDATA ("0.19.20240512",["github","cabal.project"]) # name: Haskell-CI on: @@ -27,14 +27,19 @@ 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.8.1 + - compiler: ghc-9.10.1 compilerKind: ghc - compilerVersion: 9.8.1 + compilerVersion: 9.10.1 + setup-method: ghcup + allow-failure: false + - compiler: ghc-9.8.2 + compilerKind: ghc + compilerVersion: 9.8.2 setup-method: ghcup allow-failure: false - compiler: ghc-9.6.3 @@ -65,57 +70,12 @@ jobs: - compiler: ghc-8.8.4 compilerKind: ghc compilerVersion: 8.8.4 - setup-method: hvr-ppa + setup-method: ghcup allow-failure: false - compiler: ghc-8.6.5 compilerKind: ghc compilerVersion: 8.6.5 - setup-method: hvr-ppa - allow-failure: false - - compiler: ghc-8.4.4 - compilerKind: ghc - compilerVersion: 8.4.4 - setup-method: hvr-ppa - allow-failure: false - - compiler: ghc-8.2.2 - compilerKind: ghc - compilerVersion: 8.2.2 - setup-method: hvr-ppa - allow-failure: false - - compiler: ghc-8.0.2 - compilerKind: ghc - compilerVersion: 8.0.2 - setup-method: hvr-ppa - allow-failure: false - - compiler: ghc-7.10.3 - compilerKind: ghc - compilerVersion: 7.10.3 - setup-method: hvr-ppa - allow-failure: false - - compiler: ghc-7.8.4 - compilerKind: ghc - compilerVersion: 7.8.4 - setup-method: hvr-ppa - allow-failure: false - - compiler: ghc-7.6.3 - compilerKind: ghc - compilerVersion: 7.6.3 - setup-method: hvr-ppa - allow-failure: false - - compiler: ghc-7.4.2 - compilerKind: ghc - compilerVersion: 7.4.2 - setup-method: hvr-ppa - allow-failure: false - - compiler: ghc-7.2.2 - compilerKind: ghc - compilerVersion: 7.2.2 - setup-method: hvr-ppa - allow-failure: false - - compiler: ghc-7.0.4 - compilerKind: ghc - compilerVersion: 7.0.4 - setup-method: hvr-ppa + setup-method: ghcup allow-failure: false fail-fast: false steps: @@ -123,21 +83,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.19.5/x86_64-linux-ghcup-0.1.19.5 > "$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.10.1.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.19.5/x86_64-linux-ghcup-0.1.19.5 > "$HOME/.ghcup/bin/ghcup" - chmod a+x "$HOME/.ghcup/bin/ghcup" - "$HOME/.ghcup/bin/ghcup" install cabal 3.10.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false) - fi + mkdir -p "$HOME/.ghcup/bin" + curl -sL https://downloads.haskell.org/ghcup/0.1.20.0/x86_64-linux-ghcup-0.1.20.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.10.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false) env: HCKIND: ${{ matrix.compilerKind }} HCNAME: ${{ matrix.compiler }} @@ -149,22 +99,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/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.10.1.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.10.1.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.10.2.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" @@ -221,7 +162,7 @@ jobs: 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 @@ -245,8 +186,8 @@ jobs: touch cabal.project touch cabal.project.local echo "packages: ${PKGDIR_OneTuple}" >> cabal.project - if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package OneTuple" >> cabal.project ; fi - if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi + echo "package OneTuple" >> cabal.project + echo " ghc-options: -Werror=missing-methods" >> cabal.project cat >> cabal.project <> cabal.project.local @@ -257,7 +198,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 @@ -287,7 +228,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/OneTuple.cabal b/OneTuple.cabal index 1275baf..9784e76 100644 --- a/OneTuple.cabal +++ b/OneTuple.cabal @@ -1,7 +1,6 @@ cabal-version: 1.12 name: OneTuple -version: 0.4.1.1 -x-revision: 1 +version: 0.4.2 synopsis: Singleton Tuple category: Data description: @@ -23,23 +22,15 @@ maintainer: stability: experimental build-type: Simple tested-with: - GHC ==7.0.4 - || ==7.2.2 - || ==7.4.2 - || ==7.6.3 - || ==7.8.4 - || ==7.10.3 - || ==8.0.2 - || ==8.2.2 - || ==8.4.4 - || ==8.6.5 + GHC ==8.6.5 || ==8.8.4 || ==8.10.7 || ==9.0.2 || ==9.2.8 || ==9.4.7 || ==9.6.3 - || ==9.8.1 + || ==9.8.2 + || ==9.10.1 extra-source-files: Changelog.md @@ -56,35 +47,13 @@ library hs-source-dirs: src build-depends: - base >=4.3 && <4.20 + base >=4.12 && <4.21 , template-haskell if impl(ghc >=9.0) build-depends: ghc-prim - else - if impl(ghc >=7.4) - build-depends: hashable >=1.3.5.0 && <1.5 - - else - build-depends: hashable >=1.2.5.0 && <1.3 - - -- generics - if !impl(ghc >=7.6) - build-depends: ghc-prim - - if !impl(ghc >=8.0) - build-depends: - semigroups >=0.18.4 && <0.21 - , transformers >=0.3 && <0.7 - - -- Ensure Data.Functor.Classes is always available - if impl(ghc >=7.10) - build-depends: transformers >=0.4.2.0 - - else - build-depends: transformers-compat >=0.5.1.0 && <0.8 - + build-depends: hashable >=1.3.5.0 && <1.5 if !impl(ghc >=9.0) build-depends: foldable1-classes-compat >=0.1 && <0.2 diff --git a/src/Data/Tuple/Solo.hs b/src/Data/Tuple/Solo.hs index 750b1fe..1814d2b 100644 --- a/src/Data/Tuple/Solo.hs +++ b/src/Data/Tuple/Solo.hs @@ -1,19 +1,8 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE DeriveDataTypeable #-} - -#if __GLASGOW_HASKELL__ >=702 {-# LANGUAGE DeriveGeneric #-} -#endif - -#if __GLASGOW_HASKELL__ >= 708 {-# LANGUAGE PatternSynonyms #-} -#endif - -#if __GLASGOW_HASKELL__ >=704 {-# LANGUAGE Safe #-} -#elif __GLASGOW_HASKELL__ >=702 -{-# LANGUAGE Trustworthy #-} -#endif -- | 'Solo' fills the /tuple gap/ with a singleton tuple. -- @@ -33,14 +22,7 @@ -- Note: on GHC-9.0 'getSolo' is not a record selector. module Data.Tuple.Solo ( -#if __GLASGOW_HASKELL__ >= 800 Solo(MkSolo,Solo), -#elif __GLASGOW_HASKELL__ >= 708 - Solo(MkSolo), - pattern Solo, -#else - Solo(MkSolo), -#endif getSolo, ) where @@ -74,20 +56,6 @@ pattern MkSolo a = Solo a #else -#if MIN_VERSION_base(4,9,0) -#define LIFTED_FUNCTOR_CLASSES 1 -#else -#if MIN_VERSION_transformers(0,5,0) -#define LIFTED_FUNCTOR_CLASSES 1 -#else -#ifdef MIN_VERSION_transformers_compat -#if MIN_VERSION_transformers_compat(0,5,0) && !(MIN_VERSION_transformers(0,4,0)) -#define LIFTED_FUNCTOR_CLASSES 1 -#endif -#endif -#endif -#endif - import Control.Applicative (Applicative (..)) import Control.Monad (ap) import Control.Monad.Fix (MonadFix (..)) @@ -109,41 +77,21 @@ import Data.Hashable (Hashable (..)) import Data.Hashable.Lifted (Hashable1 (..), hashWithSalt1) #endif -#if LIFTED_FUNCTOR_CLASSES -#if MIN_VERSION_base(4,10,0) import Data.Functor.Classes (readData, readUnaryWith, liftReadListDefault, liftReadListPrecDefault) -#else -import Data.Functor.Classes (readsData, readsUnaryWith) -#endif -#endif - -#if MIN_VERSION_base(4,4,0) import GHC.Generics (Generic, Generic1) import Control.Monad.Zip (MonadZip (..)) -#endif -- | Solo is the singleton tuple data type. data Solo a = MkSolo { getSolo :: a } deriving ( Eq,Ord,Bounded,Read,Typeable,Data -#if MIN_VERSION_base(4,4,0) , Generic -#if __GLASGOW_HASKELL__ >=706 , Generic1 -#endif -#endif ) -#if __GLASGOW_HASKELL__ >= 708 -#if __GLASGOW_HASKELL__ >= 710 pattern Solo :: a -> Solo a -#endif pattern Solo a = MkSolo a -#endif - -#if __GLASGOW_HASKELL__ >= 800 {-# COMPLETE Solo #-} -#endif instance Show a => Show (Solo a) where @@ -170,7 +118,6 @@ instance Foldable Solo where foldl1 _f (MkSolo x) = x -- TODO: add rest of the methods -#if MIN_VERSION_base(4,8,0) null _ = False length _ = 1 @@ -180,7 +127,6 @@ instance Foldable Solo where product = getSolo toList (MkSolo a) = [a] -#endif -- | @since 0.4 instance F1.Foldable1 Solo where @@ -205,9 +151,7 @@ instance Applicative Solo where _ *> x = x x <* _ = x -#if MIN_VERSION_base(4,10,0) liftA2 f (Solo x) (Solo y) = Solo (f x y) -#endif instance Monad Solo where return = pure @@ -224,12 +168,9 @@ instance Monoid a => Monoid (Solo a) where instance MonadFix Solo where mfix f = let a = f (getSolo a) in a -#if MIN_VERSION_base(4,4,0) instance MonadZip Solo where mzipWith f (MkSolo a) (MkSolo b) = MkSolo (f a b) -#endif -#ifdef LIFTED_FUNCTOR_CLASSES instance Eq1 Solo where liftEq eq (MkSolo a) (MkSolo b) = a `eq` b @@ -237,26 +178,14 @@ instance Ord1 Solo where liftCompare cmp (MkSolo a) (MkSolo b) = cmp a b instance Read1 Solo where -#if MIN_VERSION_base(4,10,0) liftReadPrec rp _ = readData (readUnaryWith rp "MkSolo" MkSolo) liftReadListPrec = liftReadListPrecDefault liftReadList = liftReadListDefault -#else - liftReadsPrec rp _ = readsData $ readsUnaryWith rp "MkSolo" MkSolo -#endif instance Show1 Solo where liftShowsPrec sp _ d (MkSolo x) = showParen (d > 10) $ showString "MkSolo " . sp 11 x - -#else -instance Eq1 Solo where eq1 = (==) -instance Ord1 Solo where compare1 = compare -instance Read1 Solo where readsPrec1 = readsPrec -instance Show1 Solo where showsPrec1 = showsPrec -#endif - #endif #if !(MIN_VERSION_base(4,15,0))