From 112bd5f1f3e19ab5c31348ab3e5c0cbfd43c69db Mon Sep 17 00:00:00 2001 From: John Carey Date: Wed, 8 Jan 2025 17:28:59 -0800 Subject: [PATCH 1/3] v0.8.2: Support GHC 9.10 ...and test with nixpkgs-24.11. --- .github/workflows/ci.yml | 3 + CHANGELOG.md | 4 + README.md | 8 ++ nix/nixpkgs.nix | 10 +- nix/overlays/haskell-packages.nix | 36 ++++- nix/packages/cborg.nix | 21 --- nix/packages/free.nix | 19 --- nix/packages/hedgehog.nix | 27 ---- nix/packages/hpack.nix | 40 ------ nix/packages/rebase.nix | 4 +- nix/packages/record-dot-preprocessor.nix | 17 --- nix/packages/serialise.nix | 31 ----- nix/packages/tasty-hedgehog.nix | 17 --- proto3-suite.cabal | 10 +- src/Proto3/Suite/DotProto/Generate/Syntax.hs | 133 ++++++++++++++++--- 15 files changed, 170 insertions(+), 210 deletions(-) delete mode 100644 nix/packages/cborg.nix delete mode 100644 nix/packages/free.nix delete mode 100644 nix/packages/hedgehog.nix delete mode 100644 nix/packages/hpack.nix delete mode 100644 nix/packages/record-dot-preprocessor.nix delete mode 100644 nix/packages/serialise.nix delete mode 100644 nix/packages/tasty-hedgehog.nix diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 719d3810..2ed8ff80 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,6 +17,7 @@ jobs: - ghc948 - ghc965 - ghc982 + - ghc9101 dhall: - false - true @@ -36,6 +37,8 @@ jobs: largeRecords: true - compiler: ghc982 largeRecords: true + - compiler: ghc9101 + largeRecords: true - compiler: ghc902 os: macos-latest runs-on: ${{ matrix.os }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e1cf018..12519775 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.8.2 +* Support GHC 9.10. +* Test with nixpkgs-24.11. + # 0.8.1 * Fix support for dhall-1.42. * Support dhall on GHC 9.8. diff --git a/README.md b/README.md index 849c6174..8f46c4c1 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,14 @@ for more details. ### GHC Versions +#### GHC 9.10 + +We do not support features making use of the "large-records" +library because it does not currently build on GHC 9.10, and +therefore we cannot test our support. + +Otherwise we support GHC 9.10 on Linux and Darwin. + #### GHC 9.8 We do not support features making use of the "large-records" diff --git a/nix/nixpkgs.nix b/nix/nixpkgs.nix index fd1382c9..f32361da 100644 --- a/nix/nixpkgs.nix +++ b/nix/nixpkgs.nix @@ -2,10 +2,10 @@ args: let nixpkgs = builtins.fetchTarball { - # from: https://hydra.nixos.org/job/nixos/release-24.05/nixpkgs.tarball - # build: https://hydra.nixos.org/build/262713240 - # commit: cc54fb41d13736e92229c21627ea4f22199fee6b - url = "https://hydra.nixos.org/build/262713240/download/2/nixpkgs-24.05pre631579.cc54fb41d137.tar.xz"; - sha256 = "01jgwy8ixfnl7dig5qhih34lrx2g9xpj64yr49n0lyvpwj44s475"; + # from: https://hydra.nixos.org/job/nixos/release-24.11/nixpkgs.tarball + # build: https://hydra.nixos.org/build/284195557 + # commit: cbd8ec4de4469333c82ff40d057350c30e9f7d36 + url = "https://hydra.nixos.org/build/284195557/download/2/nixpkgs-24.11pre712431.cbd8ec4de446.tar.xz"; + sha256 = "0ljq084fq784fgvm7n9081dmnjhksz20vwzca2zics0kkkzjxh5k"; }; in import nixpkgs ({ config = { }; } // args) diff --git a/nix/overlays/haskell-packages.nix b/nix/overlays/haskell-packages.nix index a70c922f..ebd158aa 100644 --- a/nix/overlays/haskell-packages.nix +++ b/nix/overlays/haskell-packages.nix @@ -58,8 +58,12 @@ in { # With nixpkgs-23.11 and ghc981, atomic-write wants hspec for testing, # which causes problems. + # + # With nixpkgs-24.11 and our overrides, atomic-write thinks that + # filepath is out of bounds. atomic-write = - pkgsNew.haskell.lib.dontCheck haskellPackagesOld.atomic-write; + pkgsNew.haskell.lib.doJailbreak + (pkgsNew.haskell.lib.dontCheck haskellPackagesOld.atomic-write); # With nixpkgs-23.11 and ghc981, base-compat-batteries wants hspec for testing, # which causes problems. @@ -118,12 +122,6 @@ in { half = pkgsNew.haskell.lib.doJailbreak haskellPackagesOld.half; - # With nixpkgs-24.05 and ghc982, we observed a non-reproducible - # failure of the hedgehog tests. Rather than risk occasional - # failures building this test dependency, we skip its tests. - hedgehog = - pkgsNew.haskell.lib.dontCheck haskellPackagesOld.hedgehog; - # 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 = @@ -172,6 +170,10 @@ in { large-records = pkgsNew.haskell.lib.doJailbreak haskellPackagesOld.large-records; + # With nixpkgs-24.11 and our overrides, lens thinks that template-haskell is out of bounds. + lens = + pkgsNew.haskell.lib.doJailbreak haskellPackagesOld.lens; + # With nixpkgs-23.11 and ghc981 (or perhaps our customized dependencies), # the tests in lifted-base fail. lifted-base = @@ -196,6 +198,14 @@ in { network-uri = pkgsNew.haskell.lib.dontCheck haskellPackagesOld.network-uri; + # With nixpkgs-24.11 and our overrides, repline thinks that containers is out of bounds. + repline = + pkgsNew.haskell.lib.doJailbreak haskellPackagesOld.repline; + + # With nixpkgs-24.11 and our overrides, serialise thinks that base is out of bounds. + serialise = + pkgsNew.haskell.lib.doJailbreak haskellPackagesOld.serialise; + # With nixpkgs-23.11 and our overrides, rerebase that rebase is out of bounds. rerebase = pkgsNew.haskell.lib.doJailbreak haskellPackagesOld.rerebase; @@ -216,6 +226,14 @@ in { pkgsNew.haskell.lib.dontCheck (pkgsNew.haskell.lib.doJailbreak haskellPackagesOld.swagger2); + # With nixpkgs-24.11 and our overrides, optics-extras thinks that containers is out of bounds. + optics-extra = + pkgsNew.haskell.lib.doJailbreak haskellPackagesOld.optics-extra; + + # With nixpkgs-24.11 and our overrides, optics-th thinks that containers and template-haskell are out of bounds. + optics-th = + pkgsNew.haskell.lib.doJailbreak haskellPackagesOld.optics-th; + # With nixpkgs-23.11 and ghc981, reflection indirectly depends on hspec for testing, # which causes problems. reflection = @@ -256,6 +274,10 @@ in { th-lift = pkgsNew.haskell.lib.doJailbreak haskellPackagesOld.th-lift; + # With nixpkgs-24.11 and our overrides, turtle thinks that filepath is out of bounds. + turtle = + pkgsNew.haskell.lib.doJailbreak haskellPackagesOld.turtle; + # With nixpkgs-23.11 and ghc981, unix-compat wants hspec for testing, # which causes problems. unix-compat = diff --git a/nix/packages/cborg.nix b/nix/packages/cborg.nix deleted file mode 100644 index 10e1caaa..00000000 --- a/nix/packages/cborg.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ 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/free.nix b/nix/packages/free.nix deleted file mode 100644 index f19700ec..00000000 --- a/nix/packages/free.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ 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/hedgehog.nix b/nix/packages/hedgehog.nix deleted file mode 100644 index 1c93cf21..00000000 --- a/nix/packages/hedgehog.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ 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 deleted file mode 100644 index 8b74b68d..00000000 --- a/nix/packages/hpack.nix +++ /dev/null @@ -1,40 +0,0 @@ -{ 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/rebase.nix b/nix/packages/rebase.nix index d9f37ad9..2b254670 100644 --- a/nix/packages/rebase.nix +++ b/nix/packages/rebase.nix @@ -6,8 +6,8 @@ }: mkDerivation { pname = "rebase"; - version = "1.20.2"; - sha256 = "001297a891f30c51fa7f95d97fbb6e47c8dd4a7f13ddb371d5b5780fca7bbb92"; + version = "1.21.1"; + sha256 = "c5967b3ace8da2e90f5a39293d2557046943423edf9ce2252918933f5c2b219a"; libraryHaskellDepends = [ base bifunctors bytestring comonad containers contravariant deepseq dlist either groups hashable invariant mtl profunctors scientific diff --git a/nix/packages/record-dot-preprocessor.nix b/nix/packages/record-dot-preprocessor.nix deleted file mode 100644 index 7ccdc579..00000000 --- a/nix/packages/record-dot-preprocessor.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ mkDerivation, base, extra, filepath, ghc, lib, record-hasfield -, uniplate -}: -mkDerivation { - pname = "record-dot-preprocessor"; - version = "0.2.17"; - sha256 = "c614e29522951a518b3257cfebb990aecdf76c4440315247e4652573121ddf4d"; - isLibrary = true; - isExecutable = true; - libraryHaskellDepends = [ base extra ghc uniplate ]; - executableHaskellDepends = [ base extra ]; - testHaskellDepends = [ base extra filepath record-hasfield ]; - homepage = "https://github.com/ndmitchell/record-dot-preprocessor#readme"; - description = "Preprocessor to allow record.field syntax"; - license = lib.licenses.bsd3; - mainProgram = "record-dot-preprocessor"; -} diff --git a/nix/packages/serialise.nix b/nix/packages/serialise.nix deleted file mode 100644 index 530d2a5b..00000000 --- a/nix/packages/serialise.nix +++ /dev/null @@ -1,31 +0,0 @@ -{ 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/tasty-hedgehog.nix b/nix/packages/tasty-hedgehog.nix deleted file mode 100644 index ecf8f664..00000000 --- a/nix/packages/tasty-hedgehog.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ 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/proto3-suite.cabal b/proto3-suite.cabal index 75c8952f..986f92cc 100644 --- a/proto3-suite.cabal +++ b/proto3-suite.cabal @@ -1,6 +1,6 @@ cabal-version: 2.2 name: proto3-suite -version: 0.8.1 +version: 0.8.2 synopsis: A higher-level API to the proto3-wire library description: This library provides a higher-level API to @@ -109,11 +109,11 @@ library bytestring >=0.10.6.0 && <0.13, deepseq >=1.4 && <1.6, cereal >= 0.5.1 && <0.6, - containers >=0.5 && < 0.7, + containers >=0.5 && <0.8, contravariant >=1.4 && <1.6, filepath, foldl, - ghc >=9.0 && <9.9, + ghc >=9.0 && <9.11, hashable, insert-ordered-containers, lens, @@ -198,7 +198,7 @@ test-suite tests , base64-bytestring >= 1.0.0.1 && < 1.3 , bytestring >=0.10.6.0 && <0.13 , cereal >= 0.5.1 && <0.6 - , containers >=0.5 && < 0.7 + , containers >=0.5 && <0.8 , deepseq >=1.4 && <1.6 , doctest , generic-arbitrary @@ -242,7 +242,7 @@ executable canonicalize-proto-file hs-source-dirs: tools/canonicalize-proto-file default-language: Haskell2010 build-depends: base >=4.15 && <5.0 - , containers >=0.5 && <0.7 + , containers >=0.5 && <0.8 , mtl >=2.2 && <2.4 , optparse-generic , proto3-suite diff --git a/src/Proto3/Suite/DotProto/Generate/Syntax.hs b/src/Proto3/Suite/DotProto/Generate/Syntax.hs index 10c6d251..b86eb0bc 100644 --- a/src/Proto3/Suite/DotProto/Generate/Syntax.hs +++ b/src/Proto3/Suite/DotProto/Generate/Syntax.hs @@ -21,6 +21,9 @@ 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,10,0) +import GHC.Types.Basic (GenReason(OtherExpansion)) +#endif #if MIN_VERSION_ghc(9,8,0) import Control.Arrow ((***)) import Data.Bool (bool) @@ -118,6 +121,13 @@ type HsTyVarBndr = LHsTyVarBndr type HsType = LHsType GhcPs type Module = ModuleName +#if MIN_VERSION_ghc(9,10,0) + +pattern VirtualBraces :: Int -> EpLayout +pattern VirtualBraces indentation = EpVirtualBraces indentation + +#endif + class SyntaxDefault a where synDef :: a @@ -126,6 +136,10 @@ instance SyntaxDefault () where synDef = () +instance (SyntaxDefault a, SyntaxDefault b, SyntaxDefault c) => SyntaxDefault (a, b, c) + where + synDef = (synDef, synDef, synDef) + instance SyntaxDefault (Maybe a) where synDef = Nothing @@ -150,24 +164,72 @@ instance SyntaxDefault SrcSpan where synDef = generatedSrcSpan -#if MIN_VERSION_ghc(9,8,0) +#if MIN_VERSION_ghc(9,10,0) + +instance SyntaxDefault AnnParen + where + synDef = noAnn + +instance SyntaxDefault AnnPragma + where + synDef = noAnn + +instance SyntaxDefault AnnSig + where + synDef = noAnn + +instance SyntaxDefault AnnsIf + where + synDef = noAnn + +instance SyntaxDefault (AnnSortKey tag) + where + synDef = NoAnnSortKey + +instance NoAnn a => SyntaxDefault (EpAnn a) + where + synDef = noAnn + +instance SyntaxDefault EpAnnHsCase + where + synDef = noAnn + +instance SyntaxDefault (EpToken token) + where + synDef = NoEpTok + +instance SyntaxDefault (EpUniToken token utoken) + where + synDef = NoEpUniTok instance SyntaxDefault (HsBndrVis GhcPs) where - synDef = HsBndrRequired + synDef = HsBndrRequired synDef #endif -#if MIN_VERSION_ghc(9,4,0) +#if MIN_VERSION_ghc(9,8,0) && !MIN_VERSION_ghc(9,10,0) -instance SyntaxDefault (SrcAnn a) +instance SyntaxDefault (HsBndrVis GhcPs) where - synDef = noSrcSpanA + synDef = HsBndrRequired + +#endif + +#if MIN_VERSION_ghc(9,4,0) instance SyntaxDefault a => SyntaxDefault (GenLocated TokenLocation a) where synDef = L NoTokenLoc synDef +#endif + +#if MIN_VERSION_ghc(9,4,0) && !MIN_VERSION_ghc(9,10,0) + +instance SyntaxDefault (SrcAnn a) + where + synDef = noSrcSpanA + instance SyntaxDefault (HsToken tok) where synDef = HsTok @@ -186,6 +248,13 @@ instance SyntaxDefault IsUnicodeSyntax #if MIN_VERSION_ghc(9,2,0) +pattern PfxCon :: [arg] -> HsConDetails Void arg r +pattern PfxCon args = PrefixCon [] args + +#endif + +#if MIN_VERSION_ghc(9,2,0) && !MIN_VERSION_ghc(9,10,0) + instance SyntaxDefault e => SyntaxDefault (GenLocated (SrcAnn a) e) where synDef = noLocA synDef @@ -202,10 +271,9 @@ instance SyntaxDefault AnnSortKey where synDef = NoAnnSortKey -pattern PfxCon :: [arg] -> HsConDetails Void arg r -pattern PfxCon args = PrefixCon [] args +#endif -#else +#if !MIN_VERSION_ghc(9,2,0) instance SyntaxDefault e => SyntaxDefault (GenLocated SrcSpan e) where @@ -280,7 +348,7 @@ apply f xs = mkHsApps f (map paren xs) appAt :: HsExp -> HsType -> HsExp appAt f t = noLocA (HsAppType synDef f -#if MIN_VERSION_ghc(9,6,0) +#if MIN_VERSION_ghc(9,6,0) && !MIN_VERSION_ghc(9,10,0) synDef #endif (HsWC NoExtField (parenTy t))) @@ -314,14 +382,15 @@ applicativeApply f = foldl snoc nil snoc g x = noLocA (OpApp synDef g apOp x) tyApp :: HsType -> HsType -> HsType -tyApp = mkHsAppTy +tyApp f = parenTy . mkHsAppTy (parenTy f) . parenTy tyApply :: HsType -> [HsType] -> HsType -tyApply f = parenTy . foldl tyApp f +tyApply = foldl tyApp -- | Whenever @f@ is not itself a type application, -- @'splitTyApp' ('tyApply' f as) = (f, as)@. splitTyApp :: HsType -> (HsType, [HsType]) +splitTyApp (L _ (GHC.HsParTy _ x)) = splitTyApp x splitTyApp (L _ (GHC.HsAppTy NoExtField x y)) = (++ [y]) <$> splitTyApp x splitTyApp x = (x, []) @@ -415,15 +484,31 @@ importDecl_ moduleName qualified maybeAs details = noLocA ImportDecl } ieName_ :: HsName -> HsImportSpec -ieName_ = noLocA . IEVar synDef . noLocA . IEName +ieName_ = + noLocA . +#if MIN_VERSION_ghc(9,10,0) + flip (IEVar synDef) Nothing . +#else + IEVar synDef . +#endif + noLocA . + IEName #if MIN_VERSION_ghc(9,6,0) - synDef + synDef #endif ieNameAll_ :: HsName -> HsImportSpec -ieNameAll_ = noLocA . IEThingAll synDef . noLocA . IEName +ieNameAll_ = + noLocA . +#if MIN_VERSION_ghc(9,10,0) + flip (IEThingAll synDef) Nothing . +#else + (IEThingAll synDef) . +#endif + noLocA . + IEName #if MIN_VERSION_ghc(9,6,0) - synDef + synDef #endif dataDecl_ :: String -> [HsTyVarBndr] -> [HsConDecl] -> [HsQName] -> HsDecl @@ -603,6 +688,9 @@ patBind_ (L _ (LazyPat _ (L _ (VarPat _ nm)))) rhs = patBind_ pat rhs = noLocA PatBind { pat_ext = synDef , pat_lhs = pat +#if MIN_VERSION_ghc(9,10,0) + , pat_mult = HsNoMultAnn synDef +#endif , pat_rhs = #if MIN_VERSION_ghc(9,2,0) unguardedGRHSs synDef rhs synDef @@ -627,14 +715,16 @@ functionLike_ strictness name alts = noLocA $ mkFunBind generated name (map matc where generated :: Origin generated = Generated +#if MIN_VERSION_ghc(9,10,0) + OtherExpansion +#endif #if MIN_VERSION_ghc(9,8,0) - DoPmc + DoPmc #endif match :: ([HsPat], HsExp) -> HsMatch match (pats, rhs) = mkSimpleMatch ctxt pats rhs - ctxt :: HsMatchContext GhcPs ctxt = FunRhs { mc_fun = name , mc_fixity = Prefix @@ -834,14 +924,19 @@ case_ e = noLocA . HsCase synDef e . mkMatchGroup generated where generated :: Origin generated = Generated +#if MIN_VERSION_ghc(9,10,0) + OtherExpansion +#endif #if MIN_VERSION_ghc(9,8,0) - DoPmc + DoPmc #endif -- | Simple let expression for ordinary bindings. let_ :: [HsBind] -> HsExp -> HsExp let_ locals e = -#if MIN_VERSION_ghc(9,4,0) +#if MIN_VERSION_ghc(9,10,0) + noLocA $ HsLet synDef binds e +#elif MIN_VERSION_ghc(9,4,0) noLocA $ HsLet synDef synDef binds synDef e #elif MIN_VERSION_ghc(9,2,0) noLocA $ HsLet synDef binds e From 50d901decc7dcb407300289074681b5991aabe5e Mon Sep 17 00:00:00 2001 From: John Carey Date: Fri, 10 Jan 2025 15:08:41 -0800 Subject: [PATCH 2/3] Attempt to fix dependencies for earlier versions of GHC. --- nix/overlays/haskell-packages.nix | 9 +++++---- nix/packages/rebase.nix | 20 -------------------- 2 files changed, 5 insertions(+), 24 deletions(-) delete mode 100644 nix/packages/rebase.nix diff --git a/nix/overlays/haskell-packages.nix b/nix/overlays/haskell-packages.nix index ebd158aa..9710e609 100644 --- a/nix/overlays/haskell-packages.nix +++ b/nix/overlays/haskell-packages.nix @@ -80,6 +80,11 @@ in { bifunctors = pkgsNew.haskell.lib.dontCheck haskellPackagesOld.bifunctors; + # With nixpkgs-24.11 and our overrides, cabal-install-solver does + # not like the version of directory when building with GHC 9.0. + cabal-install-solver = + pkgsNew.haskell.lib.doJailbreak haskellPackagesOld.cabal-install-solver; + # With nixpkgs-23.11 and ghc981, conduit wants hspec for testing, # which causes problems. conduit = @@ -206,10 +211,6 @@ in { serialise = pkgsNew.haskell.lib.doJailbreak haskellPackagesOld.serialise; - # 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 = diff --git a/nix/packages/rebase.nix b/nix/packages/rebase.nix deleted file mode 100644 index 2b254670..00000000 --- a/nix/packages/rebase.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ 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.21.1"; - sha256 = "c5967b3ace8da2e90f5a39293d2557046943423edf9ce2252918933f5c2b219a"; - 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; -} From c385c4d264ea6e9899954288014638b998cae7a1 Mon Sep 17 00:00:00 2001 From: John Carey Date: Thu, 16 Jan 2025 15:59:49 -0800 Subject: [PATCH 3/3] Use a proto3-wire that supports GHC 9.10. --- nix/overlays/haskell-packages.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nix/overlays/haskell-packages.nix b/nix/overlays/haskell-packages.nix index 9710e609..621b8423 100644 --- a/nix/overlays/haskell-packages.nix +++ b/nix/overlays/haskell-packages.nix @@ -309,8 +309,8 @@ in { source = pkgsNew.fetchFromGitHub { owner = "awakesecurity"; repo = "proto3-wire"; - rev = "b3d837f66d97f97f1ad46c5bb0f1d1bb3b7b13c1"; # 1.4.2 - sha256 = "LXinRHg7fjBf9of7pDm/oWAacCwJ9x/PtnJz6S0W/FA="; + rev = "6fdf0eb93b2028ade0e3e011ce8429c94546839e"; # 1.4.4 + sha256 = "fGPcpv1AFLbmEg9ZRiBbto3el49pHfPIIxQT6U2mebQ="; }; in pkgsNew.haskell.lib.doJailbreak