From 40f66f0cc190d557921cb59e2bf90b50153d0928 Mon Sep 17 00:00:00 2001 From: Alp Mestanogullari Date: Tue, 8 Nov 2022 10:17:33 +0100 Subject: [PATCH] more fixes --- cabal.project | 9 +++++++-- ci-sdist.cabal.project | 7 ++++++- ci.cabal.project | 7 ++++++- common/util/Util/ToExp.hs | 3 ++- common/util/tests/HsStructTest.hs | 21 ++++++++++++++++----- 5 files changed, 37 insertions(+), 10 deletions(-) diff --git a/cabal.project b/cabal.project index e02b7235..2166bd1b 100644 --- a/cabal.project +++ b/cabal.project @@ -13,5 +13,10 @@ packages: tests: true -allow-newer: vector-fftw:base -constraints: entropy < 0.4.1.9, haxl >= 2.4 \ No newline at end of file +allow-newer: vector-fftw:base, haskell-names:aeson, haskell-names:bytestring, haxl:bytestring, haxl:time +constraints: entropy < 0.4.1.9, haxl >= 2.4 + +source-repository-package + type: git + location: https://github.com/exi/vector-fftw.git + tag: 6d09555b94c8e0363e0243a2802153b5749f8d2d diff --git a/ci-sdist.cabal.project b/ci-sdist.cabal.project index 26961054..7adf12a7 100644 --- a/ci-sdist.cabal.project +++ b/ci-sdist.cabal.project @@ -11,5 +11,10 @@ package thrift-server flags: +tests_use_ipv4 package thrift-cpp-channel flags: +tests_use_ipv4 -allow-newer: vector-fftw:base +allow-newer: vector-fftw:base, haskell-names:aeson, haskell-names:bytestring, haxl:bytestring, haxl:time constraints: entropy < 0.4.1.9, haxl >= 2.4 + +source-repository-package + type: git + location: https://github.com/exi/vector-fftw.git + tag: 6d09555b94c8e0363e0243a2802153b5749f8d2d diff --git a/ci.cabal.project b/ci.cabal.project index 6c56c79b..4e768d72 100644 --- a/ci.cabal.project +++ b/ci.cabal.project @@ -23,5 +23,10 @@ package thrift-server package thrift-cpp-channel flags: +tests_use_ipv4 -allow-newer: vector-fftw:base +allow-newer: vector-fftw:base, haskell-names:aeson, haskell-names:bytestring, haxl:bytestring, haxl:time constraints: entropy < 0.4.1.9, haxl >= 2.4 + +source-repository-package + type: git + location: https://github.com/exi/vector-fftw.git + tag: 6d09555b94c8e0363e0243a2802153b5749f8d2d diff --git a/common/util/Util/ToExp.hs b/common/util/Util/ToExp.hs index 5d56c05e..3412c917 100644 --- a/common/util/Util/ToExp.hs +++ b/common/util/Util/ToExp.hs @@ -30,7 +30,8 @@ import Language.Haskell.Exts hiding (intE) import Util.Text #if MIN_VERSION_aeson(2,0,0) -import Data.Aeson.KeyMap (Key, KeyMap) +import Data.Aeson.Key (Key) +import Data.Aeson.KeyMap (KeyMap) import qualified Data.Aeson.Key as Key import qualified Data.Aeson.KeyMap as KeyMap #endif diff --git a/common/util/tests/HsStructTest.hs b/common/util/tests/HsStructTest.hs index fd2ff26b..bbc16b05 100644 --- a/common/util/tests/HsStructTest.hs +++ b/common/util/tests/HsStructTest.hs @@ -1,11 +1,15 @@ -- Copyright (c) Facebook, Inc. and its affiliates. - +{-# LANGUAGE CPP #-} module HsStructTest (main) where import Test.HUnit import TestRunner import Control.Exception +#if MIN_VERSION_aeson(2,0,0) +import Data.Aeson.KeyMap (KeyMap) +import qualified Data.Aeson.KeyMap as KeyMap +#endif import qualified Data.Aeson as Aeson import Data.ByteString (ByteString, useAsCStringLen) import Data.ByteString.Unsafe (unsafeUseAsCStringLen) @@ -407,7 +411,11 @@ pairTest = TestLabel "Pair" $ foreign import ccall unsafe "getPair" getPair :: IO (Ptr a) +#if MIN_VERSION_aeson(2,0,0) +type Nested = KeyMap (IntMap [Maybe Text]) +#else type Nested = HashMap Text (IntMap [Maybe Text]) +#endif type HsNested = HsObject (HsIntMap (HsList (HsMaybe HsText))) nestedTest :: Test @@ -416,8 +424,13 @@ nestedTest = TestLabel "nested" $ actual :: Nested <- coerce $ bracket createNested destroyNested peek assertEqual "Nested" expected actual where +#if MIN_VERSION_aeson(2,0,0) + mapFromList = KeyMap.fromList +#else + mapFromList = HashMap.fromList +#endif expected = - HashMap.fromList + mapFromList [ ("zero", IntMap.empty) , ("one", IntMap.singleton 1 []) , ("two", IntMap.singleton 2 [Nothing]) @@ -454,9 +467,7 @@ jsonRoundTrip = TestLabel "json" $ [Aeson.Null, Aeson.Bool True, Aeson.String "VectorVector"] ) roundTrip - ( Aeson.Object $ - HashMap.fromList - [("foo", Aeson.Bool True), ("bar", Aeson.Bool False)] + ( Aeson.object [ "foo" Aeson..= True, "bar" Aeson..= False ] ) where roundTrip j = withCxxObject (HsJSON j) $ \p -> do