From b355f948393616aa5da9ced51de74cc7c4ed6b1a Mon Sep 17 00:00:00 2001 From: Brandon Chinn Date: Mon, 15 Nov 2021 13:23:33 -0800 Subject: [PATCH 1/3] Bump resolver to nightly --- stack.yaml | 7 +++++-- tests/TestSuite.hs | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/stack.yaml b/stack.yaml index 46e9e2d..f922546 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,10 +1,13 @@ -resolver: lts-18.6 +resolver: nightly-2021-11-14 packages: -- ../http-common - . extra-deps: +- aeson-2.0.2.0 +- io-streams-haproxy-1.0.1.0 +- snap-core-1.0.4.2 +- snap-server-1.1.2.0 flags: http-streams: diff --git a/tests/TestSuite.hs b/tests/TestSuite.hs index 2049716..e25461c 100644 --- a/tests/TestSuite.hs +++ b/tests/TestSuite.hs @@ -40,6 +40,7 @@ import Data.Aeson ( (.=), ) import Data.Aeson.Encode.Pretty +import qualified Data.Aeson.KeyMap as KeyMap import Data.Bits import qualified Data.HashMap.Strict as Map import Data.Maybe (fromJust) @@ -746,7 +747,7 @@ testParsingJson1 = x <- get url jsonHandler let (Object o) = x - let (Just v) = Map.lookup "label" o + let (Just v) = KeyMap.lookup "label" o let (String t) = v assertEqual "Incorrect response" "Europe (EU27)" t From 86cd7f970d747ee653328e59176d451780641992 Mon Sep 17 00:00:00 2001 From: Brandon Chinn Date: Mon, 15 Nov 2021 13:24:09 -0800 Subject: [PATCH 2/3] Support GHC 9.2 --- lib/Network/Http/Inconvenience.hs | 7 ++++++- stack.yaml | 8 +++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/Network/Http/Inconvenience.hs b/lib/Network/Http/Inconvenience.hs index 6815282..d8cbc0c 100644 --- a/lib/Network/Http/Inconvenience.hs +++ b/lib/Network/Http/Inconvenience.hs @@ -140,7 +140,12 @@ hexd c0 = !low = toDigit $ fromEnum $ c .&. 0xf !hi = toDigit $ (c .&. 0xf0) `shiftr` 4 - shiftr (W8# a#) (I# b#) = I# (word2Int# (uncheckedShiftRL# a# b#)) + shiftr (W8# a#) (I# b#) = I# (word2Int# (uncheckedShiftRL'# a# b#)) +#if MIN_VERSION_base(4,16,0) + uncheckedShiftRL'# a# b# = word8ToWord# (uncheckedShiftRLWord8# a# b#) +#else + uncheckedShiftRL'# = uncheckedShiftRL# +#endif urlEncodeTable :: HashSet Char urlEncodeTable = HashSet.fromList $! filter f $! map w2c [0 .. 255] diff --git a/stack.yaml b/stack.yaml index f922546..e576604 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,13 +1,19 @@ resolver: nightly-2021-11-14 +compiler: ghc-9.2.1 packages: - . extra-deps: - aeson-2.0.2.0 +- attoparsec-0.14.2 +- base-compat-0.12.1 +- base-compat-batteries-0.12.1 - io-streams-haproxy-1.0.1.0 -- snap-core-1.0.4.2 - snap-server-1.1.2.0 +# https://github.com/snapframework/snap-core/pull/312 +- github: snapframework/snap-core + commit: b87aed3ca64b88c7ab71b5bf460a3c4e8cb70a9b flags: http-streams: From 47043e3b5908b8c8edaa817a7bb3318997787958 Mon Sep 17 00:00:00 2001 From: Brandon Chinn Date: Thu, 18 Nov 2021 09:08:55 -0800 Subject: [PATCH 3/3] Keep tests backwards-compatible --- tests/TestSuite.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/TestSuite.hs b/tests/TestSuite.hs index e25461c..7f06228 100644 --- a/tests/TestSuite.hs +++ b/tests/TestSuite.hs @@ -7,6 +7,7 @@ -- available to you by its authors as open source software: you can -- redistribute it and/or modify it under a BSD licence. -- +{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE OverloadedStrings #-} @@ -40,9 +41,12 @@ import Data.Aeson ( (.=), ) import Data.Aeson.Encode.Pretty +#if MIN_VERSION_aeson(2,0,0) import qualified Data.Aeson.KeyMap as KeyMap +#else +import qualified Data.HashMap.Strict as KeyMap +#endif import Data.Bits -import qualified Data.HashMap.Strict as Map import Data.Maybe (fromJust) import Data.Monoid import Data.String