Skip to content

Commit 3ee5850

Browse files
NadiaYvetteandreabedinigeekosaurmergify[bot]
authored andcommitted
rm-old-base: remove ifdefs for pre-4.13 bases (haskell#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 <[email protected]> Co-authored-by: brandon s allbery kf8nh <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1 parent 2006c58 commit 3ee5850

File tree

43 files changed

+127
-488
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+127
-488
lines changed

.github/workflows/validate.yml

Lines changed: 63 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ concurrency:
1111
on:
1212
push:
1313
paths-ignore:
14-
- 'doc/**'
15-
- '**/README.md'
16-
- 'CONTRIBUTING.md'
14+
- "doc/**"
15+
- "**/README.md"
16+
- "CONTRIBUTING.md"
1717
branches:
1818
- master
1919
pull_request:
2020
paths-ignore:
21-
- 'doc/**'
22-
- '**/README.md'
23-
- 'CONTRIBUTING.md'
21+
- "doc/**"
22+
- "**/README.md"
23+
- "CONTRIBUTING.md"
2424
release:
2525
types:
2626
- created
@@ -41,17 +41,16 @@ on:
4141
env:
4242
# We choose a stable ghc version across all os's
4343
# which will be used to do the next release
44-
GHC_FOR_RELEASE: '9.4.8'
44+
GHC_FOR_RELEASE: "9.4.8"
4545
# Ideally we should use the version about to be released for hackage tests and benchmarks
46-
GHC_FOR_SOLVER_BENCHMARKS: '9.4.8'
47-
GHC_FOR_COMPLETE_HACKAGE_TESTS: '9.4.8'
48-
COMMON_FLAGS: '-j 2 -v'
46+
GHC_FOR_SOLVER_BENCHMARKS: "9.4.8"
47+
GHC_FOR_COMPLETE_HACKAGE_TESTS: "9.4.8"
48+
COMMON_FLAGS: "-j 2 -v"
4949

5050
# See https://github.com/haskell/cabal/blob/master/CONTRIBUTING.md#hackage-revisions
5151
ALLOWNEWER: ${{ github.event.inputs.allow-newer }}
5252
CONSTRAINTS: ${{ github.event.inputs.constraints }}
5353

54-
5554
jobs:
5655
validate:
5756
name: Validate ${{ matrix.sys.os }} ghc-${{ matrix.ghc }}
@@ -61,28 +60,36 @@ jobs:
6160
strategy:
6261
matrix:
6362
sys:
64-
- { os: windows-latest, shell: 'C:/msys64/usr/bin/bash.exe -e {0}' }
65-
- { os: ubuntu-latest, shell: bash }
66-
- { os: macos-13, shell: bash}
63+
- { os: windows-latest, shell: "C:/msys64/usr/bin/bash.exe -e {0}" }
64+
- { os: ubuntu-latest, shell: bash }
65+
- { os: macos-13, shell: bash }
6766
# If you remove something from here, then add it to the old-ghcs job.
6867
# Also a removed GHC from here means that we are actually dropping
6968
# support, so the PR *must* have a changelog entry.
70-
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']
69+
ghc:
70+
[
71+
"9.10.1",
72+
"9.8.2",
73+
"9.6.4",
74+
"9.4.8",
75+
"9.2.8",
76+
"9.0.2",
77+
"8.10.7",
78+
"8.8.4",
79+
]
7180
exclude:
7281
# corrupts GHA cache or the fabric of reality itself, see https://github.com/haskell/cabal/issues/8356
73-
- sys: { os: windows-latest, shell: 'C:/msys64/usr/bin/bash.exe -e {0}' }
74-
ghc: '8.10.7'
82+
- sys:
83+
{ os: windows-latest, shell: "C:/msys64/usr/bin/bash.exe -e {0}" }
84+
ghc: "8.10.7"
7585
# lot of segfaults caused by ghc bugs
76-
- sys: { os: windows-latest, shell: 'C:/msys64/usr/bin/bash.exe -e {0}' }
77-
ghc: '8.8.4'
78-
# 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.)"
79-
- sys: { os: windows-latest, shell: 'C:/msys64/usr/bin/bash.exe -e {0}' }
80-
ghc: '8.6.5'
86+
- sys:
87+
{ os: windows-latest, shell: "C:/msys64/usr/bin/bash.exe -e {0}" }
88+
ghc: "8.8.4"
8189
defaults:
82-
run:
83-
shell: ${{ matrix.sys.shell }}
90+
run:
91+
shell: ${{ matrix.sys.shell }}
8492
steps:
85-
8693
- name: Work around XDG directories existence (haskell-actions/setup#62)
8794
if: runner.os == 'macOS'
8895
run: |
@@ -213,21 +220,20 @@ jobs:
213220
if: matrix.ghc == env.GHC_FOR_SOLVER_BENCHMARKS
214221
run: sh validate.sh $FLAGS -s solver-benchmarks-run
215222

216-
217223
validate-old-ghcs:
218224
name: Validate old ghcs ${{ matrix.extra-ghc }}
219225
runs-on: ubuntu-latest
220226
needs: validate
221227

222228
strategy:
223229
matrix:
224-
extra-ghc: ['8.4.4', '8.2.2', '8.0.2']
230+
extra-ghc:
231+
["8.4.4", "8.2.2", "8.0.2"]
225232
## GHC 7.10.3 does not install on ubuntu-22.04 with ghcup.
226233
## Older GHCs are not supported by ghcup in the first place.
227234
fail-fast: false
228235

229236
steps:
230-
231237
- uses: actions/checkout@v4
232238

233239
- name: Install prerequisites for old GHCs
@@ -276,7 +282,7 @@ jobs:
276282
build-alpine:
277283
name: Build statically linked using alpine
278284
runs-on: ubuntu-latest
279-
container: 'alpine:3.19'
285+
container: "alpine:3.19"
280286
steps:
281287
- name: Install extra dependencies
282288
shell: sh
@@ -336,7 +342,6 @@ jobs:
336342
name: cabal-${{ runner.os }}-static-x86_64
337343
path: ${{ env.CABAL_EXEC_TAR }}
338344

339-
340345
# The previous jobs use a released version of cabal to build cabal HEAD itself
341346
# This one uses the cabal HEAD generated executable in the previous step
342347
# to build itself again, as sanity check
@@ -393,34 +398,34 @@ jobs:
393398
needs: [validate, validate-old-ghcs, build-alpine, dogfooding]
394399

395400
steps:
396-
- uses: actions/download-artifact@v3
397-
with:
398-
name: cabal-Windows-x86_64
399-
400-
- uses: actions/download-artifact@v3
401-
with:
402-
name: cabal-Linux-x86_64
403-
404-
- uses: actions/download-artifact@v3
405-
with:
406-
name: cabal-Linux-static-x86_64
407-
408-
- uses: actions/download-artifact@v3
409-
with:
410-
name: cabal-macOS-x86_64
411-
412-
- name: Create GitHub prerelease
413-
uses: marvinpinto/[email protected]
414-
with:
415-
repo_token: ${{ secrets.GITHUB_TOKEN }}
416-
automatic_release_tag: cabal-head
417-
prerelease: true
418-
title: cabal-head
419-
files: |
420-
cabal-head-Windows-x86_64.tar.gz
421-
cabal-head-Linux-x86_64.tar.gz
422-
cabal-head-Linux-static-x86_64.tar.gz
423-
cabal-head-macOS-x86_64.tar.gz
401+
- uses: actions/download-artifact@v3
402+
with:
403+
name: cabal-Windows-x86_64
404+
405+
- uses: actions/download-artifact@v3
406+
with:
407+
name: cabal-Linux-x86_64
408+
409+
- uses: actions/download-artifact@v3
410+
with:
411+
name: cabal-Linux-static-x86_64
412+
413+
- uses: actions/download-artifact@v3
414+
with:
415+
name: cabal-macOS-x86_64
416+
417+
- name: Create GitHub prerelease
418+
uses: marvinpinto/[email protected]
419+
with:
420+
repo_token: ${{ secrets.GITHUB_TOKEN }}
421+
automatic_release_tag: cabal-head
422+
prerelease: true
423+
title: cabal-head
424+
files: |
425+
cabal-head-Windows-x86_64.tar.gz
426+
cabal-head-Linux-x86_64.tar.gz
427+
cabal-head-Linux-static-x86_64.tar.gz
428+
cabal-head-macOS-x86_64.tar.gz
424429
425430
# We use this job as a summary of the workflow
426431
# It will fail if any of the previous jobs does it

Cabal-QuickCheck/src/Test/QuickCheck/GenericArbitrary.hs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ module Test.QuickCheck.GenericArbitrary (
1010
import GHC.Generics
1111
import Test.QuickCheck
1212

13-
#if !MIN_VERSION_base(4,8,0)
14-
import Control.Applicative (pure, (<$>), (<*>))
15-
#endif
16-
1713
-- Generic arbitrary for non-recursive types
1814
genericArbitrary :: (Generic a, GArbitrary (Rep a)) => Gen a
1915
genericArbitrary = fmap to garbitrary

Cabal-QuickCheck/src/Test/QuickCheck/Instances/Cabal.hs

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,13 @@ module Test.QuickCheck.Instances.Cabal () where
66
#if !MIN_VERSION_base(4,18,0)
77
import Control.Applicative (liftA2)
88
#endif
9-
import Data.Bits (shiftR)
9+
import Data.Bits (countLeadingZeros, finiteBitSize, shiftL, shiftR)
1010
import Data.Char (isAlphaNum, isDigit, toLower)
1111
import Data.List (intercalate, (\\))
1212
import Data.List.NonEmpty (NonEmpty (..))
1313
import Distribution.Utils.Generic (lowercase)
1414
import Test.QuickCheck
1515

16-
#if MIN_VERSION_base(4,8,0)
17-
import Data.Bits (countLeadingZeros, finiteBitSize, shiftL)
18-
#else
19-
import Data.Bits (popCount)
20-
#endif
21-
2216
import Distribution.CabalSpecVersion
2317
import Distribution.Compat.NonEmptySet (NonEmptySet)
2418
import Distribution.Compiler
@@ -54,10 +48,6 @@ import Test.QuickCheck.GenericArbitrary
5448
import qualified Data.ByteString.Char8 as BS8
5549
import qualified Distribution.Compat.NonEmptySet as NES
5650

57-
#if !MIN_VERSION_base(4,8,0)
58-
import Control.Applicative (pure, (<$>), (<*>))
59-
#endif
60-
6151
-------------------------------------------------------------------------------
6252
-- CabalSpecVersion
6353
-------------------------------------------------------------------------------
@@ -541,8 +531,4 @@ intSqrt n = case compare n 0 of
541531
iter x = shiftR (x + n `div` x) 1
542532

543533
guess :: Int
544-
#if MIN_VERSION_base(4,8,0)
545534
guess = shiftR n (shiftL (finiteBitSize n - countLeadingZeros n) 1)
546-
#else
547-
guess = shiftR n (shiftR (popCount n) 1)
548-
#endif

Cabal-hooks/Cabal-hooks.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ library
2929
build-depends:
3030
Cabal-syntax >= 3.13 && < 3.15,
3131
Cabal >= 3.13 && < 3.15,
32-
base >= 4.11 && < 5,
32+
base >= 4.13 && < 5,
3333
containers >= 0.5.0.0 && < 0.8,
3434
transformers >= 0.5.6.0 && < 0.7
3535

Cabal-syntax/Cabal-syntax.cabal

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ library
2929

3030
build-depends:
3131
array >= 0.4.0.1 && < 0.6,
32-
base >= 4.11 && < 5,
32+
base >= 4.13 && < 5,
3333
binary >= 0.7 && < 0.9,
3434
bytestring >= 0.10.0.0 && < 0.13,
3535
containers >= 0.5.0.0 && < 0.8,
@@ -76,7 +76,6 @@ library
7676
Distribution.Compat.Parsing
7777
Distribution.Compat.Prelude
7878
Distribution.Compat.Semigroup
79-
Distribution.Compat.Typeable
8079
Distribution.Compiler
8180
Distribution.FieldGrammar
8281
Distribution.FieldGrammar.Class

Cabal-syntax/src/Distribution/Compat/Graph.hs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -148,24 +148,20 @@ instance (Eq (Key a), Eq a) => Eq (Graph a) where
148148
g1 == g2 = graphMap g1 == graphMap g2
149149

150150
instance Foldable.Foldable Graph where
151+
elem x = Foldable.elem x . graphMap
151152
fold = Foldable.fold . graphMap
152-
foldr f z = Foldable.foldr f z . graphMap
153153
foldl f z = Foldable.foldl f z . graphMap
154-
foldMap f = Foldable.foldMap f . graphMap
155154
foldl' f z = Foldable.foldl' f z . graphMap
155+
foldr f z = Foldable.foldr f z . graphMap
156156
foldr' f z = Foldable.foldr' f z . graphMap
157-
#ifdef MIN_VERSION_base
158-
#if MIN_VERSION_base(4,8,0)
157+
foldMap f = Foldable.foldMap f . graphMap
159158
length = Foldable.length . graphMap
160-
null = Foldable.null . graphMap
161-
toList = Foldable.toList . graphMap
162-
elem x = Foldable.elem x . graphMap
163159
maximum = Foldable.maximum . graphMap
164160
minimum = Foldable.minimum . graphMap
165-
sum = Foldable.sum . graphMap
161+
null = Foldable.null . graphMap
166162
product = Foldable.product . graphMap
167-
#endif
168-
#endif
163+
sum = Foldable.sum . graphMap
164+
toList = Foldable.toList . graphMap
169165

170166
instance (NFData a, NFData (Key a)) => NFData (Graph a) where
171167
rnf

Cabal-syntax/src/Distribution/Compat/Newtype.hs

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,10 @@ module Distribution.Compat.Newtype
1414
, unpack'
1515
) where
1616

17+
import Data.Coerce (Coercible, coerce)
1718
import Data.Functor.Identity (Identity (..))
1819
import Data.Monoid (Endo (..), Product (..), Sum (..))
1920

20-
#if MIN_VERSION_base(4,7,0)
21-
import Data.Coerce (coerce, Coercible)
22-
#else
23-
import Unsafe.Coerce (unsafeCoerce)
24-
#endif
25-
2621
-- | The @FunctionalDependencies@ version of 'Newtype' type-class.
2722
--
2823
-- Since Cabal-3.0 class arguments are in a different order than in @newtype@ package.
@@ -40,22 +35,12 @@ import Unsafe.Coerce (unsafeCoerce)
4035
{- FOURMOLU_DISABLE -}
4136
class Newtype o n | n -> o where
4237
pack :: o -> n
43-
#if MIN_VERSION_base(4,7,0)
4438
default pack :: Coercible o n => o -> n
4539
pack = coerce
46-
#else
47-
default pack :: o -> n
48-
pack = unsafeCoerce
49-
#endif
5040

5141
unpack :: n -> o
52-
#if MIN_VERSION_base(4,7,0)
5342
default unpack :: Coercible n o => n -> o
5443
unpack = coerce
55-
#else
56-
default unpack :: n -> o
57-
unpack = unsafeCoerce
58-
#endif
5944
{- FOURMOLU_ENABLE -}
6045

6146
instance Newtype a (Identity a)

Cabal-syntax/src/Distribution/Compat/NonEmptySet.hs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,9 @@ instance Ord a => Semigroup (NonEmptySet a) where
8787
instance F.Foldable NonEmptySet where
8888
foldMap f (NES s) = F.foldMap f s
8989
foldr f z (NES s) = F.foldr f z s
90-
91-
#if MIN_VERSION_base(4,8,0)
92-
toList = toList
93-
null _ = False
90+
toList = toList
91+
null _ = False
9492
length (NES s) = F.length s
95-
#endif
9693

9794
-------------------------------------------------------------------------------
9895
-- Constructors

0 commit comments

Comments
 (0)