Skip to content

Commit

Permalink
Drop support for GHC 8.0 and below
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasabel committed Oct 17, 2024
1 parent ee8b286 commit 415e474
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 55 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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_
Expand Down
21 changes: 6 additions & 15 deletions github.cabal
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -188,15 +182,15 @@ 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
, deepseq >=1.3.0.2 && <1.6
, 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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion samples/Operational/Operational.hs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedStrings #-}

module Main (main) where

import Common
Expand Down
2 changes: 0 additions & 2 deletions src/GitHub/Data.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{-# LANGUAGE CPP #-}

-- |
-- This module re-exports the @GitHub.Data.@ and "GitHub.Auth" submodules.

Expand Down
5 changes: 0 additions & 5 deletions src/GitHub/Data/Name.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{-# LANGUAGE CPP #-}
module GitHub.Data.Name (
Name(..),
mkName,
Expand All @@ -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)
Expand All @@ -38,12 +35,10 @@ 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

-- | @since 0.15.0.0
instance FromJSONKey (Name entity) where
fromJSONKey = fromJSONKeyCoerce
#endif
2 changes: 1 addition & 1 deletion src/GitHub/Data/RateLimit.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 0 additions & 22 deletions src/GitHub/Data/Repos.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE FlexibleInstances #-}
#define UNSAFE 1

-- |
-- This module also exports
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/GitHub/Data/Request.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE KindSignatures #-}
Expand Down
2 changes: 0 additions & 2 deletions src/GitHub/Endpoints/Issues.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{-# LANGUAGE CPP #-}

-- |
-- The issues API as described on <http://developer.github.com/v3/issues/>.

Expand Down
2 changes: 0 additions & 2 deletions src/GitHub/Endpoints/Repos/Comments.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{-# LANGUAGE CPP #-}

-- |
-- The repo commits API as described on
-- <http://developer.github.com/v3/repos/comments/>.
Expand Down
2 changes: 0 additions & 2 deletions src/GitHub/Endpoints/Repos/Commits.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{-# LANGUAGE CPP #-}

-- |
-- The repo commits API as described on
-- <http://developer.github.com/v3/repos/commits/>.
Expand Down
3 changes: 1 addition & 2 deletions src/GitHub/Internal/Prelude.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE CPP #-}

-- |
-- This module may change between minor releases. Do not rely on its contents.
Expand All @@ -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)
Expand Down

0 comments on commit 415e474

Please sign in to comment.