diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index 60b090e..0fbac67 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.16.6 +# version: 0.17.20231010 # -# REGENDATA ("0.16.6",["github","--config=cabal.haskell-ci","cabal.project"]) +# REGENDATA ("0.17.20231010",["github","--config=cabal.haskell-ci","cabal.project"]) # name: Haskell-CI on: @@ -28,6 +28,11 @@ jobs: strategy: matrix: include: + - compiler: ghc-9.8.1 + compilerKind: ghc + compilerVersion: 9.8.1 + setup-method: ghcup + allow-failure: false - compiler: ghc-9.6.2 compilerKind: ghc compilerVersion: 9.6.2 @@ -116,7 +121,7 @@ jobs: 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.2/x86_64-linux-ghcup-0.1.19.2 > "$HOME/.ghcup/bin/ghcup" + 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) @@ -125,7 +130,7 @@ jobs: apt-get update apt-get install -y "$HCNAME" mkdir -p "$HOME/.ghcup/bin" - curl -sL https://downloads.haskell.org/ghcup/0.1.19.2/x86_64-linux-ghcup-0.1.19.2 > "$HOME/.ghcup/bin/ghcup" + 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 @@ -141,10 +146,12 @@ jobs: echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV" HCDIR=/opt/$HCKIND/$HCVER if [ "${{ matrix.setup-method }}" = ghcup ]; then - HC=$HOME/.ghcup/bin/$HCKIND-$HCVER + 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=$HOME/.ghcup/bin/$HCKIND-pkg-$HCVER" >> "$GITHUB_ENV" - echo "HADDOCK=$HOME/.ghcup/bin/haddock-$HCVER" >> "$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 diff --git a/CHANGES.markdown b/CHANGES.markdown index b75d6c0..82f99e9 100644 --- a/CHANGES.markdown +++ b/CHANGES.markdown @@ -1,3 +1,8 @@ +## Changes in next [????.??.??] + - Backport new instances from GHC 9.8/`base-4.19`: + * `Eq` and `Ord` instances for `SChar`, `SNat`, and `SSymbol` + * `Enum`, `Bounded`, `Num`, `Real`, and `Integral` instances for `Compose` + ## Changes in 0.9.0 [2023.03.05] - Adapt to recent changes to `Down` instances: * The `Bounded` instance for `Down` was changed in `base-4.15.0.0` to swap diff --git a/README.markdown b/README.markdown index c18d1c3..a7ed79a 100644 --- a/README.markdown +++ b/README.markdown @@ -57,8 +57,10 @@ To use `base-orphans`, simply `import Data.Orphans ()`. * `Eq`, `Ord`, `Read`, and `Show` instances for data types in `GHC.Generics` * `Eq`, `Ord`, `Bounded`, `Enum`, and `Ix` instances for `Solo` * `Eq` and `Ord` instances for `Generically1` + * `Eq` and `Ord` instances for `SChar`, `SNat`, and `SSymbol` * `Eq1`, `Read1`, and `Show1` instances for `Complex` * `Eq1`, `Ord1`, `Read1`, and `Show1` instances for `NonEmpty` + * `Enum`, `Bounded`, `Num`, `Real`, and `Integral` instances for `Compose` * `Foldable` instance for `Either`, `(,)` and `Const` * `Foldable` and `Traversable` instances for `Alt` from `Data.Monoid` * `Functor`, `Applicative`, and `Monad` instances for @@ -104,6 +106,7 @@ To use `base-orphans`, simply `import Data.Orphans ()`. ## Supported versions of GHC/`base` + * `ghc-9.8.*` / `base-4.19.*` * `ghc-9.6.*` / `base-4.18.*` * `ghc-9.4.*` / `base-4.17.*` * `ghc-9.2.*` / `base-4.16.*` diff --git a/base-orphans.cabal b/base-orphans.cabal index 621480d..1628d33 100644 --- a/base-orphans.cabal +++ b/base-orphans.cabal @@ -4,7 +4,7 @@ cabal-version: 1.12 -- -- see: https://github.com/sol/hpack -- --- hash: da3031e39b0331888e834742d92bbce742fe2f0f3f5e1f32fe3668cc0677a5f5 +-- hash: 965bea20bba9f60facd602dae11eb6a09f80edf0af89cc4449270263e67ae367 name: base-orphans version: 0.9.0 @@ -36,7 +36,7 @@ license: MIT license-file: LICENSE build-type: Simple tested-with: - GHC == 7.0.4 , GHC == 7.2.2 , GHC == 7.4.2 , GHC == 7.6.3 , GHC == 7.8.4 , GHC == 7.10.3 , GHC == 8.0.2 , GHC == 8.2.2 , GHC == 8.4.4 , GHC == 8.6.5 , GHC == 8.8.4 , GHC == 8.10.7 , GHC == 9.0.2 , GHC == 9.2.8 , GHC == 9.4.5 , GHC == 9.6.2 + GHC == 7.0.4 , GHC == 7.2.2 , GHC == 7.4.2 , GHC == 7.6.3 , GHC == 7.8.4 , GHC == 7.10.3 , GHC == 8.0.2 , GHC == 8.2.2 , GHC == 8.4.4 , GHC == 8.6.5 , GHC == 8.8.4 , GHC == 8.10.7 , GHC == 9.0.2 , GHC == 9.2.8 , GHC == 9.4.5 , GHC == 9.6.2 , GHC == 9.8.1 extra-source-files: CHANGES.markdown README.markdown diff --git a/package.yaml b/package.yaml index 4b3dfcc..c41144c 100644 --- a/package.yaml +++ b/package.yaml @@ -43,6 +43,7 @@ tested-with: GHC == 7.0.4 , GHC == 9.2.8 , GHC == 9.4.5 , GHC == 9.6.2 + , GHC == 9.8.1 extra-source-files: - CHANGES.markdown diff --git a/src/Data/Orphans.hs b/src/Data/Orphans.hs index 1f539af..eee3349 100644 --- a/src/Data/Orphans.hs +++ b/src/Data/Orphans.hs @@ -94,7 +94,7 @@ import GHC.ConsoleHandler as Console # endif #endif -#if !(MIN_VERSION_base(4,18,0)) +#if !(MIN_VERSION_base(4,19,0)) import Data.Orphans.Prelude #endif @@ -2006,6 +2006,50 @@ instance (Generic1 f, Ord (Rep1 f a)) => Ord (Generically1 f a) where # endif #endif +#if !(MIN_VERSION_base(4,19,0)) +# if MIN_VERSION_base(4,9,0) +deriving instance Enum (f (g a)) => Enum (Compose f g a) +deriving instance Bounded (f (g a)) => Bounded (Compose f g a) +deriving instance Num (f (g a)) => Num (Compose f g a) + +-- In base-4.18.0.0, the Ord instance for Compose was simplified to: +-- +-- instance Ord (f (g a)) => Ord (Compose f g a) +-- +-- Before that, the Ord instance was defined as: +-- +-- instance (Ord1 f, Ord1 g, Ord a) => Ord (Compose f g a) +-- +-- This makes deriving Real and Integral instances slightly more complicated for +-- these older versions of base, as there are no Real1 or Integral1 classes. We +-- opt for making the instance contexts more complicated instead. +# if MIN_VERSION_base(4,18,0) +deriving instance Real (f (g a)) => Real (Compose f g a) +deriving instance Integral (f (g a)) => Integral (Compose f g a) +# else +deriving instance (Real (f (g a)), Ord1 f, Ord1 g, Ord a) => Real (Compose f g a) +deriving instance (Integral (f (g a)), Ord1 f, Ord1 g, Ord a) => Integral (Compose f g a) +# endif +# endif + +# if MIN_VERSION_base(4,18,0) +instance Eq (SChar c) where + _ == _ = True +instance Ord (SChar c) where + compare _ _ = EQ + +instance Eq (SNat n) where + _ == _ = True +instance Ord (SNat n) where + compare _ _ = EQ + +instance Eq (SSymbol s) where + _ == _ = True +instance Ord (SSymbol s) where + compare _ _ = EQ +# endif +#endif + #if __GLASGOW_HASKELL__ < 710 deriving instance Typeable All deriving instance Typeable AnnotationWrapper diff --git a/src/Data/Orphans/Prelude.hs b/src/Data/Orphans/Prelude.hs index 8576ce6..13e011a 100644 --- a/src/Data/Orphans/Prelude.hs +++ b/src/Data/Orphans/Prelude.hs @@ -21,7 +21,7 @@ This makes it much easier to be -Wall-compliant. Note that this module does not export any modules that could introduce name clashes. -} module Data.Orphans.Prelude -#if MIN_VERSION_base(4,18,0) +#if MIN_VERSION_base(4,19,0) () where #else ( module OrphansPrelude