From 15b3ac0aee304f073919066e1f9833571479398c Mon Sep 17 00:00:00 2001 From: Gil Mizrahi Date: Tue, 15 Nov 2022 13:25:04 +0200 Subject: [PATCH] ghc 9.2.5 PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6777 Co-authored-by: Samir Talwar <47582+SamirTalwar@users.noreply.github.com> GitOrigin-RevId: 916abab76446cf7c4e1e63dc112ba4994ab4d23d --- .ghcversion | 2 +- cabal.project | 2 +- cabal.project.freeze | 198 +++++++++--------- flake.lock | 12 +- flake.nix | 11 +- nix/nixpkgs.nix | 13 ++ nix/overlays/ghc.nix | 25 +-- scripts/cabal-freeze-update.sh | 82 ++++---- server/COMPILING-ON-MACOS.md | 4 +- server/CONTRIBUTING.md | 2 +- server/VERSIONS.json | 2 +- .../Hasura/GraphQL/Parser/Internal/Parser.hs | 2 +- server/src-lib/Autodocodec/Extended.hs | 4 +- server/src-lib/Control/Monad/Circular.hs | 4 +- .../src-lib/Data/HashMap/Strict/Extended.hs | 22 +- .../Data/HashMap/Strict/InsOrd/Extended.hs | 4 +- server/src-lib/Data/HashMap/Strict/Multi.hs | 10 +- .../src-lib/Data/HashMap/Strict/NonEmpty.hs | 16 +- server/src-lib/Data/List/Extended.hs | 8 +- server/src-lib/Data/Trie.hs | 10 +- server/src-lib/Hasura/GraphQL/Execute.hs | 2 +- .../src-lib/Hasura/GraphQL/Execute/Remote.hs | 2 +- .../GraphQL/Execute/RemoteJoin/Collect.hs | 2 +- .../GraphQL/Execute/Subscription/TMap.hs | 8 +- .../Hasura/Incremental/Internal/Rule.hs | 2 +- .../src-lib/Hasura/RQL/DDL/Metadata/Types.hs | 2 +- server/src-lib/Hasura/RQL/DDL/Relationship.hs | 2 +- .../Hasura/RQL/DDL/Schema/Cache/Common.hs | 4 +- server/src-lib/Hasura/RQL/DDL/Schema/Table.hs | 4 +- server/src-lib/Hasura/RQL/Types/Allowlist.hs | 2 +- .../src-lib/Hasura/RQL/Types/Endpoint/Trie.hs | 10 +- .../Hasura/RQL/Types/Metadata/Common.hs | 2 +- server/src-lib/Hasura/RQL/Types/Permission.hs | 2 +- .../Hasura/RQL/Types/Roles/Internal.hs | 3 +- server/src-lib/Hasura/RQL/Types/Table.hs | 4 +- server/src-lib/Hasura/Server/Auth/JWT.hs | 2 +- server/src-test/Hasura/Generator/Common.hs | 1 - .../src-test/Hasura/QuickCheck/Instances.hs | 8 +- server/src-test/Hasura/RQL/IR/Generator.hs | 14 -- .../src-test/Hasura/RQL/Types/EndpointSpec.hs | 4 +- 40 files changed, 247 insertions(+), 266 deletions(-) create mode 100644 nix/nixpkgs.nix diff --git a/.ghcversion b/.ghcversion index c88cb988012..f9458b8ea2d 100644 --- a/.ghcversion +++ b/.ghcversion @@ -1 +1 @@ -9.2.4 +9.2.5 diff --git a/cabal.project b/cabal.project index fe40290a478..9379cb5add4 100644 --- a/cabal.project +++ b/cabal.project @@ -15,7 +15,7 @@ -- -- See: https://www.haskell.org/cabal/users-guide/nix-local-build.html#configuring-builds-with-cabal-project -with-compiler: ghc-9.2.4 +with-compiler: ghc-9.2.5 -- package-level parallelism: jobs: $ncpus diff --git a/cabal.project.freeze b/cabal.project.freeze index d64f3afc480..e08be93cf35 100644 --- a/cabal.project.freeze +++ b/cabal.project.freeze @@ -1,7 +1,7 @@ active-repositories: hackage.haskell.org:merge constraints: any.Cabal ==3.6.3.0, any.Diff ==0.4.1, - any.HTTP ==4000.3.16, + any.HTTP ==4000.4.1, any.HUnit ==1.6.2.0, any.OneTuple ==0.3.1, any.Only ==0.1, @@ -11,13 +11,13 @@ constraints: any.Cabal ==3.6.3.0, any.Spock ==0.14.0.0, any.Spock-core ==0.14.0.1, any.StateVar ==1.2.2, - any.adjunctions ==4.4, + any.adjunctions ==4.4.2, any.aeson ==2.1.0.0, any.aeson-casing ==0.2.0.0, any.aeson-pretty ==0.8.9, any.aeson-qq ==0.8.4, any.alex ==3.2.7.1, - any.ansi-terminal ==0.11.1, + any.ansi-terminal ==0.11.3, any.ansi-wl-pprint ==0.6.9, any.appar ==0.1.8, any.array ==0.5.4.0, @@ -28,23 +28,24 @@ constraints: any.Cabal ==3.6.3.0, any.async ==2.2.4, any.atomic-primops ==0.8.4, any.attoparsec ==0.14.4, - any.attoparsec-iso8601 ==1.0.2.1, + any.attoparsec-iso8601 ==1.1.0.0, any.authenticate-oauth ==1.7, any.auto-update ==0.1.6, - any.autodocodec ==0.2.0.0, + any.autodocodec ==0.2.0.1, any.autodocodec-openapi3 ==0.2.1.1, any.barbies ==2.0.3.1, - any.base ==4.16.3.0, - any.base-compat ==0.12.1, - any.base-compat-batteries ==0.12.1, - any.base-orphans ==0.8.6, + any.base ==4.16.4.0, + any.base-compat ==0.12.2, + any.base-compat-batteries ==0.12.2, + any.base-orphans ==0.8.7, any.base-prelude ==1.6.1, any.base16-bytestring ==1.0.2.0, any.base64-bytestring ==1.2.1.0, - any.basement ==0.0.14, - any.bifunctors ==5.5.11, + any.basement ==0.0.15, + any.bifunctors ==5.5.13, any.binary ==0.8.9.0, - any.binary-parser ==0.5.7.1, + any.binary-parser ==0.5.7.2, + any.bitvec ==1.1.3.0, any.blaze-builder ==0.4.2.2, any.blaze-html ==0.9.1.2, any.blaze-markup ==0.8.2.8, @@ -53,13 +54,13 @@ constraints: any.Cabal ==3.6.3.0, any.byteorder ==1.0.4, any.bytestring ==0.11.3.1, any.bytestring-builder ==0.10.8.2.0, - any.bytestring-lexing ==0.5.0.8, - any.bytestring-strict-builder ==0.4.5.5, + any.bytestring-lexing ==0.5.0.9, + any.bytestring-strict-builder ==0.4.5.6, any.bytestring-tree-builder ==0.2.7.10, any.cabal-doctest ==1.0.9, any.call-stack ==0.4.0, any.case-insensitive ==1.2.1.0, - any.cereal ==0.5.8.2, + any.cereal ==0.5.8.3, any.charset ==0.3.9, any.ci-info ==0.1.0.0, any.clock ==0.8.3, @@ -67,11 +68,11 @@ constraints: any.Cabal ==3.6.3.0, any.colour ==2.3.6, any.comonad ==5.0.8, any.concise ==0.1.0.1, - any.concurrent-output ==1.10.15, - any.conduit ==1.3.4.2, - any.conduit-extra ==1.3.5, + any.concurrent-output ==1.10.16, + any.conduit ==1.3.4.3, + any.conduit-extra ==1.3.6, any.connection ==0.3.1, - any.constraints ==0.13.3, + any.constraints ==0.13.4, any.constraints-extras ==0.3.2.1, any.containers ==0.6.5.1, any.contravariant ==1.5.5, @@ -83,7 +84,7 @@ constraints: any.Cabal ==3.6.3.0, any.cryptohash-md5 ==0.11.101.0, any.cryptohash-sha1 ==0.11.101.0, any.cryptonite ==0.30, - any.data-bword ==0.1.0.1, + any.data-bword ==0.1.0.2, any.data-checked ==0.3, any.data-default ==0.7.1.1, any.data-default-class ==0.1.2.0, @@ -96,9 +97,9 @@ constraints: any.Cabal ==3.6.3.0, any.data-has ==0.4.0.0, any.data-serializer ==0.3.5, any.data-textual ==0.3.0.3, - any.dec ==0.0.4, + any.dec ==0.0.5, any.deepseq ==1.4.6.1, - any.deferred-folds ==0.9.18.1, + any.deferred-folds ==0.9.18.2, any.dependent-map ==0.4.0.0, any.dependent-sum ==0.7.1.0, any.dependent-sum-template ==0.1.1.1, @@ -107,15 +108,15 @@ constraints: any.Cabal ==3.6.3.0, any.dlist ==1.0, any.double-conversion ==2.0.4.1, any.easy-file ==0.2.2, - any.either ==5.0.1.1, + any.either ==5.0.2, any.ekg-core ==0.1.1.7, any.ekg-json ==0.1.0.7, any.ekg-prometheus ==0.2.0.0, - any.entropy ==0.4.1.7, + any.entropy ==0.4.1.10, any.erf ==2.0.0.0, any.errors ==2.3.0, any.exceptions ==0.10.4, - any.extra ==1.7.10, + any.extra ==1.7.12, any.fail ==4.9.0.0, any.fast-logger ==3.1.1, any.file-embed ==0.0.15.0, @@ -124,28 +125,28 @@ constraints: any.Cabal ==3.6.3.0, any.focus ==1.0.3, any.foldl ==1.4.12, any.formatting ==7.1.3, - any.free ==5.1.7, + any.free ==5.1.9, any.generic-monoid ==0.1.0.1, any.generically ==0.1, any.generics-sop ==0.5.1.2, - any.ghc ==9.2.*, + any.ghc ==9.2.5, any.ghc-bignum ==1.2, - any.ghc-boot ==9.2.*, - any.ghc-boot-th ==9.2.*, - any.ghc-heap ==9.2.*, + any.ghc-boot ==9.2.5, + any.ghc-boot-th ==9.2.5, + any.ghc-heap ==9.2.5, any.ghc-heap-view ==0.6.3, any.ghc-prim ==0.8.0, - any.ghci ==9.2.*, + any.ghci ==9.2.5, any.happy ==1.20.0, - any.hashable ==1.3.5.0, - any.hashtables ==1.2.4.2, + any.hashable ==1.4.1.0, + any.hashtables ==1.3.1, any.haskell-lexer ==1.1, any.haskell-src-exts ==1.23.1, - any.haskell-src-meta ==0.8.9, + any.haskell-src-meta ==0.8.11, any.hasql ==1.5.0.5, any.hasql-pool ==0.5.2.2, any.hasql-transaction ==1.0.1.1, - any.hedgehog ==1.1.1, + any.hedgehog ==1.2, any.hedis ==0.15.1, any.hourglass ==0.2.12, any.hpc ==0.6.1.0, @@ -158,7 +159,7 @@ constraints: any.Cabal ==3.6.3.0, any.hspec-expectations-json ==1.0.0.7, any.hspec-expectations-lifted ==0.10.0, any.hspec-hedgehog ==0.0.1.2, - any.http-api-data ==0.4.3, + any.http-api-data ==0.5, any.http-client ==0.7.13.1, any.http-client-tls ==0.3.6.1, any.http-conduit ==2.3.8, @@ -170,35 +171,36 @@ constraints: any.Cabal ==3.6.3.0, any.immortal ==0.2.2.1, any.indexed-profunctors ==0.1.1, any.indexed-traversable ==0.1.2, - any.indexed-traversable-instances ==0.1.1, + any.indexed-traversable-instances ==0.1.1.1, any.insert-ordered-containers ==0.2.5.1, any.inspection-testing ==0.4.6.1, any.integer-gmp ==1.1, any.integer-logarithms ==1.0.3.1, - any.invariant ==0.5.5, + any.invariant ==0.6, any.iproute ==1.7.12, + any.isomorphism-class ==0.1.0.7, any.jose ==0.9, - any.kan-extensions ==5.2.3, + any.kan-extensions ==5.2.5, any.keys ==3.12.3, any.kriti-lang ==0.3.3, - any.lens ==5.1, + any.lens ==5.2, any.lens-aeson ==1.2.2, any.lens-family ==2.1.2, any.lens-family-core ==2.1.2, any.libyaml ==0.1.2, - any.lifted-async ==0.10.2.2, + any.lifted-async ==0.10.2.3, any.lifted-base ==0.2.3.12, - any.list-t ==1.0.5.1, - any.logict ==0.7.0.3, + any.list-t ==1.0.5.3, + any.logict ==0.8.0.0, any.lucid2 ==0.0.20221012, any.managed ==1.0.9, - any.megaparsec ==9.2.0, - any.memory ==0.17.0, - any.mime-types ==0.1.0.9, + any.megaparsec ==9.2.2, + any.memory ==0.18.0, + any.mime-types ==0.1.1.0, any.mmorph ==1.2.0, any.monad-control ==1.0.3.1, any.monad-loops ==0.4.3, - any.monad-time ==0.3.1.0, + any.monad-time ==0.4.0.0, any.monad-validate ==1.2.0.1, any.mono-traversable ==1.0.15.3, any.morpheus-graphql ==0.20.0, @@ -209,7 +211,7 @@ constraints: any.Cabal ==3.6.3.0, any.mtl-compat ==0.2.2, any.mustache ==2.4.1, any.mysql ==0.2.1, - any.mysql-simple ==0.4.7.1, + any.mysql-simple ==0.4.9, any.natural-transformation ==0.4, any.network ==3.1.2.7, any.network-bsd ==2.8.1.0, @@ -223,101 +225,103 @@ constraints: any.Cabal ==3.6.3.0, any.old-locale ==1.0.0.7, any.old-time ==1.1.0.3, any.openapi3 ==3.2.2, - any.optics-core ==0.4, - any.optics-extra ==0.4, - any.optics-th ==0.4, + any.optics-core ==0.4.1, + any.optics-extra ==0.4.2.1, + any.optics-th ==0.4.1, any.optparse-applicative ==0.16.1.0, - any.optparse-generic ==1.4.7, + any.optparse-generic ==1.4.8, any.parallel ==3.2.2.0, any.parsec ==3.1.15.1, any.parser-combinators ==1.3.0, - any.parsers ==0.12.10, + any.parsers ==0.12.11, any.pcre-light ==0.4.1.0, any.pem ==0.2.4, - any.pointed ==5.0.3, + any.pointed ==5.0.4, any.postgres-options ==0.2.0.0, - any.postgresql-binary ==0.12.4.2, + any.postgresql-binary ==0.12.5, any.postgresql-libpq ==0.9.4.3, - any.postgresql-simple ==0.6.4, + any.postgresql-simple ==0.6.5, any.pretty ==1.1.3.6, any.pretty-show ==1.10, - any.pretty-simple ==4.0.0.0, + any.pretty-simple ==4.1.2.0, any.prettyprinter ==1.7.1, any.prettyprinter-ansi-terminal ==1.1.3, - any.primitive ==0.7.3.0, - any.primitive-extras ==0.10.1.4, + any.primitive ==0.7.4.0, + any.primitive-extras ==0.10.1.5, any.primitive-unlifted ==0.1.3.1, - any.process ==1.6.13.2, + any.process ==1.6.16.0, any.profunctors ==5.6.2, - any.proto-lens ==0.7.1.1, - any.proto-lens-runtime ==0.7.0.2, + any.proto-lens ==0.7.1.2, + any.proto-lens-runtime ==0.7.0.3, any.psqueues ==0.2.7.3, - any.quickcheck-instances ==0.3.27, + any.quickcheck-instances ==0.3.28, any.quickcheck-io ==0.2.0, - any.random ==1.2.1, + any.random ==1.2.1.1, + any.recv ==0.0.0, any.refined ==0.8, any.reflection ==2.1.6, any.regex-base ==0.94.0.2, - any.regex-tdfa ==1.3.1.1, + any.regex-tdfa ==1.3.2, any.relude ==1.1.0.0, any.reroute ==0.7.0.0, any.resource-pool ==0.2.3.2, - any.resourcet ==1.2.4.3, - any.retry ==0.9.1.0, + any.resourcet ==1.2.6, + any.retry ==0.9.3.0, any.rts ==1.0.2, any.safe ==0.3.19, - any.safe-exceptions ==0.1.7.2, + any.safe-exceptions ==0.1.7.3, any.scanner ==0.3.1, any.scientific ==0.3.7.0, any.semialign ==1.2.0.1, any.semigroupoids ==5.3.7, any.semigroups ==0.20, any.semver ==0.4.0.1, - any.servant ==0.19, + any.servant ==0.19.1, any.servant-client ==0.19, any.servant-client-core ==0.19, any.servant-openapi3 ==2.0.1.5, - any.servant-server ==0.19.1, + any.servant-server ==0.19.2, any.setenv ==0.1.1.3, - any.shakespeare ==2.0.29, + any.shakespeare ==2.0.30, any.simple-sendfile ==0.2.30, any.singleton-bool ==0.1.6, any.socks ==0.6.1, any.some ==1.0.3, any.sop-core ==0.5.0.2, - any.split ==0.2.3.4, + any.split ==0.2.3.5, any.splitmix ==0.1.0.4, any.stm ==2.5.0.2, any.stm-containers ==1.2, - any.stm-hamt ==1.2.0.7, - any.streaming-commons ==0.2.2.4, + any.stm-hamt ==1.2.0.8, + any.streaming-commons ==0.2.2.5, any.strict ==0.4.0.1, any.string-conversions ==0.4.0.1, any.string-interpolate ==0.3.1.2, any.superbuffer ==0.3.1.2, - any.syb ==0.7.2.1, + any.syb ==0.7.2.2, any.system-filepath ==0.4.14, any.tagged ==0.8.6.1, any.tasty ==1.4.2.3, any.tasty-bench ==0.3.2, any.template-haskell ==2.18.0.0, any.template-haskell-compat-v0208 ==0.1.9.1, - any.terminal-size ==0.3.2.1, + any.terminal-size ==0.3.3, any.terminfo ==0.4.1.5, any.text ==1.2.5.0, - any.text-builder ==0.6.6.3, - any.text-conversions ==0.3.1, + any.text-builder ==0.6.7, + any.text-builder-dev ==0.3.3, + any.text-conversions ==0.3.1.1, any.text-latin1 ==0.3.1, any.text-printer ==0.5.0.2, any.text-short ==0.1.5, any.tf-random ==0.5, - any.th-abstraction ==0.4.3.0, - any.th-compat ==0.1.3, - any.th-expand-syns ==0.4.9.0, + any.th-abstraction ==0.4.5.0, + any.th-compat ==0.1.4, + any.th-expand-syns ==0.4.10.0, any.th-extras ==0.0.0.6, any.th-lift ==0.8.2, - any.th-lift-instances ==0.1.19, - any.th-orphans ==0.13.12, + any.th-lift-instances ==0.1.20, + any.th-orphans ==0.13.14, any.th-reify-many ==0.1.10, any.these ==1.1.1.1, any.these-skinny ==0.7.5, @@ -325,19 +329,19 @@ constraints: any.Cabal ==3.6.3.0, any.time-compat ==1.9.6.1, any.time-locale-compat ==0.1.1.5, any.time-manager ==0.0.0, - any.tls ==1.5.7, + any.tls ==1.6.0, any.transformers ==0.5.6.2, any.transformers-base ==0.4.6, - any.transformers-compat ==0.6.6, + any.transformers-compat ==0.7.2, any.type-equality ==1, any.type-hint ==0.1, - any.typed-process ==0.2.8.0, + any.typed-process ==0.2.10.1, any.unagi-chan ==0.4.1.4, any.unbounded-delays ==0.1.1.1, any.unix ==2.7.2.2, - any.unix-compat ==0.5.4, - any.unix-time ==0.4.7, - any.unliftio ==0.2.21.0, + any.unix-compat ==0.6, + any.unix-time ==0.4.8, + any.unliftio ==0.2.23.0, any.unliftio-core ==0.2.0.1, any.unordered-containers ==0.2.19.1, any.uri-bytestring ==0.3.3.1, @@ -351,29 +355,29 @@ constraints: any.Cabal ==3.6.3.0, any.validity-scientific ==0.2.0.3, any.vault ==0.3.1.5, any.vector ==0.12.3.1, - any.vector-algorithms ==0.8.0.4, + any.vector-algorithms ==0.9.0.1, any.vector-instances ==3.4, any.void ==0.7.3, any.wai ==3.2.3, any.wai-app-static ==3.1.7.4, - any.wai-extra ==3.1.8, + any.wai-extra ==3.1.13.0, any.wai-logger ==2.4.0, - any.warp ==3.3.19, + any.warp ==3.3.23, any.wcwidth ==0.0.2, any.websockets ==0.12.7.3, any.wide-word ==0.1.1.2, - any.witch ==1.0.0.1, + any.witch ==1.1.2.0, any.witherable ==0.4.2, any.wl-pprint-annotated ==0.1.0.1, any.word8 ==0.1.3, any.wreq ==0.5.3.3, - any.x509 ==1.7.6, + any.x509 ==1.7.7, any.x509-store ==1.6.9, any.x509-system ==1.6.7, any.x509-validation ==1.6.12, any.xml-conduit ==1.9.1.1, any.xml-lens ==0.3.1, any.xml-types ==0.3.8, - any.yaml ==0.11.7.0, - any.zlib ==0.6.2.3, -index-state: hackage.haskell.org 2022-11-09T19:03:28Z + any.yaml ==0.11.8.0, + any.zlib ==0.6.3.0, +index-state: hackage.haskell.org 2022-11-14T15:18:07Z diff --git a/flake.lock b/flake.lock index 692d25c6907..fe27364310e 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "flake-utils": { "locked": { - "lastModified": 1659877975, - "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", "owner": "numtide", "repo": "flake-utils", - "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", "type": "github" }, "original": { @@ -17,11 +17,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1664957017, - "narHash": "sha256-beO1xAHLXXfVTAq4E/pbdt+vUMgYtOGjAUyPq81LV7c=", + "lastModified": 1668504765, + "narHash": "sha256-53JeBXa/p1L3FCN8SftDViceKuhw9UaOWXJgG0QQ6PY=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "1237bfb999d269c46868b34bb4b33b5ff084ac5f", + "rev": "3586bd523f3fee68752e47f198271265bb95376b", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 1ada6f96567..a7ff1ce3959 100644 --- a/flake.nix +++ b/flake.nix @@ -30,16 +30,7 @@ }: flake-utils.lib.eachDefaultSystem (system: let - pkgs = import nixpkgs { - inherit system; - config = { - allowUnfree = true; - }; - overlays = [ - (import ./nix/overlays/ghc.nix) - (import ./nix/overlays/msodbcsql18.nix) - ]; - }; + pkgs = import ./nix/nixpkgs.nix { inherit nixpkgs system; }; in { packages.graphql-parser = (pkgs.haskell.packages.${pkgs.ghcName}.callCabal2nix "graphql-parser" ./server/lib/graphql-parser-hs { }).overrideScope ( diff --git a/nix/nixpkgs.nix b/nix/nixpkgs.nix new file mode 100644 index 00000000000..e0914e1a4f5 --- /dev/null +++ b/nix/nixpkgs.nix @@ -0,0 +1,13 @@ +{ system ? builtins.currentSystem +, nixpkgs ? (builtins.getFlake (builtins.toString ../.)).inputs.nixpkgs +}: +import nixpkgs { + inherit system; + config = { + allowUnfree = true; + }; + overlays = [ + (import ./overlays/ghc.nix) + (import ./overlays/msodbcsql18.nix) + ]; +} diff --git a/nix/overlays/ghc.nix b/nix/overlays/ghc.nix index 7b1958fa8fb..e8218bba9c7 100644 --- a/nix/overlays/ghc.nix +++ b/nix/overlays/ghc.nix @@ -2,7 +2,7 @@ self: super: let versions = import ../versions.nix { pkgs = super; }; - ghcVersion = "9.2.4"; + ghcVersion = "9.2.5"; ghcName = "ghc${builtins.replaceStrings ["."] [""] ghcVersion}"; ghcPatches = if super.stdenv.targetPlatform.isDarwin @@ -30,30 +30,21 @@ in packages = super.haskell.packages // { ${ghcName} = super.haskell.packages.${ghcName}.override { overrides = hself: hsuper: - if super.stdenv.targetPlatform.isDarwin + { + # This is due to a GHC 9.2.5 regression. + # see https://gitlab.haskell.org/ghc/ghc/-/issues/22425 + ListLike = super.haskell.lib.dontCheck hsuper.ListLike; + } // + (if super.stdenv.targetPlatform.isDarwin then # macOS-specific overrides: - let - # Ormolu v0.5.0.1 doesn't build correctly on aarch64-darwin. - # Disabling the "fixity-th" flag seems to fix it. - # https://github.com/tweag/ormolu/issues/927 - fixOrmolu = p: super.lib.pipe p [ - (super.haskell.lib.compose.addExtraLibrary hself.file-embed) - (super.haskell.lib.compose.disableCabalFlag "fixity-th") - ]; - in { # On aarch64-darwin, this creates a cycle for some reason; didn't look too much into it. ghcid = super.haskell.lib.overrideCabal hsuper.ghcid (drv: { enableSeparateBinOutput = false; }); - # See above. - ormolu = hself.ormolu_0_5_0_1; - ormolu_0_5_0_1 = fixOrmolu hsuper.ormolu_0_5_0_1; - fourmolu = hself.fourmolu_0_8_2_0; - fourmolu_0_8_2_0 = fixOrmolu hsuper.fourmolu_0_8_2_0; } else # We don't need to override anything on Linux: - { }; + { }); }; }; }; diff --git a/scripts/cabal-freeze-update.sh b/scripts/cabal-freeze-update.sh index 657ffae0bf9..2671c86ffea 100755 --- a/scripts/cabal-freeze-update.sh +++ b/scripts/cabal-freeze-update.sh @@ -44,6 +44,7 @@ fi declare -A PACKAGE_TARGETS SKIP_UPDATE=false UPGRADE_ALL=false +KEEP_TRYING=true if [[ $# -eq 0 ]]; then echo_error "expecting at least one argument" @@ -55,6 +56,7 @@ while [[ $# -gt 0 ]]; do case $1 in --normalize) SKIP_UPDATE=true + KEEP_TRYING=false shift # past argument ;; --all) @@ -107,54 +109,52 @@ else sed -i "\$s/\$/ $package_name ==$package_version,/" "$FREEZE_FILE" done - freeze_line_count_orig=$(wc -l "$FREEZE_FILE" | awk '{print $1}') - freeze_line_count_prev=$freeze_line_count_orig # mutable - while : ; do - if out=$(cabal freeze --enable-tests --enable-benchmarks --minimize-conflict-set 2>&1); then - break - else - # newline-separated: - conflict_set=$(echo "$out" | tr '\n' ' ' | sed -r 's/^.*conflict set: ([^\)]+)\).*$/\1/' | tr ',' '\n' | tr -d ' ') - if [ -z "$conflict_set" ]; then - echo_error "Something went wrong :/" - exit 77 - fi - # omit target packages: - for package_name in "${!PACKAGE_TARGETS[@]}"; do - conflict_set=$(echo "$conflict_set" | sed "/^$package_name$/d") - done - # filter conflicts from the freeze file - while IFS= read -r package_name; do - sed -ri "/\s+any.$package_name ==/d" "$FREEZE_FILE" - sed -ri "/\s+$package_name /d" "$FREEZE_FILE" # baked in flags - done <<< "$conflict_set" - - freeze_line_count=$(wc -l "$FREEZE_FILE" | awk '{print $1}') - if [ "$freeze_line_count" -eq "$freeze_line_count_prev" ]; then - # No longer making progress, so... - echo_error "It looks like we can't find a build plan :(" - echo_error "With the freeze file in its current state, try doing:" - echo_error " $ cabal freeze --enable-tests --enable-benchmarks --minimize-conflict-set" - echo_error "Exiting" - exit 31 + if "$KEEP_TRYING"; then + freeze_line_count_orig=$(wc -l "$FREEZE_FILE" | awk '{print $1}') + freeze_line_count_prev=$freeze_line_count_orig # mutable + while : ; do + if out=$(cabal freeze --enable-tests --enable-benchmarks --minimize-conflict-set 2>&1); then + break else - echo -ne "Relaxed $((freeze_line_count_orig-freeze_line_count)) constraints so far...\r" - freeze_line_count_prev=$freeze_line_count - # ...and try again + # newline-separated: + conflict_set=$(echo "$out" | tr '\n' ' ' | sed -r 's/^.*conflict set: ([^\)]+)\).*$/\1/' | tr ',' '\n' | tr -d ' ') + if [ -z "$conflict_set" ]; then + echo_error "Something went wrong :/" + exit 77 + fi + # omit target packages: + for package_name in "${!PACKAGE_TARGETS[@]}"; do + conflict_set=$(echo "$conflict_set" | sed "/^$package_name$/d") + done + # filter conflicts from the freeze file + while IFS= read -r package_name; do + sed -ri "/\s+any.$package_name ==/d" "$FREEZE_FILE" + sed -ri "/\s+$package_name /d" "$FREEZE_FILE" # baked in flags + done <<< "$conflict_set" + + freeze_line_count=$(wc -l "$FREEZE_FILE" | awk '{print $1}') + if [ "$freeze_line_count" -eq "$freeze_line_count_prev" ]; then + # No longer making progress, so... + echo_error "It looks like we can't find a build plan :(" + echo_error "With the freeze file in its current state, try doing:" + echo_error " $ cabal freeze --enable-tests --enable-benchmarks --minimize-conflict-set" + echo_error "Exiting" + exit 31 + else + echo -ne "Relaxed $((freeze_line_count_orig-freeze_line_count)) constraints so far...\r" + freeze_line_count_prev=$freeze_line_count + # ...and try again + fi fi - fi - done + done + else + cabal freeze --enable-tests --enable-benchmarks --minimize-conflict-set + fi echo fi ### Finally do a little cleanup/normalizing: -# Be a little more liberal with GHC, as we use a patched version on CI with -# performance improvements. -GHC_VERSION="$(jq -r '.ghc' ./server/VERSIONS.json)" -LIBERAL_GHC_VERSION="$(sed -r 's/[0-9]+$/\*/' <<< "$GHC_VERSION")" -sed -ri "s/(\sany\.ghc[^ ]* ==)${GHC_VERSION},$/\1${LIBERAL_GHC_VERSION},/" "$FREEZE_FILE" - # Remove graphql engine internal mono-repo packages. This doesn't matter unless # we happen to bump the version number in one of our cabal files. sed -ri "/\s+graphql-engine/d" "$FREEZE_FILE" diff --git a/server/COMPILING-ON-MACOS.md b/server/COMPILING-ON-MACOS.md index 84780acd0d9..e105cc6caa9 100644 --- a/server/COMPILING-ON-MACOS.md +++ b/server/COMPILING-ON-MACOS.md @@ -1,8 +1,8 @@ -# Compile a graphql-engine executable using brew and ghc-9.2.4 +# Compile a graphql-engine executable using brew and ghc-9.2.5 *Note: These instructions use the path `/opt/homebrew` in various places, but this path may be different on your machine depending on where you have installed homebrew (for example, many older homebrew installation were installed to `/usr/local`). You can find out the path of your homebrew installation by running the command `brew --prefix`, and if the output is not `/opt/homebrew`, then you should replace any instances of `/opt/homebrew` in these instructions with the path output by `brew --prefix`.* -1. Install ghc-9.2.4 and cabal-install via [ghcup](https://www.haskell.org/ghcup/). +1. Install ghc-9.2.5 and cabal-install via [ghcup](https://www.haskell.org/ghcup/). 2. Install dependencies: diff --git a/server/CONTRIBUTING.md b/server/CONTRIBUTING.md index e996c61d6f8..7654504b2b3 100644 --- a/server/CONTRIBUTING.md +++ b/server/CONTRIBUTING.md @@ -4,7 +4,7 @@ This guide explains how to set up the graphql-engine server for development on y ## Pre-requisites -- [GHC](https://www.haskell.org/ghc/) 9.2.4 and [cabal-install](https://cabal.readthedocs.io/en/latest/) +- [GHC](https://www.haskell.org/ghc/) 9.2.5 and [cabal-install](https://cabal.readthedocs.io/en/latest/) - There are various ways these can be installed, but [ghcup](https://www.haskell.org/ghcup/) is a good choice if you’re not sure. - There are few system packages required like `libpq-dev`, `libssl-dev`, etc. The best place to get the entire list is from the [Dockerfile](../packaging/graphql-engine-base/ubuntu.dockerfile) - Additional Haskell tools (expected versions can be found in _VERSIONS.json_): diff --git a/server/VERSIONS.json b/server/VERSIONS.json index 2130ccf3a9d..77c9b23858c 100644 --- a/server/VERSIONS.json +++ b/server/VERSIONS.json @@ -1,5 +1,5 @@ { - "ghc": "9.2.4", + "ghc": "9.2.5", "hlint": "3.4.1", "hpack": "0.34.7", "ormolu": "0.5.0.1" diff --git a/server/lib/schema-parsers/src/Hasura/GraphQL/Parser/Internal/Parser.hs b/server/lib/schema-parsers/src/Hasura/GraphQL/Parser/Internal/Parser.hs index 2bb8bd4d1bc..e44c46ffdd1 100644 --- a/server/lib/schema-parsers/src/Hasura/GraphQL/Parser/Internal/Parser.hs +++ b/server/lib/schema-parsers/src/Hasura/GraphQL/Parser/Internal/Parser.hs @@ -180,7 +180,7 @@ selectionSet name desc fields = selectionSetObject name desc fields [] safeSelectionSet :: forall n m origin a. - (MonadError ErrorMessage n, MonadParse m, Eq origin, Hashable origin, ToErrorValue origin) => + (MonadError ErrorMessage n, MonadParse m, Hashable origin, ToErrorValue origin) => Name -> Maybe Description -> [FieldParser origin m a] -> diff --git a/server/src-lib/Autodocodec/Extended.hs b/server/src-lib/Autodocodec/Extended.hs index 0dcd6e3b372..c26ba248e58 100644 --- a/server/src-lib/Autodocodec/Extended.hs +++ b/server/src-lib/Autodocodec/Extended.hs @@ -72,13 +72,13 @@ graphQLValueCodec varCodec = -- | Serializes a hash set by converting it to a list. This matches the FromJSON -- and ToJSON instances in aeson. -hashSetCodec :: (Eq a, Hashable a, HasCodec a) => JSONCodec (HashSet a) +hashSetCodec :: (Hashable a, HasCodec a) => JSONCodec (HashSet a) hashSetCodec = hashSetCodecWith codec -- | Serializes a hash set by converting it to a list. This matches the FromJSON -- and ToJSON instances in aeson. This version accepts a codec for individual -- set values as an argument. -hashSetCodecWith :: (Eq a, Hashable a) => JSONCodec a -> JSONCodec (HashSet a) +hashSetCodecWith :: Hashable a => JSONCodec a -> JSONCodec (HashSet a) hashSetCodecWith elemCodec = dimapCodec HashSet.fromList HashSet.toList $ listCodec elemCodec diff --git a/server/src-lib/Control/Monad/Circular.hs b/server/src-lib/Control/Monad/Circular.hs index bbb340a9f9a..f06a8240b6c 100644 --- a/server/src-lib/Control/Monad/Circular.hs +++ b/server/src-lib/Control/Monad/Circular.hs @@ -120,7 +120,7 @@ instance MonadState s m => MonadState s (CircularT k v m) where put x = lift $ put x -- | Runs a computation in 'CircularT'. -runCircularT :: (Eq k, Hashable k, MonadFix m) => CircularT k v m a -> m a +runCircularT :: (Hashable k, MonadFix m) => CircularT k v m a -> m a runCircularT (CircularT m) = evalStateT m mempty -- | Cache a computation under a given key. @@ -129,7 +129,7 @@ runCircularT (CircularT m) = evalStateT m mempty -- type @v@, return an action that builds said value @v@ but that prevents -- cycles by looking into and populating a stateful cache. withCircular :: - (Eq k, Hashable k, MonadFix m) => + (Hashable k, MonadFix m) => k -> CircularT k v m v -> CircularT k v m v diff --git a/server/src-lib/Data/HashMap/Strict/Extended.hs b/server/src-lib/Data/HashMap/Strict/Extended.hs index ab8a93d5f60..f663ec3c56e 100644 --- a/server/src-lib/Data/HashMap/Strict/Extended.hs +++ b/server/src-lib/Data/HashMap/Strict/Extended.hs @@ -25,7 +25,7 @@ import Data.List qualified as L import Data.List.NonEmpty (NonEmpty (..)) import Prelude -fromListOn :: (Eq k, Hashable k) => (v -> k) -> [v] -> HashMap k v +fromListOn :: Hashable k => (v -> k) -> [v] -> HashMap k v fromListOn f = M.fromList . Prelude.map (\v -> (f v, v)) -- | Given a 'Foldable' sequence of values and a function that extracts a key from each value, @@ -34,22 +34,22 @@ fromListOn f = M.fromList . Prelude.map (\v -> (f v, v)) -- -- >>> groupOn (take 1) ["foo", "bar", "baz"] -- fromList [("f", ["foo"]), ("b", ["bar", "baz"])] -groupOn :: (Eq k, Hashable k, Foldable t) => (v -> k) -> t v -> HashMap k [v] +groupOn :: (Hashable k, Foldable t) => (v -> k) -> t v -> HashMap k [v] groupOn f = fmap F.toList . groupOnNE f groupOnNE :: - (Eq k, Hashable k, Foldable t) => (v -> k) -> t v -> HashMap k (NonEmpty v) + (Hashable k, Foldable t) => (v -> k) -> t v -> HashMap k (NonEmpty v) groupOnNE f = Prelude.foldr (\v -> M.alter (Just . (v :|) . maybe [] F.toList) (f v)) M.empty differenceOn :: - (Eq k, Hashable k, Foldable t) => (v -> k) -> t v -> t v -> HashMap k v + (Hashable k, Foldable t) => (v -> k) -> t v -> t v -> HashMap k v differenceOn f = M.difference `on` (fromListOn f . F.toList) -- | Monadic version of https://hackage.haskell.org/package/unordered-containers-0.2.18.0/docs/Data-HashMap-Internal.html#v:insertWith -insertWithM :: (Monad m, Hashable k, Eq k) => (v -> v -> m v) -> k -> v -> HashMap k v -> m (HashMap k v) +insertWithM :: (Monad m, Hashable k) => (v -> v -> m v) -> k -> v -> HashMap k v -> m (HashMap k v) insertWithM f k v m = sequence $ M.insertWith @@ -69,12 +69,12 @@ insertWithM f k v m = -- 1. @∀ key ∈ A. A[key] ∈ B ∧ B[A[key]] == key@ -- 2. @∀ key ∈ B. B[key] ∈ A ∧ A[B[key]] == key@ isInverseOf :: - (Eq k, Hashable k, Eq v, Hashable v) => HashMap k v -> HashMap v k -> Bool + (Hashable k, Hashable v) => HashMap k v -> HashMap v k -> Bool lhs `isInverseOf` rhs = lhs `invertedBy` rhs && rhs `invertedBy` lhs where invertedBy :: forall s t. - (Eq s, Eq t, Hashable t) => + (Eq s, Hashable t) => HashMap s t -> HashMap t s -> Bool @@ -88,7 +88,7 @@ lhs `isInverseOf` rhs = lhs `invertedBy` rhs && rhs `invertedBy` lhs -- used to compute the result. Unlike 'unionWith', 'unionWithM' performs the -- computation in an arbitratry monad. unionWithM :: - (Monad m, Eq k, Hashable k) => + (Monad m, Hashable k) => (k -> v -> v -> m v) -> HashMap k v -> HashMap k v -> @@ -103,17 +103,17 @@ unionWithM f m1 m2 = foldM step m1 (M.toList m2) -- | Like 'M.unions', but keeping all elements in the result. unionsAll :: - (Eq k, Hashable k, Foldable t) => t (HashMap k v) -> HashMap k (NonEmpty v) + (Hashable k, Foldable t) => t (HashMap k v) -> HashMap k (NonEmpty v) unionsAll = F.foldl' (\a b -> M.unionWith (<>) a (fmap (:| []) b)) M.empty -- | Like 'M.unions', but combining elements unionsWith :: - (Eq k, Hashable k, Foldable t) => (v -> v -> v) -> t (HashMap k v) -> HashMap k v + (Hashable k, Foldable t) => (v -> v -> v) -> t (HashMap k v) -> HashMap k v unionsWith f = F.foldl' (M.unionWith f) M.empty -- | Homogenise maps, such that all maps range over the full set of -- keys, inserting a default value as needed. -homogenise :: (Hashable a, Eq a) => b -> [HashMap a b] -> (HashSet a, [HashMap a b]) +homogenise :: Hashable a => b -> [HashMap a b] -> (HashSet a, [HashMap a b]) homogenise defaultValue maps = let ks = S.unions $ L.map M.keysSet maps defaults = M.fromList [(k, defaultValue) | k <- S.toList ks] diff --git a/server/src-lib/Data/HashMap/Strict/InsOrd/Extended.hs b/server/src-lib/Data/HashMap/Strict/InsOrd/Extended.hs index ff3c46ce50b..6a6b1bfd85c 100644 --- a/server/src-lib/Data/HashMap/Strict/InsOrd/Extended.hs +++ b/server/src-lib/Data/HashMap/Strict/InsOrd/Extended.hs @@ -17,7 +17,7 @@ instance Filterable (OMap.InsOrdHashMap k) where mapMaybe = OMap.mapMaybe filter = OMap.filter -partition :: (Eq k, Hashable k) => (v -> Bool) -> OMap.InsOrdHashMap k v -> (OMap.InsOrdHashMap k v, OMap.InsOrdHashMap k v) +partition :: Hashable k => (v -> Bool) -> OMap.InsOrdHashMap k v -> (OMap.InsOrdHashMap k v, OMap.InsOrdHashMap k v) partition predicate = OMap.foldlWithKey' ( \(left, right) key val -> @@ -30,7 +30,7 @@ partition predicate = -- | Alter a hashmap using a function that can fail, in which case the entire operation fails. -- (Maybe a version with the key also being passed to the function could be useful.) alterF :: - (Functor f, Eq k, Hashable k) => + (Functor f, Hashable k) => (Maybe v -> f (Maybe v)) -> k -> InsOrdHashMap k v -> diff --git a/server/src-lib/Data/HashMap/Strict/Multi.hs b/server/src-lib/Data/HashMap/Strict/Multi.hs index 11b4b825a08..025d06f81e0 100644 --- a/server/src-lib/Data/HashMap/Strict/Multi.hs +++ b/server/src-lib/Data/HashMap/Strict/Multi.hs @@ -33,10 +33,10 @@ newtype MultiMap k v = MultiMap } deriving newtype (Eq, Show, ToJSON) -instance (Eq k, Hashable k, Ord v) => Semigroup (MultiMap k v) where +instance (Hashable k, Ord v) => Semigroup (MultiMap k v) where MultiMap m0 <> MultiMap m1 = MultiMap $ M.unionWith S.union m0 m1 -instance (Eq k, Hashable k, Ord v) => Monoid (MultiMap k v) where +instance (Hashable k, Ord v) => Monoid (MultiMap k v) where mempty = MultiMap mempty ------------------------------------------------------------------------------- @@ -59,7 +59,7 @@ toMap = unMultiMap -- If the provided list constains duplicate mappings, the resulting -- 'MultiMap' will store the set of all mapped values for each -- duplicate key. -fromList :: (Eq k, Hashable k, Ord v) => [(k, v)] -> MultiMap k v +fromList :: (Hashable k, Ord v) => [(k, v)] -> MultiMap k v fromList l = MultiMap $ M.fromListWith (S.union) $ map (fmap S.singleton) l -- | Creates an association list from a 'MultiMap'. @@ -73,14 +73,14 @@ toList (MultiMap m) = M.toList $ fmap (S.toList) m -- | Return the value to which the specified key is mapped, or 'Nothing' if -- this map contains no mapping for the key. -lookup :: (Eq k, Hashable k) => k -> MultiMap k v -> S.Set v +lookup :: Hashable k => k -> MultiMap k v -> S.Set v lookup k (MultiMap m) = fromMaybe S.empty $ M.lookup k m -- | Associate the specified value with the specified key in this map. -- -- If this map previously contained a mapping for the key, the new value is -- inserted in the set, and does not replace the previous mapping. -insert :: (Eq k, Hashable k, Ord v) => k -> v -> MultiMap k v -> MultiMap k v +insert :: (Hashable k, Ord v) => k -> v -> MultiMap k v -> MultiMap k v insert k v (MultiMap m) = MultiMap $ M.insertWith (S.union) k (S.singleton v) m -- | Returns a list of this map's keys. diff --git a/server/src-lib/Data/HashMap/Strict/NonEmpty.hs b/server/src-lib/Data/HashMap/Strict/NonEmpty.hs index db36ab5ddf9..844f6be33a6 100644 --- a/server/src-lib/Data/HashMap/Strict/NonEmpty.hs +++ b/server/src-lib/Data/HashMap/Strict/NonEmpty.hs @@ -66,12 +66,12 @@ fromHashMap m -- * if the provided list contains duplicate mappings, the later mappings take -- precedence; -- * if the provided list is empty, returns 'Nothing'. -fromList :: (Eq k, Hashable k) => [(k, v)] -> Maybe (NEHashMap k v) +fromList :: Hashable k => [(k, v)] -> Maybe (NEHashMap k v) fromList [] = Nothing fromList v = Just $ NEHashMap $ M.fromList v -- | A variant of 'fromList' that uses 'NonEmpty' inputs. -fromNonEmpty :: (Eq k, Hashable k) => NonEmpty (k, v) -> NEHashMap k v +fromNonEmpty :: Hashable k => NonEmpty (k, v) -> NEHashMap k v fromNonEmpty (x NE.:| xs) = NEHashMap (M.fromList (x : xs)) -- | Convert a non-empty map to a 'HashMap'. @@ -91,14 +91,14 @@ toList = M.toList . unNEHashMap -- | Return the value to which the specified key is mapped, or 'Nothing' if -- this map contains no mapping for the key. -lookup :: (Eq k, Hashable k) => k -> NEHashMap k v -> Maybe v +lookup :: Hashable k => k -> NEHashMap k v -> Maybe v lookup k (NEHashMap m) = M.lookup k m -- | Return the value to which the specified key is mapped, or 'Nothing' if -- this map contains no mapping for the key. -- -- This is a flipped version of 'lookup'. -(!?) :: (Eq k, Hashable k) => NEHashMap k v -> k -> Maybe v +(!?) :: Hashable k => NEHashMap k v -> k -> Maybe v (!?) = flip lookup -- | Return a list of this map's keys. @@ -111,14 +111,14 @@ keys = M.keys . unNEHashMap -- -- If a key occurs in both maps, the left map @m1@ (first argument) will be -- preferred. -union :: (Eq k, Hashable k) => NEHashMap k v -> NEHashMap k v -> NEHashMap k v +union :: Hashable k => NEHashMap k v -> NEHashMap k v -> NEHashMap k v union (NEHashMap m1) (NEHashMap m2) = NEHashMap $ M.union m1 m2 -- | The union of two maps using a given value-wise union function. -- -- If a key occurs in both maps, the provided function (first argument) will be -- used to compute the result. -unionWith :: (Eq k, Hashable k) => (v -> v -> v) -> NEHashMap k v -> NEHashMap k v -> NEHashMap k v +unionWith :: Hashable k => (v -> v -> v) -> NEHashMap k v -> NEHashMap k v -> NEHashMap k v unionWith fun (NEHashMap m1) (NEHashMap m2) = NEHashMap $ M.unionWith fun m1 m2 ------------------------------------------------------------------------------- @@ -128,7 +128,7 @@ unionWith fun (NEHashMap m1) (NEHashMap m2) = NEHashMap $ M.unionWith fun m1 m2 -- The size of the result may be smaller if f maps two or more distinct keys to -- the same new key. In this case there is no guarantee which of the associated -- values is chosen for the conflicting key. -mapKeys :: (Eq k2, Hashable k2) => (k1 -> k2) -> NEHashMap k1 v -> NEHashMap k2 v +mapKeys :: Hashable k2 => (k1 -> k2) -> NEHashMap k1 v -> NEHashMap k2 v mapKeys fun (NEHashMap m) = NEHashMap $ M.mapKeys fun m ------------------------------------------------------------------------------- @@ -140,5 +140,5 @@ mapKeys fun (NEHashMap m) = NEHashMap $ M.mapKeys fun m -- 1. @∀ key ∈ A. A[key] ∈ B ∧ B[A[key]] == key@ -- 2. @∀ key ∈ B. B[key] ∈ A ∧ A[B[key]] == key@ isInverseOf :: - (Eq k, Hashable k, Eq v, Hashable v) => NEHashMap k v -> NEHashMap v k -> Bool + (Hashable k, Hashable v) => NEHashMap k v -> NEHashMap v k -> Bool lhs `isInverseOf` rhs = toHashMap lhs `Extended.isInverseOf` toHashMap rhs diff --git a/server/src-lib/Data/List/Extended.hs b/server/src-lib/Data/List/Extended.hs index e8fc229ce49..0d7ced9276c 100644 --- a/server/src-lib/Data/List/Extended.hs +++ b/server/src-lib/Data/List/Extended.hs @@ -19,7 +19,7 @@ import Data.List qualified as L import Data.List.NonEmpty qualified as NE import Prelude -duplicates :: (Eq a, Hashable a) => [a] -> Set.HashSet a +duplicates :: Hashable a => [a] -> Set.HashSet a duplicates = Set.fromList . Map.keys . Map.filter (> 1) . Map.fromListWith (+) . map (,1 :: Int) @@ -30,13 +30,13 @@ duplicates = uniques :: (Ord a) => [a] -> [a] uniques = nubOrd -getDifference :: (Eq a, Hashable a) => [a] -> [a] -> Set.HashSet a +getDifference :: Hashable a => [a] -> [a] -> Set.HashSet a getDifference = Set.difference `on` Set.fromList -getDifferenceOn :: (Eq k, Hashable k) => (v -> k) -> [v] -> [v] -> [v] +getDifferenceOn :: Hashable k => (v -> k) -> [v] -> [v] -> [v] getDifferenceOn f l = Map.elems . Map.differenceOn f l -getOverlapWith :: (Eq k, Hashable k) => (v -> k) -> [v] -> [v] -> [(v, v)] +getOverlapWith :: Hashable k => (v -> k) -> [v] -> [v] -> [(v, v)] getOverlapWith getKey left right = Map.elems $ Map.intersectionWith (,) (mkMap left) (mkMap right) where diff --git a/server/src-lib/Data/Trie.hs b/server/src-lib/Data/Trie.hs index 5fa51e754dc..5614fcbb819 100644 --- a/server/src-lib/Data/Trie.hs +++ b/server/src-lib/Data/Trie.hs @@ -34,10 +34,10 @@ data Trie k v = Trie -- The resulting 'Trie' will contain all paths present in either tries. If both -- tries contain a value at a given path, we use the value's semigroup instance -- to compute the resulting value. -instance (Eq k, Hashable k, Semigroup v) => Semigroup (Trie k v) where +instance (Hashable k, Semigroup v) => Semigroup (Trie k v) where Trie m0 v0 <> Trie m1 v1 = Trie (M.unionWith (<>) m0 m1) (v0 <> v1) -instance (Eq k, Hashable k, Semigroup v) => Monoid (Trie k v) where +instance (Hashable k, Semigroup v) => Monoid (Trie k v) where mempty = empty instance (ToJSONKey a, ToJSON v) => ToJSON (Trie a v) @@ -61,21 +61,21 @@ singleton ps v = foldr (\p t -> Trie (M.singleton p t) Nothing) (Trie M.empty (J ------------------------------------------------------------------------------- -- | Find a value at the given path, if any. -lookup :: (Eq k, Hashable k) => [k] -> Trie k v -> Maybe v +lookup :: Hashable k => [k] -> Trie k v -> Maybe v lookup [] (Trie _ value) = value lookup (p : ps) (Trie tmap _) = lookup ps =<< M.lookup p tmap -- | Insert the given value at the given path. -- -- If there's already a value at the given path, it is replaced. -insert :: (Eq k, Hashable k) => [k] -> v -> Trie k v -> Trie k v +insert :: Hashable k => [k] -> v -> Trie k v -> Trie k v insert = insertWith const -- | Insert the value at the given path. -- -- If there's already a value at the given path, the old value is replaced by -- the result of applying the given function to the new and old value. -insertWith :: (Eq k, Hashable k) => (v -> v -> v) -> [k] -> v -> Trie k v -> Trie k v +insertWith :: Hashable k => (v -> v -> v) -> [k] -> v -> Trie k v -> Trie k v insertWith fun path newValue t = go t path where go (Trie tmap value) = \case diff --git a/server/src-lib/Hasura/GraphQL/Execute.hs b/server/src-lib/Hasura/GraphQL/Execute.hs index 7ffcdd812e9..f1a0c3d97e4 100644 --- a/server/src-lib/Hasura/GraphQL/Execute.hs +++ b/server/src-lib/Hasura/GraphQL/Execute.hs @@ -235,7 +235,7 @@ buildSubscriptionPlan userInfo rootFields parameterizedQueryHash = do pure $ IR.SourceConfigWith srcConfig queryTagsConfig (IR.QDBR newQDB) case subscriptionType of Streaming -> pure (accLiveQueryFields, OMap.insert gName (src, newQDB) accStreamingFields) - LiveQuery -> pure $ (first (OMap.insert gName (Right (src, newQDB))) accLiveQueryFields, accStreamingFields) + LiveQuery -> pure (first (OMap.insert gName (Right (src, newQDB))) accLiveQueryFields, accStreamingFields) IR.RFAction action -> do let (noRelsDBAST, remoteJoins) = RJ.getRemoteJoinsActionQuery action unless (isNothing remoteJoins) $ diff --git a/server/src-lib/Hasura/GraphQL/Execute/Remote.hs b/server/src-lib/Hasura/GraphQL/Execute/Remote.hs index 3881ecc062b..2279e0866a6 100644 --- a/server/src-lib/Hasura/GraphQL/Execute/Remote.hs +++ b/server/src-lib/Hasura/GraphQL/Execute/Remote.hs @@ -56,7 +56,7 @@ unresolveVariables = collectVariables :: forall fragments var. - (Foldable fragments, Hashable var, Eq var) => + (Foldable fragments, Hashable var) => G.SelectionSet fragments var -> Set.HashSet var collectVariables = diff --git a/server/src-lib/Hasura/GraphQL/Execute/RemoteJoin/Collect.hs b/server/src-lib/Hasura/GraphQL/Execute/RemoteJoin/Collect.hs index 5e76acc6699..0831413d010 100644 --- a/server/src-lib/Hasura/GraphQL/Execute/RemoteJoin/Collect.hs +++ b/server/src-lib/Hasura/GraphQL/Execute/RemoteJoin/Collect.hs @@ -654,7 +654,7 @@ createRemoteJoin joinColumnAliases = \case -- NOTE: if the @fieldName@ argument is a valid GraphQL name, then the -- constructed alias MUST also be a valid GraphQL name. getJoinColumnAlias :: - (Eq field, Hashable field) => + Hashable field => FieldName -> field -> HashMap field FieldName -> diff --git a/server/src-lib/Hasura/GraphQL/Execute/Subscription/TMap.hs b/server/src-lib/Hasura/GraphQL/Execute/Subscription/TMap.hs index 31d4a53b9dc..04e402994db 100644 --- a/server/src-lib/Hasura/GraphQL/Execute/Subscription/TMap.hs +++ b/server/src-lib/Hasura/GraphQL/Execute/Subscription/TMap.hs @@ -32,13 +32,13 @@ reset = flip writeTVar Map.empty . unTMap null :: TMap k v -> STM Bool null = fmap Map.null . readTVar . unTMap -lookup :: (Eq k, Hashable k) => k -> TMap k v -> STM (Maybe v) +lookup :: Hashable k => k -> TMap k v -> STM (Maybe v) lookup k = fmap (Map.lookup k) . readTVar . unTMap -insert :: (Eq k, Hashable k) => v -> k -> TMap k v -> STM () +insert :: Hashable k => v -> k -> TMap k v -> STM () insert !v k mapTv = modifyTVar' (unTMap mapTv) $ Map.insert k v -delete :: (Eq k, Hashable k) => k -> TMap k v -> STM () +delete :: Hashable k => k -> TMap k v -> STM () delete k mapTv = modifyTVar' (unTMap mapTv) $ Map.delete k toList :: TMap k v -> STM [(k, v)] @@ -50,7 +50,7 @@ filterWithKey f mapTV = modifyTVar' (unTMap mapTV) $ Map.filterWithKey f replace :: TMap k v -> Map.HashMap k v -> STM () replace mapTV v = void $ swapTVar (unTMap mapTV) v -union :: (Eq k, Hashable k) => TMap k v -> TMap k v -> STM (TMap k v) +union :: Hashable k => TMap k v -> TMap k v -> STM (TMap k v) union mapA mapB = do l <- readTVar $ unTMap mapA r <- readTVar $ unTMap mapB diff --git a/server/src-lib/Hasura/Incremental/Internal/Rule.hs b/server/src-lib/Hasura/Incremental/Internal/Rule.hs index 76c740138b2..a885c8f489a 100644 --- a/server/src-lib/Hasura/Incremental/Internal/Rule.hs +++ b/server/src-lib/Hasura/Incremental/Internal/Rule.hs @@ -310,7 +310,7 @@ instance (Monoid w, ArrowDistribute arr) => ArrowDistribute (WriterA w arr) wher instance ArrowDistribute (Rule m) where keyed :: forall a b k e s. - (Eq k, Hashable k) => + Hashable k => Rule m (e, (k, (a, s))) b -> Rule m (e, (HashMap k a, s)) (HashMap k b) keyed r0 = keyedWith HM.empty diff --git a/server/src-lib/Hasura/RQL/DDL/Metadata/Types.hs b/server/src-lib/Hasura/RQL/DDL/Metadata/Types.hs index 591d4098fb9..94136f6f664 100644 --- a/server/src-lib/Hasura/RQL/DDL/Metadata/Types.hs +++ b/server/src-lib/Hasura/RQL/DDL/Metadata/Types.hs @@ -93,7 +93,7 @@ instance (ToJSON a) => ToJSON (ReloadSpec a) where RSReloadAll -> Aeson.Bool True RSReloadList l -> Aeson.toJSON l -instance (FromJSON a, Eq a, Hashable a) => FromJSON (ReloadSpec a) where +instance (FromJSON a, Hashable a) => FromJSON (ReloadSpec a) where parseJSON (Aeson.Bool b) = pure $ if b then RSReloadAll else RSReloadList mempty parseJSON v = RSReloadList <$> Aeson.parseJSON v diff --git a/server/src-lib/Hasura/RQL/DDL/Relationship.hs b/server/src-lib/Hasura/RQL/DDL/Relationship.hs index e8f07105dda..4ec34374df4 100644 --- a/server/src-lib/Hasura/RQL/DDL/Relationship.hs +++ b/server/src-lib/Hasura/RQL/DDL/Relationship.hs @@ -221,7 +221,7 @@ mkFkeyRel relType io source rn sourceTable remoteTable remoteColumns foreignKeys <> fmap (drUsingColumnDep @b source remoteTable) (toList remoteColumns) pure (RelInfo rn relType (reverseMap (NEHashMap.toHashMap colMap)) remoteTable False io, dependencies) where - reverseMap :: Eq y => Hashable y => HashMap x y -> HashMap y x + reverseMap :: Hashable y => HashMap x y -> HashMap y x reverseMap = Map.fromList . fmap swap . Map.toList -- | Try to find a foreign key constraint, identifying a constraint by its set of columns diff --git a/server/src-lib/Hasura/RQL/DDL/Schema/Cache/Common.hs b/server/src-lib/Hasura/RQL/DDL/Schema/Cache/Common.hs index 9cfb484305c..461c884adcc 100644 --- a/server/src-lib/Hasura/RQL/DDL/Schema/Cache/Common.hs +++ b/server/src-lib/Hasura/RQL/DDL/Schema/Cache/Common.hs @@ -135,7 +135,7 @@ invalidateKeys CacheInvalidations {..} InvalidationKeys {..} = } where invalidate :: - (Eq a, Hashable a) => + Hashable a => a -> HashMap a Inc.InvalidationKey -> HashMap a Inc.InvalidationKey @@ -329,7 +329,6 @@ buildInfoMap :: ( ArrowChoice arr, Inc.ArrowDistribute arr, ArrowWriter (Seq CollectedInfo) arr, - Eq k, Hashable k ) => (a -> k) -> @@ -356,7 +355,6 @@ buildInfoMapPreservingMetadata :: ( ArrowChoice arr, Inc.ArrowDistribute arr, ArrowWriter (Seq CollectedInfo) arr, - Eq k, Hashable k ) => (a -> k) -> diff --git a/server/src-lib/Hasura/RQL/DDL/Schema/Table.hs b/server/src-lib/Hasura/RQL/DDL/Schema/Table.hs index b23a0f3d903..d8eb770ad8f 100644 --- a/server/src-lib/Hasura/RQL/DDL/Schema/Table.hs +++ b/server/src-lib/Hasura/RQL/DDL/Schema/Table.hs @@ -452,10 +452,10 @@ buildTableCache = Inc.cache proc (source, sourceConfig, dbTablesMeta, tableBuild |) (withSourceInKey source rawTableCache) returnA -< removeSourceInKey (catMaybes tableInfos) where - withSourceInKey :: (Eq k, Hashable k) => SourceName -> HashMap k v -> HashMap (SourceName, k) v + withSourceInKey :: Hashable k => SourceName -> HashMap k v -> HashMap (SourceName, k) v withSourceInKey source = mapKeys (source,) - removeSourceInKey :: (Eq k, Hashable k) => HashMap (SourceName, k) v -> HashMap k v + removeSourceInKey :: Hashable k => HashMap (SourceName, k) v -> HashMap k v removeSourceInKey = mapKeys snd withTable :: ErrorA QErr arr (e, s) a -> arr (e, ((SourceName, TableName b), s)) (Maybe a) diff --git a/server/src-lib/Hasura/RQL/Types/Allowlist.hs b/server/src-lib/Hasura/RQL/Types/Allowlist.hs index af92f6b1abf..22ef85d7a7c 100644 --- a/server/src-lib/Hasura/RQL/Types/Allowlist.hs +++ b/server/src-lib/Hasura/RQL/Types/Allowlist.hs @@ -188,7 +188,7 @@ inlineAllowlist collections allowlist = InlinedAllowlist global perRole | AllowlistEntry coll (AllowlistScopeRoles roles) <- OM.elems allowlist ] - inverseMap :: (Eq b, Hashable b) => [(a, [b])] -> HashMap b [a] + inverseMap :: Hashable b => [(a, [b])] -> HashMap b [a] inverseMap = M.fromListWith (<>) . concatMap (\(c, rs) -> [(r, [c]) | r <- rs]) global = inlineQueries globalCollections diff --git a/server/src-lib/Hasura/RQL/Types/Endpoint/Trie.hs b/server/src-lib/Hasura/RQL/Types/Endpoint/Trie.hs index c48d8de695c..202efd22d00 100644 --- a/server/src-lib/Hasura/RQL/Types/Endpoint/Trie.hs +++ b/server/src-lib/Hasura/RQL/Types/Endpoint/Trie.hs @@ -88,7 +88,7 @@ instance Monoid (MatchResult a k v) where -- | Look up the value at a path. -- @PathParam@ matches any path component. -- Returns a list of pairs containing the value found and bindings for any @PathParam@s. -lookupPath :: (Eq a, Hashable a) => [a] -> T.Trie (PathComponent a) v -> [(v, [a])] +lookupPath :: Hashable a => [a] -> T.Trie (PathComponent a) v -> [(v, [a])] lookupPath [] t = [(v, []) | v <- maybeToList (T.trieData t)] lookupPath (x : xs) t = do (pc, t') <- matchPathComponent x $ T.trieMap t @@ -98,7 +98,7 @@ lookupPath (x : xs) t = do PathParam -> (x :) <$> m where matchPathComponent :: - (Eq a, Hashable a) => + Hashable a => a -> M.HashMap (PathComponent a) v -> [(PathComponent (), v)] @@ -106,7 +106,7 @@ lookupPath (x : xs) t = do catMaybes [(PathLiteral (),) <$> M.lookup (PathLiteral a) m, (PathParam,) <$> M.lookup PathParam m] -- | Match a key @k@ and path @[a]@ against a @MultiMapPathTrie a k v@ -matchPath :: (Eq a, Eq k, Hashable k, Hashable a) => k -> [a] -> MultiMapPathTrie a k v -> MatchResult a k v +matchPath :: (Hashable k, Hashable a) => k -> [a] -> MultiMapPathTrie a k v -> MatchResult a k v matchPath k path = foldMap toResult . lookupPath path where toResult (methodMap, paramMatches) = @@ -116,7 +116,7 @@ matchPath k path = foldMap toResult . lookupPath path _ -> MatchAmbiguous -- | A version of ambiguousPaths that attempts to group all ambiguous paths that have overlapping endpoints -ambiguousPathsGrouped :: (Hashable a, Eq k, Hashable k, Ord v, Ord a) => MultiMapPathTrie a k v -> [(S.Set [PathComponent a], S.Set v)] +ambiguousPathsGrouped :: (Hashable a, Hashable k, Ord v, Ord a) => MultiMapPathTrie a k v -> [(S.Set [PathComponent a], S.Set v)] ambiguousPathsGrouped = groupAmbiguousPaths . map (first S.singleton) . ambiguousPaths groupAmbiguousPaths :: (Ord a, Ord v) => [(S.Set [PathComponent a], S.Set v)] -> [(S.Set [PathComponent a], S.Set v)] @@ -133,7 +133,7 @@ groupAmbiguousPaths (x : xs) = -- | Detect and return all ambiguous paths in the @MultiMapPathTrie@ -- A path @p@ is ambiguous if @matchPath k p@ can return @MatchAmbiguous@ for some @k@. -ambiguousPaths :: (Eq a, Hashable a, Eq k, Hashable k, Ord v) => MultiMapPathTrie a k v -> [([PathComponent a], S.Set v)] +ambiguousPaths :: (Hashable a, Hashable k, Ord v) => MultiMapPathTrie a k v -> [([PathComponent a], S.Set v)] ambiguousPaths (T.Trie pathMap methodMap) = thisNodeAmbiguousPaths ++ childNodesAmbiguousPaths where diff --git a/server/src-lib/Hasura/RQL/Types/Metadata/Common.hs b/server/src-lib/Hasura/RQL/Types/Metadata/Common.hs index bbf7f73a0bd..6fa2328868d 100644 --- a/server/src-lib/Hasura/RQL/Types/Metadata/Common.hs +++ b/server/src-lib/Hasura/RQL/Types/Metadata/Common.hs @@ -113,7 +113,7 @@ import Hasura.Session -- | Parse a list of objects into a map from a derived key, -- failing if the list has duplicates. parseListAsMap :: - (Hashable k, Eq k, T.ToTxt k) => + (Hashable k, T.ToTxt k) => Text -> (a -> k) -> Parser [a] -> diff --git a/server/src-lib/Hasura/RQL/Types/Permission.hs b/server/src-lib/Hasura/RQL/Types/Permission.hs index 616ddeeaac6..62502500988 100644 --- a/server/src-lib/Hasura/RQL/Types/Permission.hs +++ b/server/src-lib/Hasura/RQL/Types/Permission.hs @@ -316,7 +316,7 @@ instance (ToJSON rootFieldType) => ToJSON (AllowedRootFields rootFieldType) wher -- | Serializes set of allowed fields as a nullable array, where @null@ maps to -- 'ARFAllowAllRootFields', and any array value maps to -- 'ARFAllowConfiguredRootFields'. -instance (Eq rootFieldType, Hashable rootFieldType, HasCodec rootFieldType) => HasCodec (AllowedRootFields rootFieldType) where +instance (Hashable rootFieldType, HasCodec rootFieldType) => HasCodec (AllowedRootFields rootFieldType) where codec = dimapCodec dec enc $ maybeCodec $ listCodec codec where dec (Just fields) = ARFAllowConfiguredRootFields $ Set.fromList fields diff --git a/server/src-lib/Hasura/RQL/Types/Roles/Internal.hs b/server/src-lib/Hasura/RQL/Types/Roles/Internal.hs index fab99d5792e..17d69eade6a 100644 --- a/server/src-lib/Hasura/RQL/Types/Roles/Internal.hs +++ b/server/src-lib/Hasura/RQL/Types/Roles/Internal.hs @@ -131,7 +131,7 @@ class OnlyRelevantEq a where infix 4 ==~ -- same as (==) (==~) :: a -> a -> Bool -instance (Backend b, Eq a, Hashable a) => OnlyRelevantEq (GBoolExp b a) where +instance (Backend b, Hashable a) => OnlyRelevantEq (GBoolExp b a) where BoolAnd boolExpL ==~ BoolAnd boolExpR = Set.fromList boolExpL == Set.fromList boolExpR BoolOr boolExpL ==~ BoolOr boolExpR = Set.fromList boolExpL == Set.fromList boolExpR BoolNot boolExpL ==~ BoolNot boolExpR = boolExpL == boolExpR @@ -148,7 +148,6 @@ instance instance ( Backend b, - Eq (OpExpG b a), Hashable (OpExpG b a), OnlyRelevantEq (AnnBoolExp b a), OnlyRelevantEq (AnnComputedFieldBoolExp b a) diff --git a/server/src-lib/Hasura/RQL/Types/Table.hs b/server/src-lib/Hasura/RQL/Types/Table.hs index 985e94bbf02..7cf105ccd67 100644 --- a/server/src-lib/Hasura/RQL/Types/Table.hs +++ b/server/src-lib/Hasura/RQL/Types/Table.hs @@ -896,7 +896,7 @@ deriving instance (Backend b, Show a) => Show (PrimaryKey b a) instance (Backend b, NFData a) => NFData (PrimaryKey b a) -instance (Backend b, Hashable (NESeq a)) => Hashable (PrimaryKey b a) +instance (Eq a, Backend b, Hashable (NESeq a)) => Hashable (PrimaryKey b a) instance (Backend b, Cacheable a) => Cacheable (PrimaryKey b a) @@ -993,7 +993,7 @@ type TableCoreInfo b = TableCoreInfoG b (FieldInfo b) (ColumnInfo b) tciUniqueOrPrimaryKeyConstraints :: forall b f. - (Eq (Column b), Hashable (Column b)) => + Hashable (Column b) => TableCoreInfoG b f (ColumnInfo b) -> Maybe (NonEmpty (UniqueConstraint b)) tciUniqueOrPrimaryKeyConstraints info = diff --git a/server/src-lib/Hasura/Server/Auth/JWT.hs b/server/src-lib/Hasura/Server/Auth/JWT.hs index 40bb01e1b8d..d74d793333a 100644 --- a/server/src-lib/Hasura/Server/Auth/JWT.hs +++ b/server/src-lib/Hasura/Server/Auth/JWT.hs @@ -499,7 +499,7 @@ processJwt_ processJwtBytes decodeIssuer fGetHeaderType jwtCtxs headers mUnAuthR (_, [(ctx, val)]) -> withAuthZ val ctx _ -> throw400 InvalidHeaders "Could not verify JWT: Multiple JWTs found" where - intersectKeys :: (Hashable a, Eq a) => HM.HashMap a [b] -> HM.HashMap a [c] -> [(b, c)] + intersectKeys :: Hashable a => HM.HashMap a [b] -> HM.HashMap a [c] -> [(b, c)] intersectKeys m n = concatMap (uncurry cartesianProduct) $ HM.elems $ HM.intersectionWith (,) m n issuerMatch (j, b) = do diff --git a/server/src-test/Hasura/Generator/Common.hs b/server/src-test/Hasura/Generator/Common.hs index f7684364530..d248074e1be 100644 --- a/server/src-test/Hasura/Generator/Common.hs +++ b/server/src-test/Hasura/Generator/Common.hs @@ -21,7 +21,6 @@ import Language.GraphQL.Draft.Syntax qualified as G genHashMap :: MonadGen m => - Eq a => Hashable a => m a -> m b -> diff --git a/server/src-test/Hasura/QuickCheck/Instances.hs b/server/src-test/Hasura/QuickCheck/Instances.hs index e9fc409d56b..88f40186404 100644 --- a/server/src-test/Hasura/QuickCheck/Instances.hs +++ b/server/src-test/Hasura/QuickCheck/Instances.hs @@ -44,14 +44,14 @@ instance Arbitrary Text where arbitrary = T.pack <$> listOf arbitraryUnicodeChar instance - (Arbitrary k, Eq k, Hashable k, Arbitrary v) => + (Arbitrary k, Hashable k, Arbitrary v) => Arbitrary (HashMap k v) where arbitrary = HashMap.fromList <$> arbitrary shrink = fmap HashMap.fromList . shrink . HashMap.toList instance - (Arbitrary k, Eq k, Hashable k, Arbitrary v) => + (Arbitrary k, Hashable k, Arbitrary v) => Arbitrary (InsOrdHashMap k v) where arbitrary = InsOrd.HashMap.fromList <$> arbitrary @@ -67,13 +67,13 @@ instance Arbitrary HTTP.Types.Status where -- Orphan instances for types defined by us, but which are not coupled to -- GraphQL Engine. -instance (Eq k, Hashable k, Arbitrary k, Eq v, Arbitrary v) => Arbitrary (Trie.Trie k v) where +instance (Hashable k, Arbitrary k, Eq v, Arbitrary v) => Arbitrary (Trie.Trie k v) where arbitrary = Trie.Trie <$> scale (`div` 2) arbitrary <*> arbitrary shrink (Trie.Trie m v) = [Trie.Trie m v' | v' <- shrink v] ++ [Trie.Trie m' v | m' <- shrink m] -instance (Eq k, Hashable k, Arbitrary k, Ord v, Arbitrary v) => Arbitrary (MMap.MultiMap k v) where +instance (Hashable k, Arbitrary k, Ord v, Arbitrary v) => Arbitrary (MMap.MultiMap k v) where arbitrary = MMap.fromMap . fmap (Set.fromList . take 5) <$> arbitrary shrink m = map MMap.fromMap $ shrink $ MMap.toMap m diff --git a/server/src-test/Hasura/RQL/IR/Generator.hs b/server/src-test/Hasura/RQL/IR/Generator.hs index 27b3cad493e..27c5315df1b 100644 --- a/server/src-test/Hasura/RQL/IR/Generator.hs +++ b/server/src-test/Hasura/RQL/IR/Generator.hs @@ -79,8 +79,6 @@ genAnnBoolExp genAnnBoolExpFld :: MonadGen m => - Eq (ScalarType b) => - Eq (Column b) => Hashable (ScalarType b) => Hashable (Column b) => m (Column b) -> @@ -147,7 +145,6 @@ genAnnBoolExpFld genRelInfo :: MonadGen m => - Eq (Column b) => Hashable (Column b) => m (TableName b) -> m (Column b) -> @@ -172,8 +169,6 @@ genInsertOrder = element [BeforeParent, AfterParent] genAnnComputedFieldBolExp :: MonadGen m => - Eq (ScalarType b) => - Eq (Column b) => Hashable (ScalarType b) => Hashable (Column b) => m (TableName b) -> @@ -211,8 +206,6 @@ genAnnComputedFieldBolExp genComputedFieldBoolExp :: MonadGen m => - Eq (ScalarType b) => - Eq (Column b) => Hashable (ScalarType b) => Hashable (Column b) => m (TableName b) -> @@ -265,7 +258,6 @@ genComputedFieldName = ComputedFieldName <$> genNonEmptyText defaultRange genOpExpG :: MonadGen m => - Eq (ScalarType b) => Hashable (ScalarType b) => m (TableName b) -> m (Column b) -> @@ -403,8 +395,6 @@ genAnnotatedOrderByItemG genBasicOrderType genNullsOrderType genA = genAnnotatedOrderByElement :: MonadGen m => - Eq (ScalarType b) => - Eq (Column b) => Hashable (ScalarType b) => Hashable (Column b) => m (Column b) -> @@ -515,9 +505,7 @@ genAnnotatedAggregateOrderBy genComputedFieldOrderBy :: MonadGen m => - Eq (ScalarType b) => Hashable (ScalarType b) => - Eq (Column b) => Hashable (Column b) => m (Column b) -> m (ScalarType b) -> @@ -554,9 +542,7 @@ genComputedFieldOrderBy genComputedFieldOrderByElement :: MonadGen m => - Eq (ScalarType b) => Hashable (ScalarType b) => - Eq (Column b) => Hashable (Column b) => m (Column b) -> m (ScalarType b) -> diff --git a/server/src-test/Hasura/RQL/Types/EndpointSpec.hs b/server/src-test/Hasura/RQL/Types/EndpointSpec.hs index 32cc707d28e..9364121b258 100644 --- a/server/src-test/Hasura/RQL/Types/EndpointSpec.hs +++ b/server/src-test/Hasura/RQL/Types/EndpointSpec.hs @@ -23,10 +23,10 @@ emptyTrie = Trie.empty singleton :: String -> Int -> TestTrie singleton k s = Trie.singleton [] $ MMap.singleton k s -insert :: (Eq a, Hashable a, Eq k, Hashable k, Ord v) => [PathComponent a] -> k -> v -> MultiMapPathTrie a k v -> MultiMapPathTrie a k v +insert :: (Hashable a, Hashable k, Ord v) => [PathComponent a] -> k -> v -> MultiMapPathTrie a k v -> MultiMapPathTrie a k v insert p k = Trie.insertWith (<>) p . MMap.singleton k -inserts :: (Eq a, Hashable a, Eq k, Hashable k, Ord v) => [PathComponent a] -> [k] -> v -> MultiMapPathTrie a k v -> MultiMapPathTrie a k v +inserts :: (Hashable a, Hashable k, Ord v) => [PathComponent a] -> [k] -> v -> MultiMapPathTrie a k v -> MultiMapPathTrie a k v inserts p ks v t = foldl' (\t' k -> insert p k v t') t ks spec :: Spec