From 033e8e04e17b67630ce8362dc067ad2fcd16cec6 Mon Sep 17 00:00:00 2001 From: Andrea Bedini Date: Tue, 3 Oct 2023 11:59:40 +0800 Subject: [PATCH 1/3] Bump base in cabal-dev-scripts.cabal Bump base in cabal-dev-scripts.cabal. We are now using GHC 9.4.7 in CI, which ships with base 4.17.2.0. I am bumping all the way to <4.19 after testing everything compiles with GHC 9.6.3 (base-4.18.1.0). --- cabal-dev-scripts/cabal-dev-scripts.cabal | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cabal-dev-scripts/cabal-dev-scripts.cabal b/cabal-dev-scripts/cabal-dev-scripts.cabal index dcf40f84371..24e160eaa92 100644 --- a/cabal-dev-scripts/cabal-dev-scripts.cabal +++ b/cabal-dev-scripts/cabal-dev-scripts.cabal @@ -18,7 +18,7 @@ executable gen-spdx ghc-options: -Wall build-depends: , aeson ^>=1.4.1.0 || ^>=1.5.2.0 || ^>=2.1.1.0 - , base >=4.10 && <4.17 + , base >=4.10 && <4.19 , bytestring , containers , Diff ^>=0.4 @@ -35,7 +35,7 @@ executable gen-spdx-exc ghc-options: -Wall build-depends: , aeson ^>=1.4.1.0 || ^>=1.5.2.0 || ^>=2.1.1.0 - , base >=4.10 && <4.17 + , base >=4.10 && <4.19 , bytestring , containers , Diff ^>=0.4 From dc08acb9cad0d900fe48da520dedf2a8b5fc9702 Mon Sep 17 00:00:00 2001 From: Andrea Bedini Date: Wed, 4 Oct 2023 17:56:14 +0800 Subject: [PATCH 2/3] Avoid OverloadedStrings when it causes troubles --- Cabal-syntax/src/Distribution/Fields/Parser.hs | 1 - Cabal-syntax/src/Distribution/InstalledPackageInfo.hs | 5 +---- Cabal-syntax/src/Distribution/Types/Dependency.hs | 8 ++++---- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/Cabal-syntax/src/Distribution/Fields/Parser.hs b/Cabal-syntax/src/Distribution/Fields/Parser.hs index 91c11ff1a63..e018caa7fe0 100644 --- a/Cabal-syntax/src/Distribution/Fields/Parser.hs +++ b/Cabal-syntax/src/Distribution/Fields/Parser.hs @@ -59,7 +59,6 @@ import qualified Data.Text.Encoding.Error as T #endif -- $setup --- >>> :set -XOverloadedStrings -- >>> import Data.Either (isLeft) -- | The 'LexState'' (with a prime) is an instance of parsec's 'Stream' diff --git a/Cabal-syntax/src/Distribution/InstalledPackageInfo.hs b/Cabal-syntax/src/Distribution/InstalledPackageInfo.hs index a84b8856efd..2c15d678335 100644 --- a/Cabal-syntax/src/Distribution/InstalledPackageInfo.hs +++ b/Cabal-syntax/src/Distribution/InstalledPackageInfo.hs @@ -62,9 +62,6 @@ import qualified Text.PrettyPrint as Disp import Distribution.Types.InstalledPackageInfo import Distribution.Types.InstalledPackageInfo.FieldGrammar --- $setup --- >>> :set -XOverloadedStrings - installedComponentId :: InstalledPackageInfo -> ComponentId installedComponentId ipi = case unComponentId (installedComponentId_ ipi) of @@ -130,7 +127,7 @@ showFullInstalledPackageInfo = P.showFields (const NoComment) . prettyFieldGramm -- | -- --- >>> let ipi = emptyInstalledPackageInfo { maintainer = "Tester" } +-- >>> let ipi = emptyInstalledPackageInfo { maintainer = fromString "Tester" } -- >>> fmap ($ ipi) $ showInstalledPackageInfoField "maintainer" -- Just "maintainer: Tester" showInstalledPackageInfoField :: String -> Maybe (InstalledPackageInfo -> String) diff --git a/Cabal-syntax/src/Distribution/Types/Dependency.hs b/Cabal-syntax/src/Distribution/Types/Dependency.hs index 959cb7bd249..10d0506b57e 100644 --- a/Cabal-syntax/src/Distribution/Types/Dependency.hs +++ b/Cabal-syntax/src/Distribution/Types/Dependency.hs @@ -78,16 +78,16 @@ instance NFData Dependency where rnf = genericRnf -- | -- --- >>> prettyShow $ Dependency "pkg" anyVersion mainLibSet +-- >>> prettyShow $ Dependency (mkPackageName "pkg") anyVersion mainLibSet -- "pkg" -- --- >>> prettyShow $ Dependency "pkg" anyVersion $ NES.insert (LSubLibName "sublib") mainLibSet +-- >>> prettyShow $ Dependency (mkPackageName "pkg") anyVersion $ NES.insert (LSubLibName $ mkUnqualComponentName "sublib") mainLibSet -- "pkg:{pkg, sublib}" -- --- >>> prettyShow $ Dependency "pkg" anyVersion $ NES.singleton (LSubLibName "sublib") +-- >>> prettyShow $ Dependency (mkPackageName "pkg") anyVersion $ NES.singleton (LSubLibName $ mkUnqualComponentName "sublib") -- "pkg:sublib" -- --- >>> prettyShow $ Dependency "pkg" anyVersion $ NES.insert (LSubLibName "sublib-b") $ NES.singleton (LSubLibName "sublib-a") +-- >>> prettyShow $ Dependency (mkPackageName "pkg") anyVersion $ NES.insert (LSubLibName $ mkUnqualComponentName "sublib-b") $ NES.singleton (LSubLibName $ mkUnqualComponentName "sublib-a") -- "pkg:{sublib-a, sublib-b}" instance Pretty Dependency where pretty (Dependency name ver sublibs) = withSubLibs (pretty name) <+> pver From ccce7c3bfb709378bb708336f660d5615f078041 Mon Sep 17 00:00:00 2001 From: Artem Pelenitsyn Date: Wed, 4 Oct 2023 09:36:12 -0400 Subject: [PATCH 3/3] doctest: provide a separate project file without -Werror (fix #9307) This became necessary after an upgrade to GHC 9.4, which, apparently, has a subtle change in how -W/-w-related things get interpreted. --- Makefile | 4 ++-- cabal.project.doctest | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 cabal.project.doctest diff --git a/Makefile b/Makefile index 6d8394aa64e..56747e4b9f5 100644 --- a/Makefile +++ b/Makefile @@ -81,8 +81,8 @@ ghcid-cli : # https://github.com/haskell/cabal/issues/8734 # Just as well, cabal-install(-solver) doctests (the target below) bitrotted and need some care. doctest : - cabal repl --with-ghc=doctest --build-depends=QuickCheck --build-depends=template-haskell --repl-options="-w" --project-file="cabal.project.validate" Cabal-syntax - cabal repl --with-ghc=doctest --build-depends=QuickCheck --build-depends=template-haskell --repl-options="-w" --project-file="cabal.project.validate" Cabal + cabal repl --with-ghc=doctest --build-depends=QuickCheck --build-depends=template-haskell --repl-options="-w" --project-file="cabal.project.doctest" Cabal-syntax + cabal repl --with-ghc=doctest --build-depends=QuickCheck --build-depends=template-haskell --repl-options="-w" --project-file="cabal.project.doctest" Cabal # This is not run as part of validate.sh (we need hackage-security, which is tricky to get). diff --git a/cabal.project.doctest b/cabal.project.doctest new file mode 100644 index 00000000000..dac9b0d88a9 --- /dev/null +++ b/cabal.project.doctest @@ -0,0 +1,24 @@ +packages: Cabal-syntax/ +packages: Cabal/ +packages: cabal-testsuite/ +packages: cabal-install/ +packages: solver-benchmarks/ + +packages: cabal-install-solver/ +packages: Cabal-QuickCheck/ +packages: Cabal-tree-diff +packages: Cabal-described +packages: Cabal-tests +packages: cabal-benchmarks + +tests: True + +-- avoiding extra dependencies +constraints: rere -rere-cfg +constraints: these -assoc + +write-ghc-environment-files: never + +program-options + ghc-options: -fno-ignore-asserts +