Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: GHC 9 support #107

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci-getdeps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ghc: [8.4.4, 8.6.5, 8.8.4, 8.10.2]
ghc: [8.4.4, 8.6.5, 8.8.4, 8.10.2, 9.0.2, 9.2.2]
runs-on: ubuntu-latest
container:
image: ghcr.io/facebookincubator/hsthrift/ci-base:ghcup
Expand Down
8 changes: 8 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,11 @@ packages:
cpp-channel/thrift-cpp-channel.cabal

tests: true

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
7 changes: 7 additions & 0 deletions ci-sdist.cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,10 @@ package thrift-server
flags: +tests_use_ipv4
package thrift-cpp-channel
flags: +tests_use_ipv4
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
8 changes: 8 additions & 0 deletions ci.cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,11 @@ package thrift-server
flags: +tests_use_ipv4
package thrift-cpp-channel
flags: +tests_use_ipv4

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
2 changes: 1 addition & 1 deletion common/github/fb-stubs.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,5 @@ library
Facebook.Init

build-depends:
base >=4.11.1.0 && <4.15,
base >=4.11.1.0 && <4.17,
HUnit ^>= 1.6.1
8 changes: 4 additions & 4 deletions common/mangle/mangle.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,21 @@ library
exposed-modules: Mangle, Mangle.TH
default-extensions: LambdaCase, GeneralizedNewtypeDeriving
build-depends:
base >=4.11.1 && <4.15,
base >=4.11.1 && <4.17,
containers >=0.5.11.0 && <0.7,
parsec ^>=3.1.13.0,
template-haskell >=2.13 && <2.17
template-haskell >=2.13 && <2.19
default-language: Haskell2010

executable mangle
main-is: Main.hs
other-modules: Mangle
default-extensions: LambdaCase, GeneralizedNewtypeDeriving
build-depends:
base >=4.11.1 && <4.15,
base >=4.11.1 && <4.17,
containers >=0.5.11 && <0.7,
parsec ^>=3.1.13.0,
template-haskell >=2.13 && <2.17
template-haskell >=2.13 && <2.19
default-language: Haskell2010

test-suite mangle-test
Expand Down
16 changes: 15 additions & 1 deletion common/util/Foreign/CPP/Dynamic.hsc
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ import Control.Exception (bracket)
import Data.Aeson hiding (parseJSON)
import qualified Data.Vector as Vector
import qualified Data.HashMap.Strict as HashMap
#if MIN_VERSION_aeson(2,0,0)
import qualified Data.Aeson.Key as Key
import qualified Data.Aeson.KeyMap as KeyMap
#endif
import Data.Text (Text)
import qualified Data.Text as Text
import Data.Scientific
Expand Down Expand Up @@ -266,9 +270,13 @@ peekImpl peekCString p = do
| otherwise = do
key <- peekElemOff pkeys i >>= getDynKey
val <- peekElemOff pvals i >>= getDyn
#ifdef MIN_VERSION_aeson(2,0,0)
go (i+1) (KeyMap.insert (Key.fromText key) val obj)
#else
go (i+1) (HashMap.insert key val obj)
#endif

go 0 HashMap.empty
go 0 mempty
in
Dynamic <$> getDyn p

Expand Down Expand Up @@ -302,8 +310,14 @@ instance Storable Dynamic where
c_createDynamicArray pdyn (fromIntegral $ size) pelems

putDyn pdyn (Object obj) = do
#if MIN_VERSION_aeson(2,0,0)
let size = KeyMap.size obj
(keys', vals) = unzip $ KeyMap.toList obj
keys = map Key.toText keys'
#else
let size = HashMap.size obj
(keys, vals) = unzip $ HashMap.toList obj
#endif
useTextsAsCStrings keys $ \pkeys ->
withArray' size (map Dynamic vals) $ \pvals ->
c_createDynamicObject pdyn (fromIntegral $ size) pkeys pvals
Expand Down
Loading