diff --git a/Github/Data.hs b/Github/Data.hs index d00686d7..0fee4258 100644 --- a/Github/Data.hs +++ b/Github/Data.hs @@ -1,4 +1,5 @@ {-# LANGUAGE CPP, DeriveDataTypeable, OverloadedStrings #-} +{-# OPTIONS_GHC -fno-warn-orphans #-} -- | This module re-exports the @Github.Data.Definitions@ module, adding -- instances of @FromJSON@ to it. If you wish to use the data without the @@ -13,7 +14,9 @@ module Github.Data ( module Github.Data.Teams, ) where +#if !MIN_VERSION_base(4,8,0) import Control.Applicative +#endif import Control.Monad import qualified Data.Text as T import Data.Aeson.Compat @@ -38,9 +41,15 @@ import Github.Data.Teams instance FromJSON GithubDate where parseJSON (String t) = - case parseTime defaultTimeLocale "%FT%T%Z" (T.unpack t) of + case pt defaultTimeLocale "%FT%T%Z" (T.unpack t) of Just d -> pure $ GithubDate d _ -> fail "could not parse Github datetime" + where +#if MIN_VERSION_time(1,5,0) + pt = parseTimeM True +#else + pt = parseTime +#endif parseJSON _ = fail "Given something besides a String" instance FromJSON Commit where diff --git a/Github/Private.hs b/Github/Private.hs index d61e5321..8578fb56 100644 --- a/Github/Private.hs +++ b/Github/Private.hs @@ -10,13 +10,15 @@ -- module Github.Private where +#if !MIN_VERSION_base(4,8,0) +import Control.Applicative +#endif import Github.Data import Control.DeepSeq (NFData) import Data.Aeson import Data.Attoparsec.ByteString.Lazy import Data.Data import Data.Monoid -import Control.Applicative import Data.List import Data.CaseInsensitive (mk) import qualified Data.ByteString.Char8 as BS @@ -169,7 +171,13 @@ doHttps reqMethod url auth body = do getOAuth (GithubOAuth token) = [(mk (BS.pack "Authorization"), BS.pack ("token " ++ token))] getOAuth _ = [] - getResponse request = withManager $ \manager -> httpLbs request manager + getResponse request = do + manager <- newManager tlsManagerSettings + x <- httpLbs request manager +#if !MIN_VERSION_http_client(0, 4, 18) + closeManager manager +#endif + pure x #if MIN_VERSION_http_conduit(1, 9, 0) successOrMissing s@(Status sci _) hs cookiejar #else diff --git a/Github/Repos/Webhooks/Validate.hs b/Github/Repos/Webhooks/Validate.hs index 23d835ac..00fe3f9a 100644 --- a/Github/Repos/Webhooks/Validate.hs +++ b/Github/Repos/Webhooks/Validate.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE OverloadedStrings #-} -- | Verification of incomming webhook payloads, as described at @@ -7,7 +8,9 @@ module Github.Repos.Webhooks.Validate ( isValidPayload ) where +#if !MIN_VERSION_base(4,8,0) import Control.Applicative +#endif import Crypto.Hash import qualified Data.ByteString.Char8 as BS import Data.Byteable (constEqBytes, toBytes) diff --git a/github.cabal b/github.cabal index 0712a3e4..5ad03c24 100644 --- a/github.cabal +++ b/github.cabal @@ -191,6 +191,7 @@ Library text, old-locale, http-conduit >= 1.8, + http-client, http-types, data-default, vector,