From 1d6a1252eaae8bb238e559271da032147514cf8a Mon Sep 17 00:00:00 2001 From: Nathan Fairhurst Date: Fri, 11 Nov 2022 17:46:29 -0800 Subject: [PATCH 1/4] Only add Eq constraint on older versions of hashable. --- .../Lambda/Events/ApiGateway/ProxyRequest.hs | 18 ++++++++++++++++-- .../Lambda/Events/ApiGateway/ProxyResponse.hs | 9 ++++++++- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/AWS/Lambda/Events/ApiGateway/ProxyRequest.hs b/src/AWS/Lambda/Events/ApiGateway/ProxyRequest.hs index 8a333ef..900a2e5 100644 --- a/src/AWS/Lambda/Events/ApiGateway/ProxyRequest.hs +++ b/src/AWS/Lambda/Events/ApiGateway/ProxyRequest.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-| Module : AWS.Lambda.Events.ApiGateway.ProxyRequest Description : Data types that represent typical lambda responses @@ -168,10 +169,23 @@ data ProxyRequest a = ProxyRequest , body :: ByteString } deriving (Eq, Generic, Show) -toCIHashMap :: (Eq k, FoldCase k, Hashable k) => HashMap k a -> HashMap (CI k) a +toCIHashMap :: +#if !MIN_VERSION_hashable(1,4,0) + Eq k => +#endif + FoldCase k => + Hashable k => + HashMap k a -> + HashMap (CI k) a toCIHashMap = foldrWithKey (insert . mk) mempty -fromCIHashMap :: (Eq k, Hashable k) => HashMap (CI k) a -> HashMap k a +fromCIHashMap :: +#if !MIN_VERSION_hashable(1,4,0) + Eq k => +#endif + Hashable k => + HashMap (CI k) a -> + HashMap k a fromCIHashMap = foldrWithKey (insert . original) mempty toByteString :: Bool -> TL.Text -> ByteString diff --git a/src/AWS/Lambda/Events/ApiGateway/ProxyResponse.hs b/src/AWS/Lambda/Events/ApiGateway/ProxyResponse.hs index bac32d4..fbc271c 100644 --- a/src/AWS/Lambda/Events/ApiGateway/ProxyResponse.hs +++ b/src/AWS/Lambda/Events/ApiGateway/ProxyResponse.hs @@ -159,7 +159,14 @@ data ProxyResponse = ProxyResponse , body :: ProxyBody } deriving (Eq, Generic, Show) -toCIHashMap :: (Eq k, FoldCase k, Hashable k) => HashMap k a -> HashMap (CI k) a +toCIHashMap :: +#if !MIN_VERSION_hashable(1,4,0) + Eq k => +#endif + FoldCase k => + Hashable k => + HashMap k a -> + HashMap (CI k) a toCIHashMap = H.foldrWithKey (H.insert . mk) mempty -- | Smart constructor for creating a ProxyResponse from a status and a body From a62f4dd7225a8670b91b33309de0ed5ac7377295 Mon Sep 17 00:00:00 2001 From: Nathan Fairhurst Date: Fri, 11 Nov 2022 17:57:18 -0800 Subject: [PATCH 2/4] Remove unused imports. --- test/AWS/Lambda/Events/EventBridge/Gen.hs | 1 - test/AWS/Lambda/Events/EventBridge/Spec.hs | 1 - 2 files changed, 2 deletions(-) diff --git a/test/AWS/Lambda/Events/EventBridge/Gen.hs b/test/AWS/Lambda/Events/EventBridge/Gen.hs index ceeb237..b0b2396 100644 --- a/test/AWS/Lambda/Events/EventBridge/Gen.hs +++ b/test/AWS/Lambda/Events/EventBridge/Gen.hs @@ -5,7 +5,6 @@ module AWS.Lambda.Events.EventBridge.Gen where import AWS.Lambda.Events.EventBridge (EventBridgeEvent'(..), EventBridgeEvent) -import Data.List (intersperse) import Data.Text (Text) import qualified Data.Text as T import Data.Time (UTCTime) diff --git a/test/AWS/Lambda/Events/EventBridge/Spec.hs b/test/AWS/Lambda/Events/EventBridge/Spec.hs index 8c8fba8..53ba482 100644 --- a/test/AWS/Lambda/Events/EventBridge/Spec.hs +++ b/test/AWS/Lambda/Events/EventBridge/Spec.hs @@ -16,7 +16,6 @@ import Data.Time (UTC import Hedgehog (forAll, tripping) import Test.Hspec (Spec, describe, shouldBe, specify) import Test.Hspec.Hedgehog (hedgehog) -import Test.Hspec.Runner (hspec) import Text.RawString.QQ (r) spec :: Spec From 953019e3e8480054068407da94d29cef65d909b0 Mon Sep 17 00:00:00 2001 From: Nathan Fairhurst Date: Fri, 11 Nov 2022 18:27:26 -0800 Subject: [PATCH 3/4] Supress missing field warning when using newer versions of http-client. --- test/Spec.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/Spec.hs b/test/Spec.hs index bf8ba6f..06f86af 100644 --- a/test/Spec.hs +++ b/test/Spec.hs @@ -237,6 +237,9 @@ minResponse headers body = , responseBody = body , responseCookieJar = undefined , responseClose' = undefined +#if MIN_VERSION_http_client(0,7,8) + , responseOriginalRequest = undefined +#endif } minJsonResponse :: [Header] -> Response Value From 8d2053ea9024c0f891e937f188932ce182e5629e Mon Sep 17 00:00:00 2001 From: Nathan Fairhurst Date: Fri, 11 Nov 2022 18:28:04 -0800 Subject: [PATCH 4/4] Update CHANGELOG with work to address warnings. --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 737d568..0cf8b2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog][chg] and this project adheres to [Haskell's Package Versioning Policy][pvp] +## Unreleased + + - Address or suppress warnings + ## `1.0.0.1` - 2022-09-10 - Support GHC 9.4 by eliminating compiler errors