From 415e4748bf5d38434ae143a3520d3bc6d5c27cdf Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Thu, 17 Oct 2024 22:28:09 +0200 Subject: [PATCH] Drop support for GHC 8.0 and below --- CHANGELOG.md | 7 +++++++ github.cabal | 21 ++++++--------------- samples/Operational/Operational.hs | 2 +- src/GitHub/Data.hs | 2 -- src/GitHub/Data/Name.hs | 5 ----- src/GitHub/Data/RateLimit.hs | 2 +- src/GitHub/Data/Repos.hs | 22 ---------------------- src/GitHub/Data/Request.hs | 1 - src/GitHub/Endpoints/Issues.hs | 2 -- src/GitHub/Endpoints/Repos/Comments.hs | 2 -- src/GitHub/Endpoints/Repos/Commits.hs | 2 -- src/GitHub/Internal/Prelude.hs | 3 +-- 12 files changed, 16 insertions(+), 55 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0926cfee..e090d021 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## Changes for 0.29.1 + +- Drop support for GHC 8.0 and below. +- Drop dependency `time-compat`. + +Tested with GHC 8.2 - 9.10.1. + ## Changes for 0.29 _2023-06-24, Andreas Abel, Midsommar edition_ diff --git a/github.cabal b/github.cabal index eb835470..d4d2d930 100644 --- a/github.cabal +++ b/github.cabal @@ -1,7 +1,6 @@ cabal-version: 2.4 name: github -version: 0.29 -x-revision: 5 +version: 0.29.1 synopsis: Access to the GitHub API, v3. category: Network description: @@ -42,9 +41,6 @@ tested-with: GHC == 8.6.5 GHC == 8.4.4 GHC == 8.2.2 - -- Build failure of HsOpenSSL with GHC 8.0 - -- https://github.com/haskell-cryptography/HsOpenSSL/issues/97 - -- GHC == 8.0.2 extra-doc-files: README.md @@ -66,11 +62,9 @@ library default-language: Haskell2010 ghc-options: -Wall - if impl(ghc >= 8.0) - ghc-options: - -Wcompat - -Wno-star-is-type - -- The star-is-type warning cannot be sensiblity addressed while supporting GHC 7. + -Wcompat + -Wno-star-is-type + -- The star-is-type warning cannot be sensiblity addressed while supporting GHC 7. hs-source-dirs: src default-extensions: DataKinds @@ -188,7 +182,7 @@ library -- Packages bundles with GHC, mtl and text are also here build-depends: - base >=4.7 && <5 + base >=4.10 && <5 , binary >=0.7.1.0 && <0.11 , bytestring >=0.10.4.0 && <0.13 , containers >=0.5.5.1 && <0.8 @@ -196,7 +190,7 @@ library , exceptions >=0.10.2 && <0.11 , mtl >=2.1.3.1 && <2.2 || >=2.2.1 && <2.4 , text >=1.2.0.6 && <2.2 - , time-compat >=1.9.2.2 && <1.10 + , time >=1.8.0.2 && <2 , transformers >=0.3.0.0 && <0.7 -- other packages @@ -229,9 +223,6 @@ library http-client-tls >=0.3.5.3 && <0.4 , tls >=1.4.1 - if !impl(ghc >=8.0) - build-depends: semigroups >=0.18.5 && <0.20 - test-suite github-test default-language: Haskell2010 type: exitcode-stdio-1.0 diff --git a/samples/Operational/Operational.hs b/samples/Operational/Operational.hs index cbfc9fb4..1fc7f897 100644 --- a/samples/Operational/Operational.hs +++ b/samples/Operational/Operational.hs @@ -1,7 +1,7 @@ -{-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE OverloadedStrings #-} + module Main (main) where import Common diff --git a/src/GitHub/Data.hs b/src/GitHub/Data.hs index 20ebe7fd..740c6837 100644 --- a/src/GitHub/Data.hs +++ b/src/GitHub/Data.hs @@ -1,5 +1,3 @@ -{-# LANGUAGE CPP #-} - -- | -- This module re-exports the @GitHub.Data.@ and "GitHub.Auth" submodules. diff --git a/src/GitHub/Data/Name.hs b/src/GitHub/Data/Name.hs index dbc09653..99554287 100644 --- a/src/GitHub/Data/Name.hs +++ b/src/GitHub/Data/Name.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE CPP #-} module GitHub.Data.Name ( Name(..), mkName, @@ -8,10 +7,8 @@ module GitHub.Data.Name ( import Prelude () import GitHub.Internal.Prelude -#if MIN_VERSION_aeson(1,0,0) import Data.Aeson.Types (FromJSONKey (..), ToJSONKey (..), fromJSONKeyCoerce, toJSONKeyText) -#endif newtype Name entity = N Text deriving (Eq, Ord, Show, Generic, Typeable, Data) @@ -38,7 +35,6 @@ instance ToJSON (Name entity) where instance IsString (Name entity) where fromString = N . fromString -#if MIN_VERSION_aeson(1,0,0) -- | @since 0.15.0.0 instance ToJSONKey (Name entity) where toJSONKey = toJSONKeyText untagName @@ -46,4 +42,3 @@ instance ToJSONKey (Name entity) where -- | @since 0.15.0.0 instance FromJSONKey (Name entity) where fromJSONKey = fromJSONKeyCoerce -#endif diff --git a/src/GitHub/Data/RateLimit.hs b/src/GitHub/Data/RateLimit.hs index 2db078af..4e0b549c 100644 --- a/src/GitHub/Data/RateLimit.hs +++ b/src/GitHub/Data/RateLimit.hs @@ -3,7 +3,7 @@ module GitHub.Data.RateLimit where import GitHub.Internal.Prelude import Prelude () -import Data.Time.Clock.System.Compat (SystemTime (..)) +import Data.Time.Clock.System (SystemTime (..)) import qualified Data.ByteString.Char8 as BS8 import qualified Network.HTTP.Client as HTTP diff --git a/src/GitHub/Data/Repos.hs b/src/GitHub/Data/Repos.hs index 98c254c2..456775b6 100644 --- a/src/GitHub/Data/Repos.hs +++ b/src/GitHub/Data/Repos.hs @@ -1,6 +1,4 @@ -{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} -#define UNSAFE 1 -- | -- This module also exports @@ -19,13 +17,7 @@ import Prelude () import qualified Data.HashMap.Strict as HM import qualified Data.Text as T -#if MIN_VERSION_aeson(1,0,0) import Data.Aeson.Types (FromJSONKey (..), fromJSONKeyCoerce) -#else -#ifdef UNSAFE -import Unsafe.Coerce (unsafeCoerce) -#endif -#endif data Repo = Repo { repoId :: !(Id Repo) @@ -383,22 +375,8 @@ instance FromJSON Language where instance ToJSON Language where toJSON = toJSON . getLanguage -#if MIN_VERSION_aeson(1,0,0) instance FromJSONKey Language where fromJSONKey = fromJSONKeyCoerce -#else -instance FromJSON a => FromJSON (HM.HashMap Language a) where - parseJSON = fmap mapKeyLanguage . parseJSON - where - mapKeyLanguage :: HM.HashMap Text a -> HM.HashMap Language a -#ifdef UNSAFE - mapKeyLanguage = unsafeCoerce -#else - mapKeyLanguage = mapKey Language - mapKey :: (Eq k2, Hashable k2) => (k1 -> k2) -> HM.HashMap k1 a -> HM.HashMap k2 a - mapKey f = HM.fromList . map (first f) . HM.toList -#endif -#endif data ArchiveFormat = ArchiveFormatTarball -- ^ ".tar.gz" format diff --git a/src/GitHub/Data/Request.hs b/src/GitHub/Data/Request.hs index 445c4223..7b4eac40 100644 --- a/src/GitHub/Data/Request.hs +++ b/src/GitHub/Data/Request.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE KindSignatures #-} diff --git a/src/GitHub/Endpoints/Issues.hs b/src/GitHub/Endpoints/Issues.hs index 9cd7258f..47888dc5 100644 --- a/src/GitHub/Endpoints/Issues.hs +++ b/src/GitHub/Endpoints/Issues.hs @@ -1,5 +1,3 @@ -{-# LANGUAGE CPP #-} - -- | -- The issues API as described on . diff --git a/src/GitHub/Endpoints/Repos/Comments.hs b/src/GitHub/Endpoints/Repos/Comments.hs index 371288e3..bd554492 100644 --- a/src/GitHub/Endpoints/Repos/Comments.hs +++ b/src/GitHub/Endpoints/Repos/Comments.hs @@ -1,5 +1,3 @@ -{-# LANGUAGE CPP #-} - -- | -- The repo commits API as described on -- . diff --git a/src/GitHub/Endpoints/Repos/Commits.hs b/src/GitHub/Endpoints/Repos/Commits.hs index 3a10e0a9..1c50c651 100644 --- a/src/GitHub/Endpoints/Repos/Commits.hs +++ b/src/GitHub/Endpoints/Repos/Commits.hs @@ -1,5 +1,3 @@ -{-# LANGUAGE CPP #-} - -- | -- The repo commits API as described on -- . diff --git a/src/GitHub/Internal/Prelude.hs b/src/GitHub/Internal/Prelude.hs index 0419d934..d6efaf39 100644 --- a/src/GitHub/Internal/Prelude.hs +++ b/src/GitHub/Internal/Prelude.hs @@ -1,5 +1,4 @@ {-# LANGUAGE NoImplicitPrelude #-} -{-# LANGUAGE CPP #-} -- | -- This module may change between minor releases. Do not rely on its contents. @@ -24,7 +23,7 @@ import Data.Maybe as X (catMaybes) import Data.Semigroup as X (Semigroup (..)) import Data.String as X (IsString (..)) import Data.Text as X (Text, pack, unpack) -import Data.Time.Compat as X (UTCTime) +import Data.Time as X (UTCTime) import Data.Time.ISO8601 as X (formatISO8601) import Data.Vector as X (Vector) import GHC.Generics as X (Generic)