From 356c2f4cc8d205de4b79c28e287735f457924ab4 Mon Sep 17 00:00:00 2001 From: Nadia Yvette Chambers Date: Fri, 26 Jul 2024 07:58:51 -0400 Subject: [PATCH] rm-old-base: remove ifdefs for pre-4.13 bases (#10092) * rm-old-base: remove ifdefs for pre-4.13 bases 4.13 and older have fallen out of the support window. Hence this commit removes code only conditionally included for base 4.13 and older. Some occasional transitive removals were implied and done in this same commit. * Remove 8.6.5 from CI and Makefile * Remove test for GHC <8.6.5 * Update GHC versions mentioned in the user guide * rm-old-base: use Distribution.Compat.Prelude The change was likely an artifact of a rebase. * rm-old-base: restore builds not of cabal itself The #ifdefs being generated need to be kept here so that projects other than cabal can be built using older ghc versions and current cabal versions. * rm-old-base: restore older catchIO This needs to be included so running with older bases and ghcs can be done even while building cabal itself demands recent ghcs. * Bump base lower bounds to >=4.13 * Update a few package version in the documentation * rm-old-base: remove Distribution.Compat.Typeable It's not needed with our currently supported ghcs. * rm-old-base: restore T6906 --------- Co-authored-by: Andrea Bedini Co-authored-by: brandon s allbery kf8nh Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- .github/workflows/validate.yml | 121 +++++++++--------- .../src/Test/QuickCheck/GenericArbitrary.hs | 4 - .../src/Test/QuickCheck/Instances/Cabal.hs | 16 +-- Cabal-hooks/Cabal-hooks.cabal | 2 +- Cabal-syntax/Cabal-syntax.cabal | 3 +- Cabal-syntax/src/Distribution/Compat/Graph.hs | 16 +-- .../src/Distribution/Compat/Newtype.hs | 17 +-- .../src/Distribution/Compat/NonEmptySet.hs | 7 +- .../src/Distribution/Compat/Prelude.hs | 13 +- .../src/Distribution/Compat/Typeable.hs | 19 --- .../src/Distribution/Fields/ParseResult.hs | 21 +-- Cabal-syntax/src/Distribution/Parsec.hs | 4 - Cabal-syntax/src/Distribution/System.hs | 4 - .../src/Distribution/Utils/Structured.hs | 2 +- Cabal-tests/Cabal-tests.cabal | 3 +- .../UnitTests/Distribution/Utils/CharSet.hs | 4 - .../Distribution/Utils/Structured.hs | 2 - Cabal-tests/tests/UnitTests/Orphans.hs | 10 -- Cabal-tests/tests/custom-setup/IdrisSetup.hs | 9 -- Cabal/Cabal.cabal | 3 +- Cabal/src/Distribution/Compat/Async.hs | 10 +- Cabal/src/Distribution/Compat/ResponseFile.hs | 54 +------- Cabal/src/Distribution/Compat/Stack.hs | 74 +---------- Cabal/src/Distribution/Compat/Time.hs | 10 -- Makefile | 6 - cabal-dev-scripts/cabal-dev-scripts.cabal | 4 +- .../cabal-install-solver.cabal | 4 +- cabal-install/cabal-install.cabal | 2 +- .../src/Distribution/Client/Compat/Orphans.hs | 2 +- .../src/Distribution/Client/FileMonitor.hs | 7 +- .../src/Distribution/Client/ProjectConfig.hs | 40 +----- .../Client/ProjectOrchestration.hs | 4 - .../src/Distribution/Client/Security/HTTP.hs | 5 - .../src/Distribution/Client/Store.hs | 2 - .../src/Distribution/Deprecated/ParseUtils.hs | 7 - .../src/Distribution/Deprecated/ReadP.hs | 12 -- .../Distribution/Client/ProjectConfig.hs | 4 - .../Distribution/Client/UserConfig.hs | 3 - .../Solver/Types/OptionalStanza.hs | 4 - cabal-testsuite/main/cabal-tests.hs | 6 - cabal-testsuite/src/Test/Cabal/TestCode.hs | 2 - cabal-testsuite/src/Test/Cabal/Workdir.hs | 3 +- doc/cabal-package-description-file.rst | 70 ++++------ 43 files changed, 127 insertions(+), 488 deletions(-) delete mode 100644 Cabal-syntax/src/Distribution/Compat/Typeable.hs delete mode 100644 Cabal-tests/tests/UnitTests/Orphans.hs diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 62b446b2293..a886214c01d 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -11,16 +11,16 @@ concurrency: on: push: paths-ignore: - - 'doc/**' - - '**/README.md' - - 'CONTRIBUTING.md' + - "doc/**" + - "**/README.md" + - "CONTRIBUTING.md" branches: - master pull_request: paths-ignore: - - 'doc/**' - - '**/README.md' - - 'CONTRIBUTING.md' + - "doc/**" + - "**/README.md" + - "CONTRIBUTING.md" release: types: - created @@ -41,17 +41,16 @@ on: env: # We choose a stable ghc version across all os's # which will be used to do the next release - GHC_FOR_RELEASE: '9.4.8' + GHC_FOR_RELEASE: "9.4.8" # Ideally we should use the version about to be released for hackage tests and benchmarks - GHC_FOR_SOLVER_BENCHMARKS: '9.4.8' - GHC_FOR_COMPLETE_HACKAGE_TESTS: '9.4.8' - COMMON_FLAGS: '-j 2 -v' + GHC_FOR_SOLVER_BENCHMARKS: "9.4.8" + GHC_FOR_COMPLETE_HACKAGE_TESTS: "9.4.8" + COMMON_FLAGS: "-j 2 -v" # See https://github.com/haskell/cabal/blob/master/CONTRIBUTING.md#hackage-revisions ALLOWNEWER: ${{ github.event.inputs.allow-newer }} CONSTRAINTS: ${{ github.event.inputs.constraints }} - jobs: validate: name: Validate ${{ matrix.sys.os }} ghc-${{ matrix.ghc }} @@ -61,28 +60,36 @@ jobs: strategy: matrix: sys: - - { os: windows-latest, shell: 'C:/msys64/usr/bin/bash.exe -e {0}' } - - { os: ubuntu-latest, shell: bash } - - { os: macos-13, shell: bash} + - { os: windows-latest, shell: "C:/msys64/usr/bin/bash.exe -e {0}" } + - { os: ubuntu-latest, shell: bash } + - { os: macos-13, shell: bash } # If you remove something from here, then add it to the old-ghcs job. # Also a removed GHC from here means that we are actually dropping # support, so the PR *must* have a changelog entry. - ghc: ['9.10.1', '9.8.2', '9.6.4', '9.4.8', '9.2.8', '9.0.2', '8.10.7', '8.8.4', '8.6.5'] + ghc: + [ + "9.10.1", + "9.8.2", + "9.6.4", + "9.4.8", + "9.2.8", + "9.0.2", + "8.10.7", + "8.8.4", + ] exclude: # corrupts GHA cache or the fabric of reality itself, see https://github.com/haskell/cabal/issues/8356 - - sys: { os: windows-latest, shell: 'C:/msys64/usr/bin/bash.exe -e {0}' } - ghc: '8.10.7' + - sys: + { os: windows-latest, shell: "C:/msys64/usr/bin/bash.exe -e {0}" } + ghc: "8.10.7" # lot of segfaults caused by ghc bugs - - sys: { os: windows-latest, shell: 'C:/msys64/usr/bin/bash.exe -e {0}' } - ghc: '8.8.4' - # it often randomly does "C:\Users\RUNNER~1\AppData\Local\Temp\ghcFEDE.c: DeleteFile "\\\\?\\C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\ghcFEDE.c": permission denied (Access is denied.)" - - sys: { os: windows-latest, shell: 'C:/msys64/usr/bin/bash.exe -e {0}' } - ghc: '8.6.5' + - sys: + { os: windows-latest, shell: "C:/msys64/usr/bin/bash.exe -e {0}" } + ghc: "8.8.4" defaults: - run: - shell: ${{ matrix.sys.shell }} + run: + shell: ${{ matrix.sys.shell }} steps: - - name: Work around XDG directories existence (haskell-actions/setup#62) if: runner.os == 'macOS' run: | @@ -213,7 +220,6 @@ jobs: if: matrix.ghc == env.GHC_FOR_SOLVER_BENCHMARKS run: sh validate.sh $FLAGS -s solver-benchmarks-run - validate-old-ghcs: name: Validate old ghcs ${{ matrix.extra-ghc }} runs-on: ubuntu-latest @@ -221,13 +227,13 @@ jobs: strategy: matrix: - extra-ghc: ['8.4.4', '8.2.2', '8.0.2'] + extra-ghc: + ["8.4.4", "8.2.2", "8.0.2"] ## GHC 7.10.3 does not install on ubuntu-22.04 with ghcup. ## Older GHCs are not supported by ghcup in the first place. fail-fast: false steps: - - uses: actions/checkout@v4 - name: Install prerequisites for old GHCs @@ -276,7 +282,7 @@ jobs: build-alpine: name: Build statically linked using alpine runs-on: ubuntu-latest - container: 'alpine:3.19' + container: "alpine:3.19" steps: - name: Install extra dependencies shell: sh @@ -336,7 +342,6 @@ jobs: name: cabal-${{ runner.os }}-static-x86_64 path: ${{ env.CABAL_EXEC_TAR }} - # The previous jobs use a released version of cabal to build cabal HEAD itself # This one uses the cabal HEAD generated executable in the previous step # to build itself again, as sanity check @@ -393,34 +398,34 @@ jobs: needs: [validate, validate-old-ghcs, build-alpine, dogfooding] steps: - - uses: actions/download-artifact@v3 - with: - name: cabal-Windows-x86_64 - - - uses: actions/download-artifact@v3 - with: - name: cabal-Linux-x86_64 - - - uses: actions/download-artifact@v3 - with: - name: cabal-Linux-static-x86_64 - - - uses: actions/download-artifact@v3 - with: - name: cabal-macOS-x86_64 - - - name: Create GitHub prerelease - uses: marvinpinto/action-automatic-releases@v1.2.1 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - automatic_release_tag: cabal-head - prerelease: true - title: cabal-head - files: | - cabal-head-Windows-x86_64.tar.gz - cabal-head-Linux-x86_64.tar.gz - cabal-head-Linux-static-x86_64.tar.gz - cabal-head-macOS-x86_64.tar.gz + - uses: actions/download-artifact@v3 + with: + name: cabal-Windows-x86_64 + + - uses: actions/download-artifact@v3 + with: + name: cabal-Linux-x86_64 + + - uses: actions/download-artifact@v3 + with: + name: cabal-Linux-static-x86_64 + + - uses: actions/download-artifact@v3 + with: + name: cabal-macOS-x86_64 + + - name: Create GitHub prerelease + uses: marvinpinto/action-automatic-releases@v1.2.1 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + automatic_release_tag: cabal-head + prerelease: true + title: cabal-head + files: | + cabal-head-Windows-x86_64.tar.gz + cabal-head-Linux-x86_64.tar.gz + cabal-head-Linux-static-x86_64.tar.gz + cabal-head-macOS-x86_64.tar.gz # We use this job as a summary of the workflow # It will fail if any of the previous jobs does it diff --git a/Cabal-QuickCheck/src/Test/QuickCheck/GenericArbitrary.hs b/Cabal-QuickCheck/src/Test/QuickCheck/GenericArbitrary.hs index 00f32bc0d70..29f0b5d85e9 100644 --- a/Cabal-QuickCheck/src/Test/QuickCheck/GenericArbitrary.hs +++ b/Cabal-QuickCheck/src/Test/QuickCheck/GenericArbitrary.hs @@ -10,10 +10,6 @@ module Test.QuickCheck.GenericArbitrary ( import GHC.Generics import Test.QuickCheck -#if !MIN_VERSION_base(4,8,0) -import Control.Applicative (pure, (<$>), (<*>)) -#endif - -- Generic arbitrary for non-recursive types genericArbitrary :: (Generic a, GArbitrary (Rep a)) => Gen a genericArbitrary = fmap to garbitrary diff --git a/Cabal-QuickCheck/src/Test/QuickCheck/Instances/Cabal.hs b/Cabal-QuickCheck/src/Test/QuickCheck/Instances/Cabal.hs index e5b5077d414..8eabc450b03 100644 --- a/Cabal-QuickCheck/src/Test/QuickCheck/Instances/Cabal.hs +++ b/Cabal-QuickCheck/src/Test/QuickCheck/Instances/Cabal.hs @@ -6,19 +6,13 @@ module Test.QuickCheck.Instances.Cabal () where #if !MIN_VERSION_base(4,18,0) import Control.Applicative (liftA2) #endif -import Data.Bits (shiftR) +import Data.Bits (countLeadingZeros, finiteBitSize, shiftL, shiftR) import Data.Char (isAlphaNum, isDigit, toLower) import Data.List (intercalate, (\\)) import Data.List.NonEmpty (NonEmpty (..)) import Distribution.Utils.Generic (lowercase) import Test.QuickCheck -#if MIN_VERSION_base(4,8,0) -import Data.Bits (countLeadingZeros, finiteBitSize, shiftL) -#else -import Data.Bits (popCount) -#endif - import Distribution.CabalSpecVersion import Distribution.Compat.NonEmptySet (NonEmptySet) import Distribution.Compiler @@ -54,10 +48,6 @@ import Test.QuickCheck.GenericArbitrary import qualified Data.ByteString.Char8 as BS8 import qualified Distribution.Compat.NonEmptySet as NES -#if !MIN_VERSION_base(4,8,0) -import Control.Applicative (pure, (<$>), (<*>)) -#endif - ------------------------------------------------------------------------------- -- CabalSpecVersion ------------------------------------------------------------------------------- @@ -541,8 +531,4 @@ intSqrt n = case compare n 0 of iter x = shiftR (x + n `div` x) 1 guess :: Int -#if MIN_VERSION_base(4,8,0) guess = shiftR n (shiftL (finiteBitSize n - countLeadingZeros n) 1) -#else - guess = shiftR n (shiftR (popCount n) 1) -#endif diff --git a/Cabal-hooks/Cabal-hooks.cabal b/Cabal-hooks/Cabal-hooks.cabal index 367ef185610..db309369330 100644 --- a/Cabal-hooks/Cabal-hooks.cabal +++ b/Cabal-hooks/Cabal-hooks.cabal @@ -29,7 +29,7 @@ library build-depends: Cabal-syntax >= 3.13 && < 3.15, Cabal >= 3.13 && < 3.15, - base >= 4.11 && < 5, + base >= 4.13 && < 5, containers >= 0.5.0.0 && < 0.8, transformers >= 0.5.6.0 && < 0.7 diff --git a/Cabal-syntax/Cabal-syntax.cabal b/Cabal-syntax/Cabal-syntax.cabal index a1873228428..1bc8bcabeb2 100644 --- a/Cabal-syntax/Cabal-syntax.cabal +++ b/Cabal-syntax/Cabal-syntax.cabal @@ -29,7 +29,7 @@ library build-depends: array >= 0.4.0.1 && < 0.6, - base >= 4.11 && < 5, + base >= 4.13 && < 5, binary >= 0.7 && < 0.9, bytestring >= 0.10.0.0 && < 0.13, containers >= 0.5.0.0 && < 0.8, @@ -76,7 +76,6 @@ library Distribution.Compat.Parsing Distribution.Compat.Prelude Distribution.Compat.Semigroup - Distribution.Compat.Typeable Distribution.Compiler Distribution.FieldGrammar Distribution.FieldGrammar.Class diff --git a/Cabal-syntax/src/Distribution/Compat/Graph.hs b/Cabal-syntax/src/Distribution/Compat/Graph.hs index c01f3162b2d..1a6de3a571b 100644 --- a/Cabal-syntax/src/Distribution/Compat/Graph.hs +++ b/Cabal-syntax/src/Distribution/Compat/Graph.hs @@ -148,24 +148,20 @@ instance (Eq (Key a), Eq a) => Eq (Graph a) where g1 == g2 = graphMap g1 == graphMap g2 instance Foldable.Foldable Graph where + elem x = Foldable.elem x . graphMap fold = Foldable.fold . graphMap - foldr f z = Foldable.foldr f z . graphMap foldl f z = Foldable.foldl f z . graphMap - foldMap f = Foldable.foldMap f . graphMap foldl' f z = Foldable.foldl' f z . graphMap + foldr f z = Foldable.foldr f z . graphMap foldr' f z = Foldable.foldr' f z . graphMap -#ifdef MIN_VERSION_base -#if MIN_VERSION_base(4,8,0) + foldMap f = Foldable.foldMap f . graphMap length = Foldable.length . graphMap - null = Foldable.null . graphMap - toList = Foldable.toList . graphMap - elem x = Foldable.elem x . graphMap maximum = Foldable.maximum . graphMap minimum = Foldable.minimum . graphMap - sum = Foldable.sum . graphMap + null = Foldable.null . graphMap product = Foldable.product . graphMap -#endif -#endif + sum = Foldable.sum . graphMap + toList = Foldable.toList . graphMap instance (NFData a, NFData (Key a)) => NFData (Graph a) where rnf diff --git a/Cabal-syntax/src/Distribution/Compat/Newtype.hs b/Cabal-syntax/src/Distribution/Compat/Newtype.hs index 00da1e83542..56f55a9282b 100644 --- a/Cabal-syntax/src/Distribution/Compat/Newtype.hs +++ b/Cabal-syntax/src/Distribution/Compat/Newtype.hs @@ -14,15 +14,10 @@ module Distribution.Compat.Newtype , unpack' ) where +import Data.Coerce (Coercible, coerce) import Data.Functor.Identity (Identity (..)) import Data.Monoid (Endo (..), Product (..), Sum (..)) -#if MIN_VERSION_base(4,7,0) -import Data.Coerce (coerce, Coercible) -#else -import Unsafe.Coerce (unsafeCoerce) -#endif - -- | The @FunctionalDependencies@ version of 'Newtype' type-class. -- -- Since Cabal-3.0 class arguments are in a different order than in @newtype@ package. @@ -40,22 +35,12 @@ import Unsafe.Coerce (unsafeCoerce) {- FOURMOLU_DISABLE -} class Newtype o n | n -> o where pack :: o -> n -#if MIN_VERSION_base(4,7,0) default pack :: Coercible o n => o -> n pack = coerce -#else - default pack :: o -> n - pack = unsafeCoerce -#endif unpack :: n -> o -#if MIN_VERSION_base(4,7,0) default unpack :: Coercible n o => n -> o unpack = coerce -#else - default unpack :: n -> o - unpack = unsafeCoerce -#endif {- FOURMOLU_ENABLE -} instance Newtype a (Identity a) diff --git a/Cabal-syntax/src/Distribution/Compat/NonEmptySet.hs b/Cabal-syntax/src/Distribution/Compat/NonEmptySet.hs index 034da7ee90c..17e3811e9a4 100644 --- a/Cabal-syntax/src/Distribution/Compat/NonEmptySet.hs +++ b/Cabal-syntax/src/Distribution/Compat/NonEmptySet.hs @@ -87,12 +87,9 @@ instance Ord a => Semigroup (NonEmptySet a) where instance F.Foldable NonEmptySet where foldMap f (NES s) = F.foldMap f s foldr f z (NES s) = F.foldr f z s - -#if MIN_VERSION_base(4,8,0) - toList = toList - null _ = False + toList = toList + null _ = False length (NES s) = F.length s -#endif ------------------------------------------------------------------------------- -- Constructors diff --git a/Cabal-syntax/src/Distribution/Compat/Prelude.hs b/Cabal-syntax/src/Distribution/Compat/Prelude.hs index 3cbf3c17a8a..2d6f92b5da6 100644 --- a/Cabal-syntax/src/Distribution/Compat/Prelude.hs +++ b/Cabal-syntax/src/Distribution/Compat/Prelude.hs @@ -4,14 +4,6 @@ {-# LANGUAGE Trustworthy #-} {-# LANGUAGE TypeOperators #-} -{- FOURMOLU_DISABLE -} -#ifdef MIN_VERSION_base -#define MINVER_base_411 MIN_VERSION_base(4,11,0) -#else -#define MINVER_base_411 (__GLASGOW_HASKELL__ >= 804) -#endif -{- FOURMOLU_ENABLE -} - -- | This module does two things: -- -- * Acts as a compatibility layer, like @base-compat@. @@ -194,11 +186,10 @@ import Prelude as BasePrelude hiding ( mapM, mapM_, sequence, any, all, head, tail, last, init -- partial functions , read -#if MINVER_base_411 + , foldr1, foldl1 -- As of base 4.11.0.0 Prelude exports part of Semigroup(..). -- Hide this so we instead rely on Distribution.Compat.Semigroup. , Semigroup(..) -#endif , Word -- We hide them, as we import only some members , Traversable, traverse, sequenceA @@ -243,11 +234,11 @@ import Data.Ord (comparing) import Data.Proxy (Proxy (..)) import Data.Set (Set) import Data.String (IsString (..)) +import Data.Typeable (TypeRep, Typeable, typeRep) import Data.Void (Void, absurd, vacuous) import Data.Word (Word, Word16, Word32, Word64, Word8) import Distribution.Compat.Binary (Binary (..)) import Distribution.Compat.Semigroup (Semigroup (..), gmappend, gmempty) -import Distribution.Compat.Typeable (TypeRep, Typeable, typeRep) import GHC.Generics (Generic (..), K1 (unK1), M1 (unM1), U1 (U1), V1, (:*:) ((:*:)), (:+:) (L1, R1)) import System.Exit (ExitCode (..), exitFailure, exitSuccess, exitWith) import Text.Read (readMaybe) diff --git a/Cabal-syntax/src/Distribution/Compat/Typeable.hs b/Cabal-syntax/src/Distribution/Compat/Typeable.hs deleted file mode 100644 index 161f868a823..00000000000 --- a/Cabal-syntax/src/Distribution/Compat/Typeable.hs +++ /dev/null @@ -1,19 +0,0 @@ -{-# LANGUAGE CPP #-} -{-# LANGUAGE ScopedTypeVariables #-} - -module Distribution.Compat.Typeable - ( Typeable - , TypeRep - , typeRep - ) where - -#if MIN_VERSION_base(4,7,0) -import Data.Typeable (Typeable, TypeRep, typeRep) -#else -import Data.Typeable (Typeable, TypeRep, typeOf) -#endif - -#if !MIN_VERSION_base(4,7,0) -typeRep :: forall a proxy. Typeable a => proxy a -> TypeRep -typeRep _ = typeOf (undefined :: a) -#endif diff --git a/Cabal-syntax/src/Distribution/Fields/ParseResult.hs b/Cabal-syntax/src/Distribution/Fields/ParseResult.hs index 7174aaa99bf..aad7de2737a 100644 --- a/Cabal-syntax/src/Distribution/Fields/ParseResult.hs +++ b/Cabal-syntax/src/Distribution/Fields/ParseResult.hs @@ -18,22 +18,11 @@ module Distribution.Fields.ParseResult , withoutWarnings ) where +import Distribution.Compat.Prelude import Distribution.Parsec.Error (PError (..)) import Distribution.Parsec.Position (Position (..), zeroPos) import Distribution.Parsec.Warning (PWarnType (..), PWarning (..)) import Distribution.Version (Version) -import Prelude () - --- liftA2 is not in base <4.10, hence we need to only import it explicitly when we're on >=4.10 --- --- Additionally, since liftA2 will be exported from Prelude starting with ~4.18, we should hide --- it from Prelude and get it from Control.Applicative to be backwards compatible and avoid warnings -#if MIN_VERSION_base(4,10,0) -import Distribution.Compat.Prelude hiding (Applicative(..)) -import Control.Applicative (Applicative (..)) -#else -import Distribution.Compat.Prelude -#endif -- | A monad with failure and accumulating errors and warnings. newtype ParseResult a = PR @@ -100,14 +89,6 @@ instance Applicative ParseResult where success s2 x' {-# INLINE (<*) #-} -#if MIN_VERSION_base(4,10,0) - liftA2 f x y = PR $ \ !s0 failure success -> - unPR x s0 failure $ \ !s1 x' -> - unPR y s1 failure $ \ !s2 y' -> - success s2 (f x' y') - {-# INLINE liftA2 #-} -#endif - instance Monad ParseResult where return = pure (>>) = (*>) diff --git a/Cabal-syntax/src/Distribution/Parsec.hs b/Cabal-syntax/src/Distribution/Parsec.hs index 4c6e31e5aaa..3bf62597222 100644 --- a/Cabal-syntax/src/Distribution/Parsec.hs +++ b/Cabal-syntax/src/Distribution/Parsec.hs @@ -145,10 +145,6 @@ instance Monad ParsecParser where (>>) = (*>) {-# INLINE (>>) #-} -#if !(MIN_VERSION_base(4,13,0)) - fail = Fail.fail -#endif - instance MonadPlus ParsecParser where mzero = empty mplus = (<|>) diff --git a/Cabal-syntax/src/Distribution/System.hs b/Cabal-syntax/src/Distribution/System.hs index e1e75aa2315..1bf6d598d03 100644 --- a/Cabal-syntax/src/Distribution/System.hs +++ b/Cabal-syntax/src/Distribution/System.hs @@ -46,10 +46,6 @@ import Control.Applicative (Applicative (..)) import Distribution.Compat.Prelude hiding (Applicative (..)) import Prelude () -#if !MIN_VERSION_base(4,10,0) -import Control.Applicative (liftA2) -#endif - import Distribution.Utils.Generic (lowercase) import qualified System.Info (arch, os) diff --git a/Cabal-syntax/src/Distribution/Utils/Structured.hs b/Cabal-syntax/src/Distribution/Utils/Structured.hs index ba10212bca1..3a21d47a0dd 100644 --- a/Cabal-syntax/src/Distribution/Utils/Structured.hs +++ b/Cabal-syntax/src/Distribution/Utils/Structured.hs @@ -106,8 +106,8 @@ import qualified Data.Aeson as Aeson #endif import Data.Kind (Type) +import Data.Typeable (TypeRep, Typeable, typeRep) -import Distribution.Compat.Typeable (TypeRep, Typeable, typeRep) import Distribution.Utils.MD5 import Data.Monoid (mconcat) diff --git a/Cabal-tests/Cabal-tests.cabal b/Cabal-tests/Cabal-tests.cabal index dd443d1fc21..52647f8a6b4 100644 --- a/Cabal-tests/Cabal-tests.cabal +++ b/Cabal-tests/Cabal-tests.cabal @@ -52,12 +52,11 @@ test-suite unit-tests UnitTests.Distribution.Utils.ShortText UnitTests.Distribution.Utils.Structured UnitTests.Distribution.Version - UnitTests.Orphans main-is: UnitTests.hs build-depends: array - , base >=4.11 && <5 + , base >=4.13 && <5 , bytestring , Cabal , Cabal-described diff --git a/Cabal-tests/tests/UnitTests/Distribution/Utils/CharSet.hs b/Cabal-tests/tests/UnitTests/Distribution/Utils/CharSet.hs index c2180b630b7..a7d629ccb08 100644 --- a/Cabal-tests/tests/UnitTests/Distribution/Utils/CharSet.hs +++ b/Cabal-tests/tests/UnitTests/Distribution/Utils/CharSet.hs @@ -1,8 +1,4 @@ {-# LANGUAGE CPP #-} --- isAlpha and isAlphaNum definitions change from base to base -#if MIN_VERSION_base(4,12,0) && !MIN_VERSION_base(4,13,0) -#define HAS_TESTS -#endif module UnitTests.Distribution.Utils.CharSet where import Prelude hiding (Foldable(..)) diff --git a/Cabal-tests/tests/UnitTests/Distribution/Utils/Structured.hs b/Cabal-tests/tests/UnitTests/Distribution/Utils/Structured.hs index 63841cba729..0db6844928a 100644 --- a/Cabal-tests/tests/UnitTests/Distribution/Utils/Structured.hs +++ b/Cabal-tests/tests/UnitTests/Distribution/Utils/Structured.hs @@ -13,8 +13,6 @@ import Distribution.Types.VersionRange (VersionRange) import Distribution.Types.GenericPackageDescription (GenericPackageDescription) import Distribution.Types.LocalBuildInfo (LocalBuildInfo) -import UnitTests.Orphans () - tests :: TestTree tests = testGroup "Distribution.Utils.Structured" -- This test also verifies that structureHash doesn't loop. diff --git a/Cabal-tests/tests/UnitTests/Orphans.hs b/Cabal-tests/tests/UnitTests/Orphans.hs deleted file mode 100644 index d6b49a91929..00000000000 --- a/Cabal-tests/tests/UnitTests/Orphans.hs +++ /dev/null @@ -1,10 +0,0 @@ -{-# LANGUAGE CPP #-} -{-# LANGUAGE StandaloneDeriving #-} -{-# OPTIONS_GHC -fno-warn-orphans #-} -module UnitTests.Orphans where - -#if !MIN_VERSION_base(4,7,0) -import GHC.Fingerprint (Fingerprint (..)) - -deriving instance Show Fingerprint -#endif diff --git a/Cabal-tests/tests/custom-setup/IdrisSetup.hs b/Cabal-tests/tests/custom-setup/IdrisSetup.hs index 952be052961..339f9fd9c38 100644 --- a/Cabal-tests/tests/custom-setup/IdrisSetup.hs +++ b/Cabal-tests/tests/custom-setup/IdrisSetup.hs @@ -45,10 +45,6 @@ module IdrisSetup (main) where # define MIN_VERSION_Cabal(x,y,z) 0 #endif -#if !defined(MIN_VERSION_base) -# define MIN_VERSION_base(x,y,z) 0 -#endif - import Control.Monad import Data.IORef import Control.Exception (SomeException, catch) @@ -85,11 +81,6 @@ configConfigurationsFlags = unFlagAssignment . S.configConfigurationsFlags configConfigurationsFlags = S.configConfigurationsFlags #endif -#if !MIN_VERSION_base(4,6,0) -lookupEnv :: String -> IO (Maybe String) -lookupEnv v = lookup v `fmap` getEnvironment -#endif - -- After Idris is built, we need to check and install the prelude and other libs -- ----------------------------------------------------------------------------- diff --git a/Cabal/Cabal.cabal b/Cabal/Cabal.cabal index deaad72cef1..14e7050c5db 100644 --- a/Cabal/Cabal.cabal +++ b/Cabal/Cabal.cabal @@ -36,7 +36,7 @@ library build-depends: Cabal-syntax ^>= 3.13, array >= 0.4.0.1 && < 0.6, - base >= 4.11 && < 5, + base >= 4.13 && < 5, bytestring >= 0.10.0.0 && < 0.13, containers >= 0.5.0.0 && < 0.8, deepseq >= 1.3.0.1 && < 1.6, @@ -189,7 +189,6 @@ library Distribution.Compat.Parsing, Distribution.Compat.Prelude, Distribution.Compat.Semigroup, - Distribution.Compat.Typeable, Distribution.Compiler, Distribution.FieldGrammar, Distribution.FieldGrammar.Class, diff --git a/Cabal/src/Distribution/Compat/Async.hs b/Cabal/src/Distribution/Compat/Async.hs index dbc22c58359..b1234c8e346 100644 --- a/Cabal/src/Distribution/Compat/Async.hs +++ b/Cabal/src/Distribution/Compat/Async.hs @@ -29,6 +29,8 @@ import Control.Exception ( BlockedIndefinitelyOnMVar (..) , Exception (..) , SomeException (..) + , asyncExceptionFromException + , asyncExceptionToException , catch , evaluate , mask @@ -41,10 +43,6 @@ import Control.Monad (void) import Data.Typeable (Typeable) import GHC.Exts (inline) -#if MIN_VERSION_base(4,7,0) -import Control.Exception (asyncExceptionFromException, asyncExceptionToException) -#endif - -- | Async, but based on 'MVar', as we don't depend on @stm@. data AsyncM a = Async { asyncThreadId :: {-# UNPACK #-} !ThreadId @@ -148,15 +146,11 @@ data AsyncCancelled = AsyncCancelled , Typeable ) -{- FOURMOLU_DISABLE -} instance Exception AsyncCancelled where -#if MIN_VERSION_base(4,7,0) -- wraps in SomeAsyncException -- See https://github.com/ghc/ghc/commit/756a970eacbb6a19230ee3ba57e24999e4157b09 fromException = asyncExceptionFromException toException = asyncExceptionToException -#endif -{- FOURMOLU_ENABLE -} -- | Cancel an asynchronous action -- diff --git a/Cabal/src/Distribution/Compat/ResponseFile.hs b/Cabal/src/Distribution/Compat/ResponseFile.hs index 189a423bd08..8619ae56962 100644 --- a/Cabal/src/Distribution/Compat/ResponseFile.hs +++ b/Cabal/src/Distribution/Compat/ResponseFile.hs @@ -8,63 +8,15 @@ module Distribution.Compat.ResponseFile (expandResponse, escapeArgs) where import Distribution.Compat.Prelude + +import GHC.ResponseFile (escapeArgs, unescapeArgs) + import Prelude () import System.FilePath import System.IO (hPutStrLn, stderr) import System.IO.Error -#if MIN_VERSION_base(4,12,0) -import GHC.ResponseFile (unescapeArgs, escapeArgs) -#else - -unescapeArgs :: String -> [String] -unescapeArgs = filter (not . null) . unescape - -data Quoting = NoneQ | SngQ | DblQ - -unescape :: String -> [String] -unescape args = reverse . map reverse $ go args NoneQ False [] [] - where - -- n.b., the order of these cases matters; these are cribbed from gcc - -- case 1: end of input - go [] _q _bs a as = a:as - -- case 2: back-slash escape in progress - go (c:cs) q True a as = go cs q False (c:a) as - -- case 3: no back-slash escape in progress, but got a back-slash - go (c:cs) q False a as - | '\\' == c = go cs q True a as - -- case 4: single-quote escaping in progress - go (c:cs) SngQ False a as - | '\'' == c = go cs NoneQ False a as - | otherwise = go cs SngQ False (c:a) as - -- case 5: double-quote escaping in progress - go (c:cs) DblQ False a as - | '"' == c = go cs NoneQ False a as - | otherwise = go cs DblQ False (c:a) as - -- case 6: no escaping is in progress - go (c:cs) NoneQ False a as - | isSpace c = go cs NoneQ False [] (a:as) - | '\'' == c = go cs SngQ False a as - | '"' == c = go cs DblQ False a as - | otherwise = go cs NoneQ False (c:a) as - -escapeArgs :: [String] -> String -escapeArgs = unlines . map escapeArg - -escapeArg :: String -> String -escapeArg = reverse . foldl' escape [] - -escape :: String -> Char -> String -escape cs c - | isSpace c - || '\\' == c - || '\'' == c - || '"' == c = c:'\\':cs -- n.b., our caller must reverse the result - | otherwise = c:cs - -#endif - -- | The arg file / response file parser. -- -- This is not a well-documented capability, and is a bit eccentric diff --git a/Cabal/src/Distribution/Compat/Stack.hs b/Cabal/src/Distribution/Compat/Stack.hs index 41d4ff8b460..616a66d090d 100644 --- a/Cabal/src/Distribution/Compat/Stack.hs +++ b/Cabal/src/Distribution/Compat/Stack.hs @@ -13,91 +13,31 @@ module Distribution.Compat.Stack , parentSrcLocPrefix ) where -import System.IO.Error - -#ifdef MIN_VERSION_base -#if MIN_VERSION_base(4,8,1) -#define GHC_STACK_SUPPORTED 1 -#endif -#endif - -#ifdef GHC_STACK_SUPPORTED import GHC.Stack -#endif - -#ifdef GHC_STACK_SUPPORTED +import System.IO.Error -#if MIN_VERSION_base(4,9,0) type WithCallStack a = HasCallStack => a -#elif MIN_VERSION_base(4,8,1) -type WithCallStack a = (?callStack :: CallStack) => a -#endif - -#if !MIN_VERSION_base(4,9,0) --- NB: Can't say WithCallStack (WithCallStack a -> a); --- Haskell doesn't support this kind of implicit parameter! --- See https://mail.haskell.org/pipermail/ghc-devs/2016-January/011096.html --- Since this function doesn't do anything, it's OK to --- give it a less good type. -withFrozenCallStack :: WithCallStack (a -> a) -withFrozenCallStack x = x - -callStack :: (?callStack :: CallStack) => CallStack -callStack = ?callStack - -prettyCallStack :: CallStack -> String -prettyCallStack = showCallStack -#endif -- | Give the *parent* of the person who invoked this; -- so it's most suitable for being called from a utility function. -- You probably want to call this using 'withFrozenCallStack'; otherwise -- it's not very useful. We didn't implement this for base-4.8.1 -- because we cannot rely on freezing to have taken place. --- parentSrcLocPrefix :: WithCallStack String -#if MIN_VERSION_base(4,9,0) parentSrcLocPrefix = case getCallStack callStack of - (_:(_, loc):_) -> showLoc loc + (_ : (_, loc) : _) -> showLoc loc [(_, loc)] -> showLoc loc [] -> error "parentSrcLocPrefix: empty call stack" - where - showLoc loc = - srcLocFile loc ++ ":" ++ show (srcLocStartLine loc) ++ ": " -#else -parentSrcLocPrefix = "Call sites not available with base < 4.9.0.0 (GHC 8.0): " -#endif + where + showLoc loc = + srcLocFile loc ++ ":" ++ show (srcLocStartLine loc) ++ ": " -- Yeah, this uses skivvy implementation details. withLexicalCallStack :: (a -> WithCallStack (IO b)) -> WithCallStack (a -> IO b) withLexicalCallStack f = - let stk = ?callStack - in \x -> let ?callStack = stk in f x - -#else - -data CallStack = CallStack - deriving (Eq, Show) - -type WithCallStack a = a - -withFrozenCallStack :: a -> a -withFrozenCallStack x = x - -callStack :: CallStack -callStack = CallStack - -prettyCallStack :: CallStack -> String -prettyCallStack _ = "Call stacks not available with base < 4.8.1.0 (GHC 7.10)" - -parentSrcLocPrefix :: String -parentSrcLocPrefix = "Call sites not available with base < 4.9.0.0 (GHC 8.0): " - -withLexicalCallStack :: (a -> IO b) -> a -> IO b -withLexicalCallStack f = f - -#endif + let stk = ?callStack + in \x -> let ?callStack = stk in f x -- | This function is for when you *really* want to add a call -- stack to raised IO, but you don't have a diff --git a/Cabal/src/Distribution/Compat/Time.hs b/Cabal/src/Distribution/Compat/Time.hs index 9af0500fae1..03d57449eb4 100644 --- a/Cabal/src/Distribution/Compat/Time.hs +++ b/Cabal/src/Distribution/Compat/Time.hs @@ -34,11 +34,7 @@ import Data.Time.Clock.POSIX (POSIXTime, getPOSIXTime, posixDayLength) import qualified Prelude import Data.Bits ((.|.), unsafeShiftL) -#if MIN_VERSION_base(4,7,0) import Data.Bits (finiteBitSize) -#else -import Data.Bits (bitSize) -#endif import Foreign ( allocaBytes, peekByteOff ) import System.IO.Error ( mkIOError, doesNotExistErrorType ) @@ -92,15 +88,9 @@ getModTime path = allocaBytes size_WIN32_FILE_ATTRIBUTE_DATA $ \info -> do index_WIN32_FILE_ATTRIBUTE_DATA_ftLastWriteTime_dwLowDateTime dwHigh <- peekByteOff info index_WIN32_FILE_ATTRIBUTE_DATA_ftLastWriteTime_dwHighDateTime -#if MIN_VERSION_base(4,7,0) let qwTime = (fromIntegral (dwHigh :: DWORD) `unsafeShiftL` finiteBitSize dwHigh) .|. (fromIntegral (dwLow :: DWORD)) -#else - let qwTime = - (fromIntegral (dwHigh :: DWORD) `unsafeShiftL` bitSize dwHigh) - .|. (fromIntegral (dwLow :: DWORD)) -#endif return $! ModTime (qwTime :: Word64) {- FOURMOLU_DISABLE -} diff --git a/Makefile b/Makefile index d305ca16353..447f3a88fe2 100644 --- a/Makefile +++ b/Makefile @@ -178,14 +178,12 @@ cabal-install-test-accept: .PHONY: validate-via-docker-all validate-via-docker-all : validate-via-docker-8.2.2 validate-via-docker-all : validate-via-docker-8.4.4 -validate-via-docker-all : validate-via-docker-8.6.5 validate-via-docker-all : validate-via-docker-8.8.4 validate-via-docker-all : validate-via-docker-8.10.4 .PHONY: validate-dockerfiles validate-dockerfiles : .docker/validate-8.10.4.dockerfile validate-dockerfiles : .docker/validate-8.8.4.dockerfile -validate-dockerfiles : .docker/validate-8.6.5.dockerfile validate-dockerfiles : .docker/validate-8.4.4.dockerfile validate-dockerfiles : .docker/validate-8.2.2.dockerfile @@ -204,10 +202,6 @@ validate-via-docker-8.2.2: validate-via-docker-8.4.4: docker build $(DOCKERARGS) -t cabal-validate:8.4.4 -f .docker/validate-8.4.4.dockerfile . -.PHONY: validate-via-docker-8.6.5 -validate-via-docker-8.6.5: - docker build $(DOCKERARGS) -t cabal-validate:8.6.5 -f .docker/validate-8.6.5.dockerfile . - .PHONY: validate-via-docker-8.8.4 validate-via-docker-8.8.4: docker build $(DOCKERARGS) -t cabal-validate:8.8.4 -f .docker/validate-8.8.4.dockerfile . diff --git a/cabal-dev-scripts/cabal-dev-scripts.cabal b/cabal-dev-scripts/cabal-dev-scripts.cabal index 399888dfb8d..5ae899febe1 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.2.1.0 - , base >=4.11 && <4.20 + , base >=4.13 && <4.20 , 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.2.1.0 - , base >=4.11 && <4.20 + , base >=4.13 && <4.20 , bytestring , containers , Diff ^>=0.4 diff --git a/cabal-install-solver/cabal-install-solver.cabal b/cabal-install-solver/cabal-install-solver.cabal index b2b2b12b7af..4bc75a32569 100644 --- a/cabal-install-solver/cabal-install-solver.cabal +++ b/cabal-install-solver/cabal-install-solver.cabal @@ -99,7 +99,7 @@ library build-depends: , array >=0.4 && <0.6 - , base >=4.11 && <4.21 + , base >=4.13 && <4.21 , bytestring >=0.10.6.0 && <0.13 , Cabal ^>=3.13 , Cabal-syntax ^>=3.13 @@ -131,7 +131,7 @@ Test-Suite unit-tests UnitTests.Distribution.Solver.Modular.MessageUtils build-depends: - , base >= 4.11 && <4.21 + , base >= 4.13 && <4.21 , Cabal-syntax , cabal-install-solver , tasty >= 1.2.3 && <1.6 diff --git a/cabal-install/cabal-install.cabal b/cabal-install/cabal-install.cabal index 9d307b4e1c6..115b9457d4b 100644 --- a/cabal-install/cabal-install.cabal +++ b/cabal-install/cabal-install.cabal @@ -52,7 +52,7 @@ common warnings ghc-options: -Wnoncanonical-monadfail-instances common base-dep - build-depends: base >=4.11 && <4.21 + build-depends: base >=4.13 && <4.21 common cabal-dep build-depends: Cabal ^>=3.13 diff --git a/cabal-install/src/Distribution/Client/Compat/Orphans.hs b/cabal-install/src/Distribution/Client/Compat/Orphans.hs index 4a2e28a10fb..bbc44bb5c8a 100644 --- a/cabal-install/src/Distribution/Client/Compat/Orphans.hs +++ b/cabal-install/src/Distribution/Client/Compat/Orphans.hs @@ -4,8 +4,8 @@ module Distribution.Client.Compat.Orphans () where import Control.Exception (SomeException) +import Data.Typeable (typeRep) import Distribution.Compat.Binary (Binary (..)) -import Distribution.Compat.Typeable (typeRep) import Distribution.Utils.Structured (Structure (Nominal), Structured (..)) import Network.URI (URI (..), URIAuth (..)) import Prelude (error, return) diff --git a/cabal-install/src/Distribution/Client/FileMonitor.hs b/cabal-install/src/Distribution/Client/FileMonitor.hs index 59742cc1b80..0872a9a9504 100644 --- a/cabal-install/src/Distribution/Client/FileMonitor.hs +++ b/cabal-install/src/Distribution/Client/FileMonitor.hs @@ -1127,12 +1127,9 @@ checkDirectoryModificationTime dir mtime = -- | Run an IO computation, returning the first argument @e@ if there is an 'error' -- call. ('ErrorCall') handleErrorCall :: a -> IO a -> IO a -handleErrorCall e = handle handler where -#if MIN_VERSION_base(4,9,0) +handleErrorCall e = handle handler + where handler (ErrorCallWithLocation _ _) = return e -#else - handler (ErrorCall _) = return e -#endif -- | Run an IO computation, returning @e@ if there is any 'IOException'. -- diff --git a/cabal-install/src/Distribution/Client/ProjectConfig.hs b/cabal-install/src/Distribution/Client/ProjectConfig.hs index cec000b6a9b..06f4e4e555d 100644 --- a/cabal-install/src/Distribution/Client/ProjectConfig.hs +++ b/cabal-install/src/Distribution/Client/ProjectConfig.hs @@ -610,21 +610,10 @@ data BadProjectRoot | BadProjectRootDir FilePath | BadProjectRootAbsoluteFile FilePath | BadProjectRootDirFile FilePath FilePath -#if MIN_VERSION_base(4,8,0) deriving (Show, Typeable) -#else - deriving (Typeable) - -instance Show BadProjectRoot where - show = renderBadProjectRoot -#endif -#if MIN_VERSION_base(4,8,0) instance Exception BadProjectRoot where displayException = renderBadProjectRoot -#else -instance Exception BadProjectRoot -#endif renderBadProjectRoot :: BadProjectRoot -> String renderBadProjectRoot = \case @@ -844,21 +833,11 @@ data ProjectPackageLocation -- | Exception thrown by 'findProjectPackages'. data BadPackageLocations = BadPackageLocations (Set ProjectConfigProvenance) [BadPackageLocation] -#if MIN_VERSION_base(4,8,0) deriving (Show, Typeable) -#else - deriving (Typeable) -instance Show BadPackageLocations where - show = renderBadPackageLocations -#endif - -#if MIN_VERSION_base(4,8,0) instance Exception BadPackageLocations where displayException = renderBadPackageLocations -#else -instance Exception BadPackageLocations -#endif + -- TODO: [nice to have] custom exception subclass for Doc rendering, colour etc data BadPackageLocation @@ -1530,11 +1509,8 @@ instance Show CabalFileParseError where . showChar ' ' . showsPrec 11 ws -instance Exception CabalFileParseError -#if MIN_VERSION_base(4,8,0) - where +instance Exception CabalFileParseError where displayException = renderCabalFileParseError -#endif renderCabalFileParseError :: CabalFileParseError -> String renderCabalFileParseError (CabalFileParseError filePath contents errors _ warnings) = @@ -1676,21 +1652,11 @@ truncateString n s data BadPerPackageCompilerPaths = BadPerPackageCompilerPaths [(PackageName, String)] -#if MIN_VERSION_base(4,8,0) deriving (Show, Typeable) -#else - deriving (Typeable) -instance Show BadPerPackageCompilerPaths where - show = renderBadPerPackageCompilerPaths -#endif - -#if MIN_VERSION_base(4,8,0) instance Exception BadPerPackageCompilerPaths where displayException = renderBadPerPackageCompilerPaths -#else -instance Exception BadPerPackageCompilerPaths -#endif + -- TODO: [nice to have] custom exception subclass for Doc rendering, colour etc renderBadPerPackageCompilerPaths :: BadPerPackageCompilerPaths -> String diff --git a/cabal-install/src/Distribution/Client/ProjectOrchestration.hs b/cabal-install/src/Distribution/Client/ProjectOrchestration.hs index 7f26ac12382..8fb0ca8e65f 100644 --- a/cabal-install/src/Distribution/Client/ProjectOrchestration.hs +++ b/cabal-install/src/Distribution/Client/ProjectOrchestration.hs @@ -1412,11 +1412,7 @@ dieOnBuildFailures verbosity currentCommand plan buildOutcomes " The build process terminated with exit code " ++ show n _ -> " The exception was:\n " -#if MIN_VERSION_base(4,8,0) ++ displayException e -#else - ++ show e -#endif buildFailureException :: BuildFailureReason -> Maybe SomeException buildFailureException reason = diff --git a/cabal-install/src/Distribution/Client/Security/HTTP.hs b/cabal-install/src/Distribution/Client/Security/HTTP.hs index f433c61ab21..941d0b28dab 100644 --- a/cabal-install/src/Distribution/Client/Security/HTTP.hs +++ b/cabal-install/src/Distribution/Client/Security/HTTP.hs @@ -189,13 +189,8 @@ instance HC.Pretty UnexpectedResponse where ++ " for " ++ show uri -#if MIN_VERSION_base(4,8,0) deriving instance Show UnexpectedResponse instance Exception UnexpectedResponse where displayException = HC.pretty -#else -instance Show UnexpectedResponse where show = HC.pretty -instance Exception UnexpectedResponse -#endif wrapCustomEx :: ( ( HC.Throws UnexpectedResponse diff --git a/cabal-install/src/Distribution/Client/Store.hs b/cabal-install/src/Distribution/Client/Store.hs index a8358ec2f18..9ffe6099c7f 100644 --- a/cabal-install/src/Distribution/Client/Store.hs +++ b/cabal-install/src/Distribution/Client/Store.hs @@ -48,10 +48,8 @@ import Lukko #else import System.IO (openFile, IOMode(ReadWriteMode), hClose) import GHC.IO.Handle.Lock (hLock, hTryLock, LockMode(ExclusiveLock)) -#if MIN_VERSION_base(4,11,0) import GHC.IO.Handle.Lock (hUnlock) #endif -#endif -- $concurrency -- diff --git a/cabal-install/src/Distribution/Deprecated/ParseUtils.hs b/cabal-install/src/Distribution/Deprecated/ParseUtils.hs index b3b5f8bab9d..e1d389ac9aa 100644 --- a/cabal-install/src/Distribution/Deprecated/ParseUtils.hs +++ b/cabal-install/src/Distribution/Deprecated/ParseUtils.hs @@ -121,19 +121,12 @@ instance Applicative ParseResult where pure = ParseOk [] (<*>) = ap -{- FOURMOLU_DISABLE -} instance Monad ParseResult where return = pure ParseFailed err >>= _ = ParseFailed err ParseOk ws x >>= f = case f x of ParseFailed err -> ParseFailed err ParseOk ws' x' -> ParseOk (ws' ++ ws) x' -#if !(MIN_VERSION_base(4,9,0)) - fail = parseResultFail -#elif !(MIN_VERSION_base(4,13,0)) - fail = Fail.fail -#endif -{- FOURMOLU_ENABLE -} instance Foldable ParseResult where foldMap _ (ParseFailed _) = mempty diff --git a/cabal-install/src/Distribution/Deprecated/ReadP.hs b/cabal-install/src/Distribution/Deprecated/ReadP.hs index f0626d5cfe7..2e6f9c189b8 100644 --- a/cabal-install/src/Distribution/Deprecated/ReadP.hs +++ b/cabal-install/src/Distribution/Deprecated/ReadP.hs @@ -119,12 +119,6 @@ instance Monad (P s) where (Result x p) >>= k = k x `mplus` (p >>= k) (Final r) >>= k = final [ys' | (x, s) <- r, ys' <- run (k x) s] -#if !(MIN_VERSION_base(4,9,0)) - fail _ = Fail -#elif !(MIN_VERSION_base(4,13,0)) - fail = Fail.fail -#endif - instance Fail.MonadFail (P s) where fail _ = Fail @@ -180,12 +174,6 @@ instance Monad (Parser r s) where return = pure R m >>= f = R (\k -> m (\a -> let R m' = f a in m' k)) -#if !(MIN_VERSION_base(4,9,0)) - fail _ = R (const Fail) -#elif !(MIN_VERSION_base(4,13,0)) - fail = Fail.fail -#endif - instance Fail.MonadFail (Parser r s) where fail _ = R (const Fail) diff --git a/cabal-install/tests/UnitTests/Distribution/Client/ProjectConfig.hs b/cabal-install/tests/UnitTests/Distribution/Client/ProjectConfig.hs index 04dd86fc92a..9b7c31e2376 100644 --- a/cabal-install/tests/UnitTests/Distribution/Client/ProjectConfig.hs +++ b/cabal-install/tests/UnitTests/Distribution/Client/ProjectConfig.hs @@ -10,10 +10,6 @@ module UnitTests.Distribution.Client.ProjectConfig (tests) where -#if !MIN_VERSION_base(4,8,0) -import Data.Monoid -import Control.Applicative -#endif import Control.Monad import Data.Either (isRight) import Data.Foldable (for_) diff --git a/cabal-install/tests/UnitTests/Distribution/Client/UserConfig.hs b/cabal-install/tests/UnitTests/Distribution/Client/UserConfig.hs index 17adc1b75b4..91ed61c86cd 100644 --- a/cabal-install/tests/UnitTests/Distribution/Client/UserConfig.hs +++ b/cabal-install/tests/UnitTests/Distribution/Client/UserConfig.hs @@ -7,9 +7,6 @@ module UnitTests.Distribution.Client.UserConfig import Control.Exception (bracket) import Control.Monad (replicateM_) import Data.List (nub, sort) -#if !MIN_VERSION_base(4,8,0) -import Data.Monoid -#endif import System.Directory ( doesFileExist , getCurrentDirectory diff --git a/cabal-install/tests/UnitTests/Distribution/Solver/Types/OptionalStanza.hs b/cabal-install/tests/UnitTests/Distribution/Solver/Types/OptionalStanza.hs index 8f068d2ae53..3e2959b01f2 100644 --- a/cabal-install/tests/UnitTests/Distribution/Solver/Types/OptionalStanza.hs +++ b/cabal-install/tests/UnitTests/Distribution/Solver/Types/OptionalStanza.hs @@ -10,10 +10,6 @@ import UnitTests.Distribution.Client.ArbitraryInstances () import Test.Tasty import Test.Tasty.QuickCheck -#if !MIN_VERSION_base(4,8,0) -import Data.Monoid -#endif - tests :: [TestTree] tests = [ testProperty "fromList . toList = id" $ \xs -> diff --git a/cabal-testsuite/main/cabal-tests.hs b/cabal-testsuite/main/cabal-tests.hs index f27ea9b6094..517416a8773 100644 --- a/cabal-testsuite/main/cabal-tests.hs +++ b/cabal-testsuite/main/cabal-tests.hs @@ -33,12 +33,6 @@ import System.Directory import Distribution.Pretty import Data.Maybe -#if !MIN_VERSION_base(4,12,0) -import Data.Monoid ((<>)) -#endif -#if !MIN_VERSION_base(4,8,0) -import Data.Monoid (mempty) -#endif {- Note [Testsuite package environments] diff --git a/cabal-testsuite/src/Test/Cabal/TestCode.hs b/cabal-testsuite/src/Test/Cabal/TestCode.hs index 4d0762bdae5..800269c89d4 100644 --- a/cabal-testsuite/src/Test/Cabal/TestCode.hs +++ b/cabal-testsuite/src/Test/Cabal/TestCode.hs @@ -25,10 +25,8 @@ data TestCode deriving (Eq, Show, Read, Typeable) instance Exception TestCode -#if MIN_VERSION_base(4,8,0) where displayException = displayTestCode -#endif displayTestCode :: TestCode -> String displayTestCode TestCodeOk = "OK" diff --git a/cabal-testsuite/src/Test/Cabal/Workdir.hs b/cabal-testsuite/src/Test/Cabal/Workdir.hs index bbb545c6494..148508eb606 100644 --- a/cabal-testsuite/src/Test/Cabal/Workdir.hs +++ b/cabal-testsuite/src/Test/Cabal/Workdir.hs @@ -15,9 +15,8 @@ import Distribution.Utils.Path ) import System.Directory -import System.FilePath - import System.Environment ( getExecutablePath ) +import System.FilePath -- | Guess what the dist directory of a running executable is, -- by using the conventional layout of built executables diff --git a/doc/cabal-package-description-file.rst b/doc/cabal-package-description-file.rst index 2fa6e7415f2..416aa3df76c 100644 --- a/doc/cabal-package-description-file.rst +++ b/doc/cabal-package-description-file.rst @@ -646,42 +646,24 @@ describe the package as a whole: :: - tested-with: GHC == 9.0.1, GHC == 8.10.4, GHC == 8.8.4, - GHC == 8.6.5, GHC == 8.4.4, GHC == 8.2.2, GHC == 8.0.2, - GHC == 7.10.3, GHC == 7.8.4, GHC == 7.6.3, GHC == 7.4.2 + tested-with: GHC == 9.10.1, GHC == 9.8.2, GHC == 9.6.5 The same can be spread over several lines, for instance: :: - tested-with: GHC == 9.0.1 - , GHC == 8.10.4 - , GHC == 8.8.4 - , GHC == 8.6.5 - , GHC == 8.4.4 - , GHC == 8.2.2 - , GHC == 8.0.2 - , GHC == 7.10.3 - , GHC == 7.8.4 - , GHC == 7.6.3 - , GHC == 7.4.2 + tested-with: GHC == 9.10.1 + , GHC == 9.8.2 + , GHC == 9.6.5 The separating comma can also be dropped altogether: :: tested-with: - GHC == 9.0.1 - GHC == 8.10.4 - GHC == 8.8.4 - GHC == 8.6.5 - GHC == 8.4.4 - GHC == 8.2.2 - GHC == 8.0.2 - GHC == 7.10.3 - GHC == 7.8.4 - GHC == 7.6.3 - GHC == 7.4.2 + GHC == 9.10.1 + GHC == 9.8.2 + GHC == 9.6.5 However, this alternative might `disappear `__ @@ -696,24 +678,16 @@ describe the package as a whole: :: tested-with: - , GHC == 9.0.1 - , GHC == 8.10.4 - , GHC == 8.8.4 - , GHC == 8.6.5 - , GHC == 8.4.4 - , GHC == 8.2.2 - , GHC == 8.0.2 - , GHC == 7.10.3 - , GHC == 7.8.4 - , GHC == 7.6.3 - , GHC == 7.4.2 + , GHC == 9.10.1 + , GHC == 9.8.2 + , GHC == 9.6.5 2. A concise set notation syntax is available: :: - tested-with: GHC == { 9.0.1, 8.10.4, 8.8.4, 8.6.5, 8.4.4, 8.2.2, 8.0.2, 7.10.3, 7.8.4, 7.6.3, 7.4.2 } + tested-with: GHC == { 9.10.1, 9.8.2, 9.6.5 } .. pkg-field:: data-files: filename list @@ -993,10 +967,10 @@ is an example: library build-depends: - , base ^>= 4.11.1.0 - , bytestring ^>= 0.10.2.0 - , containers ^>= 0.4.2.1 || ^>= 0.5.0.0 - , transformers ^>= 0.5.0.0 + , base ^>= 4.19.0.0 + , bytestring ^>= 0.12.0.0 + , containers ^>= 0.6.8 || ^>= 0.7.0 + , transformers ^>= 0.6.1.0 hs-source-dirs: src @@ -1010,9 +984,9 @@ is an example: library attoparsec build-depends: - , base ^>= 4.11.1.0 - , bytestring ^>= 0.10.2.0 - , deepseq ^>= 1.4.0.0 + , base ^>= 4.19.0.0 + , bytestring ^>= 0.12.0.0 + , deepseq ^>= 1.5.0.0 hs-source-dirs: vendor/attoparsec-0.13.1.0 @@ -2664,11 +2638,11 @@ Starting with Cabal-2.2 it's possible to use common build info stanzas. :: common deps - build-depends: base ^>= 4.11 + build-depends: base ^>= 4.18 ghc-options: -Wall common test-deps - build-depends: tasty ^>= 0.12.0.1 + build-depends: tasty ^>= 1.4 library import: deps @@ -2879,8 +2853,8 @@ Declaring a ``custom-setup`` stanza also enables the generation of custom-setup setup-depends: - base >= 4.5 && < 4.11, - Cabal >= 1.14 && < 1.25 + base >= 4.18 && < 5, + Cabal >= 3.10 .. pkg-field:: setup-depends: package list :since: 1.24