diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f8c26f09..0c5bf5b8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,6 +16,28 @@ jobs: - ghc928 - ghc948 - ghc962 + - ghc981 + dhall: + - false + - true + swagger: + - false + - true + swaggerWrapper: + - false + - true + largeRecords: + - false + - true + exclude: + - swagger: false + swaggerWrapper: true + - compiler: ghc962 + largeRecords: true + - compiler: ghc981 + largeRecords: true + - compiler: ghc981 + dhall: true runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3.5.3 @@ -27,5 +49,4 @@ jobs: with: name: awakesecurity authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - - run: nix-build --attr proto3-suite --argstr compiler "${{ matrix.compiler }}" --arg enableDhall true --arg enableLargeRecords false - - run: nix-build --attr proto3-suite --argstr compiler "${{ matrix.compiler }}" --arg enableDhall true --arg enableLargeRecords true + - run: nix-build --attr proto3-suite --argstr compiler "${{ matrix.compiler }}" --arg enableDhall "${{ matrix.dhall }}" --arg enableSwagger "${{ matrix.swagger }}" --arg swaggerWrapperFormat "${{ matrix.swaggerWrapper }}" --arg enableLargeRecords "${{ matrix.largeRecords }}" diff --git a/CHANGELOG.md b/CHANGELOG.md index 96f5f67e..7721c8b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,8 +7,9 @@ * Proto3.Suite.DotProto.Generate * Proto3.Suite.DotProto.Generate.LargeRecord * Proto3.Suite.DotProto.Generate.Syntax -* Add support for GHC 9.6. * Drop support for GHC 8.10. +* Add support for GHC 9.6. +* Add support for GHC 9.8. # 0.7.0 * Support GHC 9.2, 9.4. diff --git a/nix/overlays/haskell-packages.nix b/nix/overlays/haskell-packages.nix index 9e513d08..fdafc1e4 100644 --- a/nix/overlays/haskell-packages.nix +++ b/nix/overlays/haskell-packages.nix @@ -27,7 +27,118 @@ in { (haskellPackagesNew: haskellPackagesOld: { - # With nixpkgs-23.11 and ghc962, generics-sop thinks that th-abstraction is out of bounds. + # With nixpkgs-23.11 and ghc981, adjunctions wants hspec for testing, + # which causes problems. + adjunctions = + pkgsNew.haskell.lib.dontCheck haskellPackagesOld.adjunctions; + + # With nixpkgs-23.11 and ghc981, aeson-2.1.2.1 thinks that th-abstraction is out of bounds. + # Also, in order to avoid the breaking change to package structure in aeson-2.2.0.0, + # we patch the import list of aeson-2.1.2.1. + aeson = + pkgsNew.haskell.lib.doJailbreak + ( pkgsNew.haskell.lib.appendPatches haskellPackagesOld.aeson + [ ../patches/aeson-2.1.2.1.patch ] ); + + # With nixpkgs-23.11 and ghc981, atomic-write wants hspec for testing, + # which causes problems. + atomic-write = + pkgsNew.haskell.lib.dontCheck haskellPackagesOld.atomic-write; + + # With nixpkgs-23.11 and ghc981, base-compat-batteries wants hspec for testing, + # which causes problems. + base-compat-batteries = + pkgsNew.haskell.lib.dontCheck haskellPackagesOld.base-compat-batteries; + + # With nixpkgs-23.11 and ghc981, base-orphans wants hspec for testing, + # which causes problems. + base-orphans = + pkgsNew.haskell.lib.dontCheck haskellPackagesOld.base-orphans; + + # With nixpkgs-23.11 and ghc981, bifunctors wants hspec for testing, + # which causes problems. + bifunctors = + pkgsNew.haskell.lib.dontCheck haskellPackagesOld.bifunctors; + + # With nixpkgs-23.11 and ghc981, conduit wants hspec for testing, + # which causes problems. + conduit = + pkgsNew.haskell.lib.dontCheck haskellPackagesOld.conduit; + + # With nixpkgs-23.11 and ghc981, constraints wants hspec for testing, + # which causes problems. + constraints = + pkgsNew.haskell.lib.dontCheck haskellPackagesOld.constraints; + + # With nixpkgs-23.11 and ghc981, data-diverse wants hspec for testing, + # which causes problems. + data-diverse = + pkgsNew.haskell.lib.dontCheck haskellPackagesOld.data-diverse; + + # With nixpkgs-23.11 and ghc981, distribution-nixpkgs wants hspec for testing, + # which causes problems. + distribution-nixpkgs = + pkgsNew.haskell.lib.dontCheck haskellPackagesOld.distribution-nixpkgs; + + # With nixpkgs-23.11 and ghc981, distributive wants hspec for testing, + # which causes problems. + distributive = + pkgsNew.haskell.lib.dontCheck haskellPackagesOld.distributive; + + # With ghc981, doctest-0.22.2 complains about the version of the base + # package and depends on hspec for testing, which causes problems. + doctest = + pkgsNew.haskell.lib.dontCheck + (pkgsNew.haskell.lib.doJailbreak haskellPackagesOld.doctest); + + # With nixpkgs-23.11 and ghc981, generic-deriving wants hspec for testing, + # which causes problems. Also, it generic-deriving thinks that + # th-abstraction is out of bounds. + generic-deriving = + pkgsNew.haskell.lib.dontCheck + (pkgsNew.haskell.lib.doJailbreak haskellPackagesOld.generic-deriving); + + # With nixpkgs-23.11 and ghc981, half thinks that deepseq is out of bounds. + half = + pkgsNew.haskell.lib.doJailbreak haskellPackagesOld.half; + + # With nixpkgs-23.11 and ghc981, hourglass does not support the version + # of the time package that is provided, but that matters only to tests. + hourglass = + pkgsNew.haskell.lib.dontCheck haskellPackagesOld.hourglass; + + # With nixpkgs-23.11 and ghc981, hpack-0.36.0 wants hspec for testing, + # which causes problems. + hpack = + pkgsNew.haskell.lib.dontCheck haskellPackagesOld.hpack; + + # With nixpkgs-23.11 and ghc981, http-types wants hspec for testing, + # which causes problems. + http-types = + pkgsNew.haskell.lib.dontCheck haskellPackagesOld.http-types; + + # With nixpkgs-23.11 and ghc981, infer-license wants hspec for testing, + # which causes problems. + infer-license = + pkgsNew.haskell.lib.dontCheck haskellPackagesOld.infer-license; + + # With nixpkgs-23.11 and our overrides, insert-ordered-containers thinks that lens is out of bounds. + insert-ordered-containers = + pkgsNew.haskell.lib.doJailbreak haskellPackagesOld.insert-ordered-containers; + + # With nixpkgs-23.11 and ghc981, invariant indirectly depends on hspec for testing, + # which causes problems. Also, it generic-deriving thinks that + # th-abstraction is out of bounds. + invariant = + pkgsNew.haskell.lib.dontCheck + (pkgsNew.haskell.lib.doJailbreak haskellPackagesOld.invariant); + + # With nixpkgs-23.11 and ghc981, iproute wants hspec for testing, + # which causes problems. + iproute = + pkgsNew.haskell.lib.dontCheck haskellPackagesOld.iproute; + + # With nixpkgs-23.11 and ghc962, generics-sop-0.5.1.4 thinks that th-abstraction is out of bounds. generics-sop = pkgsNew.haskell.lib.doJailbreak haskellPackagesOld.generics-sop; @@ -39,6 +150,94 @@ in { large-records = pkgsNew.haskell.lib.doJailbreak haskellPackagesOld.large-records; + # With nixpkgs-23.11 and ghc981 (or perhaps our customized dependencies), + # the tests in lifted-base fail. + lifted-base = + pkgsNew.haskell.lib.dontCheck haskellPackagesOld.lifted-base; + + # With nixpkgs-23.11 and ghc981, monad-par wants test-framework for testing, which + # wants language-haskell-extract, which does not support modern template-haskell. + monad-par = + pkgsNew.haskell.lib.dontCheck haskellPackagesOld.monad-par; + + # With nixpkgs-23.11 and ghc981, mono-traversable wants hspec for testing, + # which causes problems. + mono-traversable = + pkgsNew.haskell.lib.dontCheck haskellPackagesOld.mono-traversable; + + # With nixpkgs-23.11 and our overrides, neat-interpolation that rebase is out of bounds. + neat-interpolation = + pkgsNew.haskell.lib.doJailbreak haskellPackagesOld.neat-interpolation; + + # With nixpkgs-23.11 and our overrides, rerebase that rebase is out of bounds. + rerebase = + pkgsNew.haskell.lib.doJailbreak haskellPackagesOld.rerebase; + + # With nixpkgs-23.11 and ghc981, safe-exceptions wants hspec for testing, + # which causes problems. + safe-exceptions = + pkgsNew.haskell.lib.dontCheck haskellPackagesOld.safe-exceptions; + + # With nixpkgs-23.11 and ghc981, streaming-commons wants hspec for testing, + # which causes problems. + streaming-commons = + pkgsNew.haskell.lib.dontCheck haskellPackagesOld.streaming-commons; + + # With nixpkgs-23.11 and our dependency overrides, swagger2 wants hspec for testing, + # which causes problems. Also, we jailbreak to allow a newer version of lens. + swagger2 = + pkgsNew.haskell.lib.dontCheck + (pkgsNew.haskell.lib.doJailbreak haskellPackagesOld.swagger2); + + # With nixpkgs-23.11 and ghc981, reflection indirectly depends on hspec for testing, + # which causes problems. + reflection = + pkgsNew.haskell.lib.dontCheck haskellPackagesOld.reflection; + + # With nixpkgs-23.11 and ghc981, resourceat wants hspec for testing, + # which causes problems. + resourceat = + pkgsNew.haskell.lib.dontCheck haskellPackagesOld.resourceat; + + # With nixpkgs-23.11 and ghc981, resourcet wants hspec for testing, + # which causes problems. + resourcet = + pkgsNew.haskell.lib.dontCheck haskellPackagesOld.resourcet; + + # With nixpkgs-23.11 and ghc981, tasty-discover wants hspec for testing, + # which causes problems. + tasty-discover = + pkgsNew.haskell.lib.dontCheck haskellPackagesOld.tasty-discover; + + # With nixpkgs-23.11 and ghc981, text-metrics wants hspec for testing, + # which causes problems. + text-metrics = + pkgsNew.haskell.lib.dontCheck haskellPackagesOld.text-metrics; + + # With nixpkgs-23.11 and ghc981, th-compat wants hspec for testing, + # which causes problems. + th-compat = + pkgsNew.haskell.lib.dontCheck haskellPackagesOld.th-compat; + + # With nixpkgs-23.11 and our overrides, th-lift thinks that th-abstraction is out of bounds. + th-lift = + pkgsNew.haskell.lib.doJailbreak haskellPackagesOld.th-lift; + + # With nixpkgs-23.11 and ghc981, unix-compat wants hspec for testing, + # which causes problems. + unix-compat = + pkgsNew.haskell.lib.dontCheck haskellPackagesOld.unix-compat; + + # With nixpkgs-23.11 and ghc981, hpack-0.36.0 wants hspec for testing, + # which causes problems. + unix-time = + pkgsNew.haskell.lib.dontCheck haskellPackagesOld.unix-time; + + # With nixpkgs-23.11 and ghc981, yaml wants hspec for testing, + # which causes problems. + yaml = + pkgsNew.haskell.lib.dontCheck haskellPackagesOld.yaml; + range-set-list = pkgsNew.haskell.lib.overrideCabal haskellPackagesOld.range-set-list diff --git a/nix/packages/bifunctors.nix b/nix/packages/bifunctors.nix new file mode 100644 index 00000000..f4cf326d --- /dev/null +++ b/nix/packages/bifunctors.nix @@ -0,0 +1,22 @@ +{ mkDerivation, assoc, base, comonad, containers +, foldable1-classes-compat, hspec, hspec-discover, lib, QuickCheck +, tagged, template-haskell, th-abstraction, transformers +, transformers-compat +}: +mkDerivation { + pname = "bifunctors"; + version = "5.6.2"; + sha256 = "1086a9285061eed0c2c5d3cb65aa223defd52fca6d0515bb69ddf2dbc3d9697a"; + libraryHaskellDepends = [ + assoc base comonad containers foldable1-classes-compat tagged + template-haskell th-abstraction transformers + ]; + testHaskellDepends = [ + base hspec QuickCheck template-haskell transformers + transformers-compat + ]; + testToolDepends = [ hspec-discover ]; + homepage = "http://github.com/ekmett/bifunctors/"; + description = "Bifunctors"; + license = lib.licenses.bsd3; +} diff --git a/nix/packages/cborg.nix b/nix/packages/cborg.nix new file mode 100644 index 00000000..10e1caaa --- /dev/null +++ b/nix/packages/cborg.nix @@ -0,0 +1,21 @@ +{ mkDerivation, aeson, array, base, base-orphans, base16-bytestring +, base64-bytestring, bytestring, containers, deepseq, ghc-bignum +, ghc-prim, half, lib, primitive, QuickCheck, random, scientific +, tasty, tasty-hunit, tasty-quickcheck, text, vector +}: +mkDerivation { + pname = "cborg"; + version = "0.2.10.0"; + sha256 = "17fe070c38fc498cab49bcb9d6215b7747d53bedf96502e9bcce9cad73b9c797"; + libraryHaskellDepends = [ + array base bytestring containers deepseq ghc-bignum ghc-prim half + primitive text + ]; + testHaskellDepends = [ + aeson array base base-orphans base16-bytestring base64-bytestring + bytestring deepseq half primitive QuickCheck random scientific + tasty tasty-hunit tasty-quickcheck text vector + ]; + description = "Concise Binary Object Representation (CBOR)"; + license = lib.licenses.bsd3; +} diff --git a/nix/packages/doctest.nix b/nix/packages/doctest.nix new file mode 100644 index 00000000..9e645202 --- /dev/null +++ b/nix/packages/doctest.nix @@ -0,0 +1,30 @@ +{ mkDerivation, base, code-page, deepseq, directory, exceptions +, filepath, ghc, ghc-paths, hspec, hspec-core, hspec-discover +, HUnit, lib, mockery, process, QuickCheck, setenv, silently +, stringbuilder, syb, transformers +}: +mkDerivation { + pname = "doctest"; + version = "0.22.2"; + sha256 = "afb839c14019c17e3ec7900871a9fc104226028858c724932d53225ae382c6e5"; + isLibrary = true; + isExecutable = true; + libraryHaskellDepends = [ + base code-page deepseq directory exceptions filepath ghc ghc-paths + process syb transformers + ]; + executableHaskellDepends = [ + base code-page deepseq directory exceptions filepath ghc ghc-paths + process syb transformers + ]; + testHaskellDepends = [ + base code-page deepseq directory exceptions filepath ghc ghc-paths + hspec hspec-core HUnit mockery process QuickCheck setenv silently + stringbuilder syb transformers + ]; + testToolDepends = [ hspec-discover ]; + homepage = "https://github.com/sol/doctest#readme"; + description = "Test interactive Haskell examples"; + license = lib.licenses.mit; + mainProgram = "doctest"; +} diff --git a/nix/packages/free.nix b/nix/packages/free.nix new file mode 100644 index 00000000..f19700ec --- /dev/null +++ b/nix/packages/free.nix @@ -0,0 +1,19 @@ +{ mkDerivation, base, comonad, containers, distributive, exceptions +, indexed-traversable, lib, mtl, profunctors, semigroupoids +, template-haskell, th-abstraction, transformers, transformers-base +}: +mkDerivation { + pname = "free"; + version = "5.2"; + sha256 = "72867f7c89173263765736e8d395e94291f1aaea626ecb1d673d72ce90b94f89"; + revision = "4"; + editedCabalFile = "0vic3p2viip8gjww8fx19ax6ry7y34h7xclvhzkvmbspjh9d219x"; + libraryHaskellDepends = [ + base comonad containers distributive exceptions indexed-traversable + mtl profunctors semigroupoids template-haskell th-abstraction + transformers transformers-base + ]; + homepage = "http://github.com/ekmett/free/"; + description = "Monads for free"; + license = lib.licenses.bsd3; +} diff --git a/nix/packages/generics-sop.nix b/nix/packages/generics-sop.nix new file mode 100644 index 00000000..d4661d6e --- /dev/null +++ b/nix/packages/generics-sop.nix @@ -0,0 +1,17 @@ +{ mkDerivation, base, criterion, deepseq, ghc-prim, lib, sop-core +, template-haskell, th-abstraction +}: +mkDerivation { + pname = "generics-sop"; + version = "0.5.1.4"; + sha256 = "616a1c2176097469f9514e76d979fffdbc12d569f44fd01deb14377c7888797e"; + libraryHaskellDepends = [ + base ghc-prim sop-core template-haskell th-abstraction + ]; + testHaskellDepends = [ base ]; + benchmarkHaskellDepends = [ + base criterion deepseq template-haskell + ]; + description = "Generic Programming using True Sums of Products"; + license = lib.licenses.bsd3; +} diff --git a/nix/packages/hedgehog.nix b/nix/packages/hedgehog.nix new file mode 100644 index 00000000..1c93cf21 --- /dev/null +++ b/nix/packages/hedgehog.nix @@ -0,0 +1,27 @@ +{ mkDerivation, ansi-terminal, async, barbies, base, bytestring +, concurrent-output, containers, deepseq, directory, erf +, exceptions, lib, lifted-async, mmorph, monad-control, mtl +, pretty-show, primitive, random, resourcet, safe-exceptions, stm +, template-haskell, text, time, transformers, transformers-base +, wl-pprint-annotated +}: +mkDerivation { + pname = "hedgehog"; + version = "1.4"; + sha256 = "f54afb31552e0f809030becad349cbfe19a65753a778771dc7314b2a6c41e6eb"; + revision = "5"; + editedCabalFile = "1majbvnqywyqfzm7qm7bhwmfzi3jamiz7d5ql4yvzsix8wg4rbag"; + libraryHaskellDepends = [ + ansi-terminal async barbies base bytestring concurrent-output + containers deepseq directory erf exceptions lifted-async mmorph + monad-control mtl pretty-show primitive random resourcet + safe-exceptions stm template-haskell text time transformers + transformers-base wl-pprint-annotated + ]; + testHaskellDepends = [ + base containers mmorph mtl pretty-show text transformers + ]; + homepage = "https://hedgehog.qa"; + description = "Release with confidence"; + license = lib.licenses.bsd3; +} diff --git a/nix/packages/hpack.nix b/nix/packages/hpack.nix new file mode 100644 index 00000000..8b74b68d --- /dev/null +++ b/nix/packages/hpack.nix @@ -0,0 +1,40 @@ +{ mkDerivation, aeson, base, bifunctors, bytestring, Cabal +, containers, crypton, deepseq, directory, filepath, Glob, hspec +, hspec-discover, http-client, http-client-tls, http-types, HUnit +, infer-license, interpolate, lib, mockery, mtl, pretty, QuickCheck +, scientific, template-haskell, temporary, text, transformers +, unordered-containers, vector, yaml +}: +mkDerivation { + pname = "hpack"; + version = "0.36.0"; + sha256 = "a0de4e1a0fe587030fa643cad99cd96de81e295923ffb57cfc7b1575f253ea7a"; + revision = "1"; + editedCabalFile = "1zh5rsf38xmwp7lf80iifrhnkl80lri4xzlhz2n5df3vc0dqzya8"; + isLibrary = true; + isExecutable = true; + libraryHaskellDepends = [ + aeson base bifunctors bytestring Cabal containers crypton deepseq + directory filepath Glob http-client http-client-tls http-types + infer-license mtl pretty scientific text transformers + unordered-containers vector yaml + ]; + executableHaskellDepends = [ + aeson base bifunctors bytestring Cabal containers crypton deepseq + directory filepath Glob http-client http-client-tls http-types + infer-license mtl pretty scientific text transformers + unordered-containers vector yaml + ]; + testHaskellDepends = [ + aeson base bifunctors bytestring Cabal containers crypton deepseq + directory filepath Glob hspec http-client http-client-tls + http-types HUnit infer-license interpolate mockery mtl pretty + QuickCheck scientific template-haskell temporary text transformers + unordered-containers vector yaml + ]; + testToolDepends = [ hspec-discover ]; + homepage = "https://github.com/sol/hpack#readme"; + description = "A modern format for Haskell packages"; + license = lib.licenses.mit; + mainProgram = "hpack"; +} diff --git a/nix/packages/http-client-tls.nix b/nix/packages/http-client-tls.nix new file mode 100644 index 00000000..327b2647 --- /dev/null +++ b/nix/packages/http-client-tls.nix @@ -0,0 +1,23 @@ +{ mkDerivation, base, bytestring, case-insensitive, containers +, crypton, crypton-connection, data-default-class, exceptions +, gauge, hspec, http-client, http-types, lib, memory, network +, network-uri, text, tls, transformers +}: +mkDerivation { + pname = "http-client-tls"; + version = "0.3.6.3"; + sha256 = "38dcfc3d772eb6898b4a8856d6159824d13f65eb291733619f625a802dad9095"; + libraryHaskellDepends = [ + base bytestring case-insensitive containers crypton + crypton-connection data-default-class exceptions http-client + http-types memory network network-uri text tls transformers + ]; + testHaskellDepends = [ + base crypton-connection hspec http-client http-types + ]; + benchmarkHaskellDepends = [ base gauge http-client ]; + doCheck = false; + homepage = "https://github.com/snoyberg/http-client"; + description = "http-client backend using the connection package and tls library"; + license = lib.licenses.mit; +} diff --git a/nix/packages/insert-ordered-containers.nix b/nix/packages/insert-ordered-containers.nix new file mode 100644 index 00000000..74e4bf3d --- /dev/null +++ b/nix/packages/insert-ordered-containers.nix @@ -0,0 +1,23 @@ +{ mkDerivation, aeson, base, base-compat, deepseq, hashable +, indexed-traversable, lens, lib, optics-core, optics-extra +, QuickCheck, semigroupoids, tasty, tasty-quickcheck, text +, transformers, unordered-containers +}: +mkDerivation { + pname = "insert-ordered-containers"; + version = "0.2.5.3"; + sha256 = "f04f6e59795d8e362d15422a62d7c7c48312c2d97d2bc4372002a8a9b9a2436c"; + revision = "1"; + editedCabalFile = "12fkswr70fw2av11yy45v189r6cb8fcg0l1r7mayvwha3gls0j3n"; + libraryHaskellDepends = [ + aeson base deepseq hashable indexed-traversable lens optics-core + optics-extra semigroupoids text transformers unordered-containers + ]; + testHaskellDepends = [ + aeson base base-compat hashable lens QuickCheck semigroupoids tasty + tasty-quickcheck text unordered-containers + ]; + homepage = "https://github.com/phadej/insert-ordered-containers#readme"; + description = "Associative containers retaining insertion order for traversals"; + license = lib.licenses.bsd3; +} diff --git a/nix/packages/lens.nix b/nix/packages/lens.nix new file mode 100644 index 00000000..d4955236 --- /dev/null +++ b/nix/packages/lens.nix @@ -0,0 +1,37 @@ +{ mkDerivation, array, assoc, base, base-orphans, bifunctors +, bytestring, call-stack, comonad, containers, contravariant +, criterion, deepseq, distributive, exceptions, filepath, free +, generic-deriving, ghc-prim, hashable, HUnit, indexed-traversable +, indexed-traversable-instances, kan-extensions, lib, mtl, parallel +, profunctors, QuickCheck, reflection, semigroupoids +, simple-reflect, strict, tagged, template-haskell, test-framework +, test-framework-hunit, test-framework-quickcheck2, text +, th-abstraction, these, transformers, transformers-compat +, unordered-containers, vector +}: +mkDerivation { + pname = "lens"; + version = "5.3.1"; + sha256 = "dac3ff7abd483ef36956882631fdcde922e086b51f459c0c02e690c6b7f24b6c"; + libraryHaskellDepends = [ + array assoc base base-orphans bifunctors bytestring call-stack + comonad containers contravariant distributive exceptions filepath + free ghc-prim hashable indexed-traversable + indexed-traversable-instances kan-extensions mtl parallel + profunctors reflection semigroupoids strict tagged template-haskell + text th-abstraction these transformers transformers-compat + unordered-containers vector + ]; + testHaskellDepends = [ + base bytestring containers deepseq HUnit mtl QuickCheck + simple-reflect test-framework test-framework-hunit + test-framework-quickcheck2 text transformers + ]; + benchmarkHaskellDepends = [ + base bytestring comonad containers criterion deepseq + generic-deriving transformers unordered-containers vector + ]; + homepage = "http://github.com/ekmett/lens/"; + description = "Lenses, Folds and Traversals"; + license = lib.licenses.bsd2; +} diff --git a/nix/packages/megaparsec.nix b/nix/packages/megaparsec.nix new file mode 100644 index 00000000..de9dbc69 --- /dev/null +++ b/nix/packages/megaparsec.nix @@ -0,0 +1,19 @@ +{ mkDerivation, base, bytestring, case-insensitive, containers +, criterion, deepseq, lib, mtl, parser-combinators, scientific +, text, transformers, weigh +}: +mkDerivation { + pname = "megaparsec"; + version = "9.6.1"; + sha256 = "a32257be847dbe71ac22d512ab115f9ce26fa08bcdbea7ca8b5256a1700dcbff"; + libraryHaskellDepends = [ + base bytestring case-insensitive containers deepseq mtl + parser-combinators scientific text transformers + ]; + benchmarkHaskellDepends = [ + base bytestring containers criterion deepseq text weigh + ]; + homepage = "https://github.com/mrkkrp/megaparsec"; + description = "Monadic parser combinators"; + license = lib.licenses.bsd2; +} diff --git a/nix/packages/optics-extra.nix b/nix/packages/optics-extra.nix new file mode 100644 index 00000000..2b5cb588 --- /dev/null +++ b/nix/packages/optics-extra.nix @@ -0,0 +1,18 @@ +{ mkDerivation, array, base, bytestring, containers, hashable +, indexed-profunctors, indexed-traversable-instances, lib, mtl +, optics-core, text, transformers, unordered-containers, vector +}: +mkDerivation { + pname = "optics-extra"; + version = "0.4.2.1"; + sha256 = "7e23a7a325e3448354614d3d958279c9ac2fdd0831ceee2808830e7a962fca41"; + revision = "2"; + editedCabalFile = "0w7am7pvwg4mx0nrksxgr2rvnk99nhqfpj80ig21m9xbpxsh22x4"; + libraryHaskellDepends = [ + array base bytestring containers hashable indexed-profunctors + indexed-traversable-instances mtl optics-core text transformers + unordered-containers vector + ]; + description = "Extra utilities and instances for optics-core"; + license = lib.licenses.bsd3; +} diff --git a/nix/packages/optics-th.nix b/nix/packages/optics-th.nix new file mode 100644 index 00000000..52dacdf3 --- /dev/null +++ b/nix/packages/optics-th.nix @@ -0,0 +1,17 @@ +{ mkDerivation, base, containers, lib, mtl, optics-core, tagged +, template-haskell, th-abstraction, transformers +}: +mkDerivation { + pname = "optics-th"; + version = "0.4.1"; + sha256 = "d73857b79dcd8f7c7e70fa4727f134145b62902e8d3e448f8b25c38a9da4fd17"; + revision = "7"; + editedCabalFile = "1zlx9xs8dpr3xbxsbi7pgrqkl6avs4ss2bdq8f3p2dxibr8xi4bz"; + libraryHaskellDepends = [ + base containers mtl optics-core template-haskell th-abstraction + transformers + ]; + testHaskellDepends = [ base optics-core tagged ]; + description = "Optics construction using TemplateHaskell"; + license = lib.licenses.bsd3; +} diff --git a/nix/packages/optparse-generic.nix b/nix/packages/optparse-generic.nix new file mode 100644 index 00000000..f2672979 --- /dev/null +++ b/nix/packages/optparse-generic.nix @@ -0,0 +1,20 @@ +{ mkDerivation, base, bytestring, filepath, lib, Only +, optparse-applicative, text, time, transformers +, transformers-compat, void +}: +mkDerivation { + pname = "optparse-generic"; + version = "1.5.2"; + sha256 = "c7b451f32d34124aab838fadaab4cf2e271e558ddc13a702458b6c790a2e8a35"; + revision = "1"; + editedCabalFile = "190nlp7dh878232ia2nsl75q6bzr62szl1vcyinz528lmdbnbpdc"; + isLibrary = true; + isExecutable = true; + libraryHaskellDepends = [ + base bytestring filepath Only optparse-applicative text time + transformers transformers-compat void + ]; + executableHaskellDepends = [ base ]; + description = "Auto-generate a command-line parser for your datatype"; + license = lib.licenses.bsd3; +} diff --git a/nix/packages/parsec-class.nix b/nix/packages/parsec-class.nix new file mode 100644 index 00000000..ebb55ddf --- /dev/null +++ b/nix/packages/parsec-class.nix @@ -0,0 +1,10 @@ +{ mkDerivation, base, lib, parsec }: +mkDerivation { + pname = "parsec-class"; + version = "1.0.1.0"; + sha256 = "068686c03627ffca77128a762de295c4a43095b9e8dbe3829efc91fed00c418c"; + libraryHaskellDepends = [ base parsec ]; + homepage = "https://github.com/peti/parsec-class"; + description = "Class of types that can be constructed from their text representation"; + license = lib.licenses.mit; +} diff --git a/nix/packages/rebase.nix b/nix/packages/rebase.nix new file mode 100644 index 00000000..d9f37ad9 --- /dev/null +++ b/nix/packages/rebase.nix @@ -0,0 +1,20 @@ +{ mkDerivation, base, bifunctors, bytestring, comonad, containers +, contravariant, deepseq, dlist, either, groups, hashable +, invariant, lib, mtl, profunctors, scientific, selective +, semigroupoids, stm, text, time, time-compat, transformers +, unordered-containers, uuid-types, vector, vector-instances, void +}: +mkDerivation { + pname = "rebase"; + version = "1.20.2"; + sha256 = "001297a891f30c51fa7f95d97fbb6e47c8dd4a7f13ddb371d5b5780fca7bbb92"; + libraryHaskellDepends = [ + base bifunctors bytestring comonad containers contravariant deepseq + dlist either groups hashable invariant mtl profunctors scientific + selective semigroupoids stm text time time-compat transformers + unordered-containers uuid-types vector vector-instances void + ]; + homepage = "https://github.com/nikita-volkov/rebase"; + description = "A more progressive alternative to the \"base\" package"; + license = lib.licenses.mit; +} diff --git a/nix/packages/semigroupoids.nix b/nix/packages/semigroupoids.nix new file mode 100644 index 00000000..0058ab1b --- /dev/null +++ b/nix/packages/semigroupoids.nix @@ -0,0 +1,19 @@ +{ mkDerivation, base, base-orphans, bifunctors, comonad, containers +, contravariant, distributive, foldable1-classes-compat, hashable +, lib, tagged, template-haskell, transformers, transformers-compat +, unordered-containers +}: +mkDerivation { + pname = "semigroupoids"; + version = "6.0.1"; + sha256 = "1d532030862414f5d4f2f6f001783f77aa14e5f05ee8e3c4a2d2129fca29cc1f"; + libraryHaskellDepends = [ + base base-orphans bifunctors comonad containers contravariant + distributive foldable1-classes-compat hashable tagged + template-haskell transformers transformers-compat + unordered-containers + ]; + homepage = "http://github.com/ekmett/semigroupoids"; + description = "Semigroupoids: Category sans id"; + license = lib.licenses.bsd2; +} diff --git a/nix/packages/serialise.nix b/nix/packages/serialise.nix new file mode 100644 index 00000000..530d2a5b --- /dev/null +++ b/nix/packages/serialise.nix @@ -0,0 +1,31 @@ +{ mkDerivation, aeson, array, base, binary, bytestring, cborg +, cereal, cereal-vector, containers, criterion, deepseq, directory +, fail, filepath, ghc-prim, half, hashable, lib, pretty, primitive +, QuickCheck, quickcheck-instances, semigroups, store, strict, tar +, tasty, tasty-hunit, tasty-quickcheck, text, these, time +, unordered-containers, vector, zlib +}: +mkDerivation { + pname = "serialise"; + version = "0.2.6.1"; + sha256 = "63949799ffd10675ef70ea701c1eb63e618629b3b2f7b25f07c5a966e24e77f4"; + revision = "2"; + editedCabalFile = "1y21m10vx4k75x0im5448pl5mhl772hz1hfk47ryb3whz1l6d9vf"; + libraryHaskellDepends = [ + array base bytestring cborg containers ghc-prim half hashable + primitive strict text these time unordered-containers vector + ]; + testHaskellDepends = [ + base bytestring cborg containers directory filepath primitive + QuickCheck quickcheck-instances tasty tasty-hunit tasty-quickcheck + text time unordered-containers vector + ]; + benchmarkHaskellDepends = [ + aeson array base binary bytestring cborg cereal cereal-vector + containers criterion deepseq directory fail filepath ghc-prim half + pretty semigroups store tar text time vector zlib + ]; + homepage = "https://github.com/well-typed/cborg"; + description = "A binary serialisation library for Haskell values"; + license = lib.licenses.bsd3; +} diff --git a/nix/packages/singleton-bool.nix b/nix/packages/singleton-bool.nix new file mode 100644 index 00000000..ab0cdb86 --- /dev/null +++ b/nix/packages/singleton-bool.nix @@ -0,0 +1,12 @@ +{ mkDerivation, base, boring, dec, deepseq, lib, some }: +mkDerivation { + pname = "singleton-bool"; + version = "0.1.7"; + sha256 = "1c2d196386c3697e884fcc8bef530506045a4860a5f669cc8416358b473bb29b"; + revision = "1"; + editedCabalFile = "1aqdd1bzccj8fb2fy1la9gqxvgaa2prba4wig0bnrr5vz13f487c"; + libraryHaskellDepends = [ base boring dec deepseq some ]; + homepage = "https://github.com/phadej/singleton-bool#readme"; + description = "Type level booleans"; + license = lib.licenses.bsd3; +} diff --git a/nix/packages/some.nix b/nix/packages/some.nix new file mode 100644 index 00000000..df9fdda4 --- /dev/null +++ b/nix/packages/some.nix @@ -0,0 +1,11 @@ +{ mkDerivation, base, base-orphans, deepseq, lib }: +mkDerivation { + pname = "some"; + version = "1.0.6"; + sha256 = "f7a606ad5df4a07459986364f7d739eb653495fbbe1d7158582fb29a4584bfb9"; + libraryHaskellDepends = [ base base-orphans deepseq ]; + testHaskellDepends = [ base ]; + homepage = "https://github.com/haskellari/some"; + description = "Existential type: Some"; + license = lib.licenses.bsd3; +} diff --git a/nix/packages/swagger2.nix b/nix/packages/swagger2.nix new file mode 100644 index 00000000..44c0e223 --- /dev/null +++ b/nix/packages/swagger2.nix @@ -0,0 +1,31 @@ +{ mkDerivation, aeson, aeson-pretty, base, base-compat-batteries +, bytestring, Cabal, cabal-doctest, containers, cookie, doctest +, generics-sop, Glob, hashable, hspec, hspec-discover, http-media +, HUnit, insert-ordered-containers, lens, lib, mtl, network +, optics-core, optics-th, QuickCheck, quickcheck-instances +, scientific, template-haskell, text, time, transformers +, unordered-containers, utf8-string, uuid-types, vector +}: +mkDerivation { + pname = "swagger2"; + version = "2.8.8"; + sha256 = "efbfda9ea97276ecfbcb73d79e56cc56efc05af2b35bb7444fceb497e7eb79f3"; + setupHaskellDepends = [ base Cabal cabal-doctest ]; + libraryHaskellDepends = [ + aeson aeson-pretty base base-compat-batteries bytestring containers + cookie generics-sop hashable http-media insert-ordered-containers + lens mtl network optics-core optics-th QuickCheck scientific + template-haskell text time transformers unordered-containers + uuid-types vector + ]; + testHaskellDepends = [ + aeson base base-compat-batteries bytestring containers doctest Glob + hashable hspec HUnit insert-ordered-containers lens mtl QuickCheck + quickcheck-instances template-haskell text time + unordered-containers utf8-string vector + ]; + testToolDepends = [ hspec-discover ]; + homepage = "https://github.com/GetShopTV/swagger2"; + description = "Swagger 2.0 data model"; + license = lib.licenses.bsd3; +} diff --git a/nix/packages/tagged.nix b/nix/packages/tagged.nix new file mode 100644 index 00000000..c773cf64 --- /dev/null +++ b/nix/packages/tagged.nix @@ -0,0 +1,15 @@ +{ mkDerivation, base, deepseq, lib, template-haskell, transformers +}: +mkDerivation { + pname = "tagged"; + version = "0.8.8"; + sha256 = "a083fa7835516203c168433a1c8dfc0290a94b05fedab566ad0640fc9137a6a7"; + revision = "1"; + editedCabalFile = "0chbxdppgpsrjqzf28z53x9wqwz0ncfimhfc6rr9knixvvxxx4wi"; + libraryHaskellDepends = [ + base deepseq template-haskell transformers + ]; + homepage = "http://github.com/ekmett/tagged"; + description = "Haskell 98 phantom types to avoid unsafely passing dummy arguments"; + license = lib.licenses.bsd3; +} diff --git a/nix/packages/tasty-hedgehog.nix b/nix/packages/tasty-hedgehog.nix new file mode 100644 index 00000000..ecf8f664 --- /dev/null +++ b/nix/packages/tasty-hedgehog.nix @@ -0,0 +1,17 @@ +{ mkDerivation, base, hedgehog, lib, tagged, tasty +, tasty-expected-failure +}: +mkDerivation { + pname = "tasty-hedgehog"; + version = "1.4.0.2"; + sha256 = "453484d732712525a9c74a07db5f18b5f80f867a98958e67031d8d0bfe007152"; + revision = "3"; + editedCabalFile = "1ij1h7kdbg4bd93fl9991b39xn1rkawshsh3hgbz3j2inmnljx2w"; + libraryHaskellDepends = [ base hedgehog tagged tasty ]; + testHaskellDepends = [ + base hedgehog tasty tasty-expected-failure + ]; + homepage = "https://github.com/qfpl/tasty-hedgehog"; + description = "Integration for tasty and hedgehog"; + license = lib.licenses.bsd3; +} diff --git a/nix/packages/th-abstraction.nix b/nix/packages/th-abstraction.nix new file mode 100644 index 00000000..abce3dd9 --- /dev/null +++ b/nix/packages/th-abstraction.nix @@ -0,0 +1,14 @@ +{ mkDerivation, base, containers, ghc-prim, lib, template-haskell +}: +mkDerivation { + pname = "th-abstraction"; + version = "0.7.0.0"; + sha256 = "b2854c612f2fa4adfa1ecbb4089a2211fd9cb3210aec17ba4a455ae486b22721"; + libraryHaskellDepends = [ + base containers ghc-prim template-haskell + ]; + testHaskellDepends = [ base containers template-haskell ]; + homepage = "https://github.com/glguy/th-abstraction"; + description = "Nicer interface for reified information about data types"; + license = lib.licenses.isc; +} diff --git a/nix/patches/aeson-2.1.2.1.patch b/nix/patches/aeson-2.1.2.1.patch new file mode 100644 index 00000000..d08277bb --- /dev/null +++ b/nix/patches/aeson-2.1.2.1.patch @@ -0,0 +1,11 @@ +--- a/src/Data/Aeson/Internal/Text.hs 2001-09-08 18:46:40.000000000 -0700 ++++ b/src/Data/Aeson/Internal/Text.hs 2024-05-09 21:16:49.964743729 -0700 +@@ -8,5 +8,5 @@ + import qualified Data.Text as T + + #if MIN_VERSION_text(2,0,0) +-import Data.Text.Array (Array (..)) ++import Data.Text.Array + import qualified Data.Text.Internal as T (Text (..)) + + import qualified Data.ByteString.Short.Internal as SBS diff --git a/proto3-suite.cabal b/proto3-suite.cabal index e8dbb2bc..e2bca1f6 100644 --- a/proto3-suite.cabal +++ b/proto3-suite.cabal @@ -100,20 +100,20 @@ library other-modules: Turtle.Compat - build-depends: aeson >= 1.1.1.0 && < 2.2, + build-depends: aeson >= 1.1.1.0 && < 2.3, aeson-pretty, attoparsec >= 0.13.0.1, - base >=4.8 && <5.0, + base >=4.15 && <5.0, base64-bytestring >= 1.0.0.1 && < 1.3, binary >=0.8.3, - bytestring >=0.10.6.0 && <0.12.0, - deepseq ==1.4.*, + bytestring >=0.10.6.0 && <0.13, + deepseq >=1.4 && <1.6, cereal >= 0.5.1 && <0.6, containers >=0.5 && < 0.7, contravariant >=1.4 && <1.6, filepath, foldl, - ghc >=9.0 && <9.7, + ghc >=9.0 && <9.9, hashable, insert-ordered-containers, lens, @@ -130,7 +130,7 @@ library split, system-filepath, time, - text >= 0.2 && <2.1, + text >= 0.2 && <2.2, text-short >=0.1.3 && <0.2, transformers >=0.4 && <0.7, turtle < 1.6.0 || >= 1.6.1 && < 1.7.0, @@ -192,12 +192,12 @@ test-suite tests build-depends: aeson >= 1.1.1.0 && < 2.2 , attoparsec >= 0.13.0.1 - , base >=4.8 && <5.0 + , base >=4.15 && <5.0 , base64-bytestring >= 1.0.0.1 && < 1.3 - , bytestring >=0.10.6.0 && <0.12.0 + , bytestring >=0.10.6.0 && <0.13 , cereal >= 0.5.1 && <0.6 , containers >=0.5 && < 0.7 - , deepseq ==1.4.* + , deepseq >=1.4 && <1.6 , doctest , generic-arbitrary , ghc @@ -214,7 +214,7 @@ test-suite tests , tasty-hedgehog , tasty-hunit >= 0.9 && <0.11 , tasty-quickcheck >= 0.8.4 && <0.11 - , text >= 0.2 && <2.1 + , text >= 0.2 && <2.2 , text-short >=0.1.3 && <0.2 , transformers >=0.4 && <0.7 , turtle @@ -226,7 +226,7 @@ executable compile-proto-file main-is: Main.hs hs-source-dirs: tools/compile-proto-file default-language: Haskell2010 - build-depends: base >=4.12 && <5.0 + build-depends: base >=4.15 && <5.0 , ghc , optparse-applicative , proto3-suite @@ -239,7 +239,7 @@ executable canonicalize-proto-file main-is: Main.hs hs-source-dirs: tools/canonicalize-proto-file default-language: Haskell2010 - build-depends: base >=4.11.0.0 && <5.0 + build-depends: base >=4.15 && <5.0 , containers >=0.5 && <0.7 , mtl >=2.2 && <2.4 , optparse-generic diff --git a/src/Proto3/Suite/DotProto/Generate.hs b/src/Proto3/Suite/DotProto/Generate.hs index dbb6f082..e7f101ae 100644 --- a/src/Proto3/Suite/DotProto/Generate.hs +++ b/src/Proto3/Suite/DotProto/Generate.hs @@ -43,10 +43,10 @@ import Control.Monad.IO.Class (MonadIO(..)) import Data.Char import Data.Coerce import Data.Either (partitionEithers) -import Data.List (find, intercalate, nub, sort, sortBy, stripPrefix) +import Data.List (find, intercalate, nub, sort, stripPrefix) import qualified Data.List.NonEmpty as NE import Data.List.Split (splitOn) -import Data.List.NonEmpty (NonEmpty (..)) +import Data.List.NonEmpty (NonEmpty (..)) import qualified Data.Map as M import Data.Maybe import Data.Monoid @@ -1601,21 +1601,23 @@ dotProtoEnumD parentIdent enumIdent enumParts = do let enumeratorDecls = [ (i, conIdent) | DotProtoEnumField conIdent i _options <- enumParts ] - case enumeratorDecls of + enumeratorDeclsNE <- case enumeratorDecls of [] -> throwError $ EmptyEnumeration enumName - (i, conIdent) : _ - | i == 0 -> pure () + h@(i, conIdent) : t + | i == 0 -> pure (h :| t) | otherwise -> throwError $ NonzeroFirstEnumeration enumName conIdent i - enumCons <- sortBy (comparing fst) <$> traverse (traverse (fmap (prefixedEnumFieldName enumName) . dpIdentUnqualName)) enumeratorDecls + enumCons <- NE.sortBy (comparing fst) <$> + traverse (traverse (fmap (prefixedEnumFieldName enumName) . dpIdentUnqualName)) + enumeratorDeclsNE - let enumConNames = map snd enumCons + let enumConNames = fmap snd enumCons minBoundD :: HsBind - minBoundD = functionS_ "minBound" [([], uvar_ (head enumConNames))] + minBoundD = functionS_ "minBound" [([], uvar_ (NE.head enumConNames))] maxBoundD :: HsBind - maxBoundD = functionS_ "maxBound" [([], uvar_ (last enumConNames))] + maxBoundD = functionS_ "maxBound" [([], uvar_ (NE.last enumConNames))] compareD :: HsBind compareD = functionS_ "compare" @@ -1640,13 +1642,13 @@ dotProtoEnumD parentIdent enumIdent enumParts = do fromProtoEnumD :: HsBind fromProtoEnumD = functionS_ "fromProtoEnum" [ ([ conPat (unqual_ dataName conName) [] ], intE conIdx) - | (conIdx, conName) <- enumCons + | (conIdx, conName) <- NE.toList enumCons ] toProtoEnumMayD :: HsBind toProtoEnumMayD = functionS_ "toProtoEnumMay" $ [ ([ intP conIdx ], app justC (uvar_ conName)) - | (conIdx, conName) <- enumCons ] ++ + | (conIdx, conName) <- NE.toList enumCons ] ++ [ ([ wild_ ], nothingC) ] parseJSONPBDecl :: HsBind @@ -1681,7 +1683,7 @@ dotProtoEnumD parentIdent enumIdent enumParts = do pure [ dataDecl_ enumName [] - [ conDecl_ (unqual_ dataName con) [] | con <- enumConNames ] + [ conDecl_ (unqual_ dataName con) [] | con <- NE.toList enumConNames ] defaultEnumDeriving , namedInstD enumName , hasDefaultInstD enumName @@ -1867,8 +1869,8 @@ dotProtoServiceD stringType pkgSpec ctxt serviceIdent service = do ] pure [ dataDecl_ serviceName - [ userTyVar_ () (unqual_ GHC.tvName "request") - , userTyVar_ () (unqual_ GHC.tvName "response") + [ userTyVar_ synDef (unqual_ GHC.tvName "request") + , userTyVar_ synDef (unqual_ GHC.tvName "response") ] [ conDecl ] defaultServiceDeriving @@ -2072,7 +2074,7 @@ defaultImports recordStyle ImportCustomisation{ icUsesGrpc, icStringType = Strin ] where m = GHC.mkModuleName - i n = ieName_ (unqual_ (if isLower (head n) then varName else tcName) n) + i n = ieName_ (unqual_ (if foldr (const . isLower) True n then varName else tcName) n) s n = ieName_ (unqual_ varName n) grpcNS = m "HsGRPC" diff --git a/src/Proto3/Suite/DotProto/Generate/Syntax.hs b/src/Proto3/Suite/DotProto/Generate/Syntax.hs index 8bd4e94e..c319a62e 100644 --- a/src/Proto3/Suite/DotProto/Generate/Syntax.hs +++ b/src/Proto3/Suite/DotProto/Generate/Syntax.hs @@ -21,7 +21,19 @@ import GHC.Types.Name.Occurrence (NameSpace, dataName, mkOccName, tcName, tvName import GHC.Types.Name.Reader (mkRdrQual, mkRdrUnqual, rdrNameSpace) import GHC.Types.SrcLoc (GenLocated(..), SrcSpan, generatedSrcSpan) -#if MIN_VERSION_ghc(9,6,0) +#if MIN_VERSION_ghc(9,8,0) +import Control.Arrow ((***)) +import Data.Bool (bool) +import Data.Ratio ((%)) +import Data.Void (Void) +import GHC.Hs hiding (HsBind, HsDecl, HsDerivingClause, HsOuterSigTyVarBndrs, HsTyVarBndr, HsType) +import qualified GHC.Hs as GHC (HsOuterSigTyVarBndrs) +import GHC.Types.Basic (DoPmc(..)) +import GHC.Types.Fixity (LexicalFixity(..)) +import GHC.Types.PkgQual (RawPkgQual(..)) +import GHC.Types.SourceText + (IntegralLit(..), FractionalExponentBase(..), FractionalLit(..), SourceText(..)) +#elif MIN_VERSION_ghc(9,6,0) import Control.Arrow ((***)) import Data.Bool (bool) import Data.Ratio ((%)) @@ -96,6 +108,13 @@ type HsPat = LPat GhcPs type HsQName = LIdP GhcPs type HsQOp = LHsExpr GhcPs type HsSig = LSig GhcPs +type HsTyVarBndr = LHsTyVarBndr +#if MIN_VERSION_ghc(9,8,0) + (HsBndrVis GhcPs) +#else + () +#endif + GhcPs type HsType = LHsType GhcPs type Module = ModuleName @@ -103,6 +122,10 @@ class SyntaxDefault a where synDef :: a +instance SyntaxDefault () + where + synDef = () + instance SyntaxDefault (Maybe a) where synDef = Nothing @@ -127,6 +150,14 @@ instance SyntaxDefault SrcSpan where synDef = generatedSrcSpan +#if MIN_VERSION_ghc(9,8,0) + +instance SyntaxDefault (HsBndrVis GhcPs) + where + synDef = HsBndrRequired + +#endif + #if MIN_VERSION_ghc(9,4,0) instance SyntaxDefault (SrcAnn a) @@ -384,7 +415,7 @@ importDecl_ moduleName qualified maybeAs details = noLocA ImportDecl } ieName_ :: HsName -> HsImportSpec -ieName_ = noLocA . IEVar NoExtField . noLocA . IEName +ieName_ = noLocA . IEVar synDef . noLocA . IEName #if MIN_VERSION_ghc(9,6,0) synDef #endif @@ -395,7 +426,7 @@ ieNameAll_ = noLocA . IEThingAll synDef . noLocA . IEName synDef #endif -dataDecl_ :: String -> [LHsTyVarBndr () GhcPs] -> [HsConDecl] -> [HsQName] -> HsDecl +dataDecl_ :: String -> [HsTyVarBndr] -> [HsConDecl] -> [HsQName] -> HsDecl dataDecl_ messageName bndrs constructors derivedInstances = noLocA $ GHC.TyClD NoExtField DataDecl { tcdDExt = synDef , tcdLName = unqual_ tcName messageName @@ -592,8 +623,14 @@ function_ :: HsName -> [([HsPat], HsExp)] -> HsBind function_ = functionLike_ NoSrcStrict functionLike_ :: SrcStrictness -> HsName -> [([HsPat], HsExp)] -> HsBind -functionLike_ strictness name alts = noLocA $ mkFunBind Generated name (map match alts) +functionLike_ strictness name alts = noLocA $ mkFunBind generated name (map match alts) where + generated :: Origin + generated = Generated +#if MIN_VERSION_ghc(9,8,0) + DoPmc +#endif + match :: ([HsPat], HsExp) -> HsMatch match (pats, rhs) = mkSimpleMatch ctxt pats rhs @@ -680,6 +717,9 @@ recordCtor_ nm fields = noLocA RecordCon } fieldUpd_ :: HsName -> HsExp -> LHsRecUpdField GhcPs +#if MIN_VERSION_ghc(9,8,0) + GhcPs +#endif fieldUpd_ nm val = noLocA #if MIN_VERSION_ghc(9,4,0) HsFieldBind @@ -703,12 +743,18 @@ fieldUpd_ nm val = noLocA } #endif -recordUpd_ :: HsExp -> [LHsRecUpdField GhcPs] -> HsExp +recordUpd_ :: HsExp -> [ LHsRecUpdField GhcPs +#if MIN_VERSION_ghc(9,8,0) + GhcPs +#endif + ] -> HsExp recordUpd_ r fields = noLocA RecordUpd { rupd_ext = synDef , rupd_expr = r , rupd_flds = -#if MIN_VERSION_ghc(9,2,0) +#if MIN_VERSION_ghc(9,8,0) + RegularRecUpdFields synDef +#elif MIN_VERSION_ghc(9,2,0) Left #endif fields @@ -781,9 +827,15 @@ alt_ :: HsPat -> HsExp -> HsAlt alt_ = mkHsCaseAlt case_ :: HsExp -> [HsAlt] -> HsExp -case_ e = noLocA . HsCase synDef e . mkMatchGroup Generated +case_ e = noLocA . HsCase synDef e . mkMatchGroup generated #if MIN_VERSION_ghc(9,2,0) - . noLocA + . noLocA +#endif + where + generated :: Origin + generated = Generated +#if MIN_VERSION_ghc(9,8,0) + DoPmc #endif -- | Simple let expression for ordinary bindings. diff --git a/src/Proto3/Suite/Haskell/Parser.hs b/src/Proto3/Suite/Haskell/Parser.hs index 6b6901e0..a349991e 100644 --- a/src/Proto3/Suite/Haskell/Parser.hs +++ b/src/Proto3/Suite/Haskell/Parser.hs @@ -23,7 +23,7 @@ import qualified GHC.Driver.Errors (printMessages) import GHC.Parser.Errors.Types (PsMessage) import GHC.Parser.Lexer (getPsMessages, initParserState, mkParserOpts) import GHC.Types.Error (Messages, NoDiagnosticOpts(..), partitionMessages, unionMessages) -import GHC.Utils.Error (DiagOpts(..)) +import GHC.Utils.Error (DiagOpts, emptyDiagOpts) import GHC.Utils.Logger (Logger, initLogger) import GHC.Utils.Outputable (defaultSDocContext, renderWithContext) #elif MIN_VERSION_ghc(9,4,0) @@ -93,14 +93,19 @@ parseModule logger location input = do where exts = EnumSet.fromList (languageExtensions Nothing) #if MIN_VERSION_ghc(9,4,0) - diagOpts = DiagOpts - { diag_warning_flags = mempty - , diag_fatal_warning_flags = mempty - , diag_warn_is_error = False - , diag_reverse_errors = False - , diag_max_errors = Nothing - , diag_ppr_ctx = defaultSDocContext - } + diagOpts = +#if MIN_VERSION_ghc(9,8,0) + emptyDiagOpts +#else + DiagOpts + { diag_warning_flags = mempty + , diag_fatal_warning_flags = mempty + , diag_warn_is_error = False + , diag_reverse_errors = False + , diag_max_errors = Nothing + , diag_ppr_ctx = defaultSDocContext + } +#endif parserOpts = mkParserOpts exts diagOpts [] False True True True initialState = initParserState parserOpts input location #elif MIN_VERSION_ghc(9,2,0) diff --git a/src/Proto3/Suite/JSONPB/Class.hs b/src/Proto3/Suite/JSONPB/Class.hs index f7edd1d2..89d3ec67 100644 --- a/src/Proto3/Suite/JSONPB/Class.hs +++ b/src/Proto3/Suite/JSONPB/Class.hs @@ -70,7 +70,7 @@ import qualified Data.Aeson as A (Encoding, FromJSON (..), ToJSON (..), Value (..), ToJSON1(..), FromJSON1(..), ToJSONKey(..), - decode, eitherDecode, json, + decode, eitherDecode, (.!=)) import qualified Data.Aeson.Encoding as E import qualified Data.Aeson.Encoding.Internal as E @@ -80,7 +80,7 @@ import qualified Data.Aeson.Internal as A (formatError, iparse) #if MIN_VERSION_aeson(2,0,0) import qualified Data.Aeson.Key as A #endif -import qualified Data.Aeson.Parser as A (eitherDecodeWith) +import qualified Data.Aeson.Parser as A (eitherDecodeWith, json) import qualified Data.Aeson.Types as A (Object, Pair, Parser, Series, explicitParseField,