Skip to content

Commit f0bc384

Browse files
committed
We just dropped everything below (ghc 8.0.0, base 4.9.0.0, cabal 2.0.0.0)
1 parent 7e5dd02 commit f0bc384

41 files changed

Lines changed: 275 additions & 753 deletions

File tree

Some content is hidden

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

Cabal-syntax/Cabal-syntax.cabal

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,8 @@ library
5252
-Wincomplete-uni-patterns
5353
-Wincomplete-record-updates
5454
-Wno-unticked-promoted-constructors
55-
56-
if impl(ghc >= 8.0)
57-
ghc-options: -Wcompat -Wnoncanonical-monad-instances
55+
-Wcompat
56+
-Wnoncanonical-monad-instances
5857

5958
if impl(ghc >= 8.0) && impl(ghc < 8.8)
6059
ghc-options: -Wnoncanonical-monadfail-instances

Cabal/src/Distribution/Simple/Build.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1190,7 +1190,7 @@ builtinAutogenFiles pkg lbi clbi =
11901190
pathsFile = AutogenModule (autogenPathsModuleName pkg) (Suffix "hs")
11911191
pathsContents = toUTF8LBS $ generatePathsModule pkg lbi clbi
11921192
packageInfoFile = AutogenModule (autogenPackageInfoModuleName pkg) (Suffix "hs")
1193-
packageInfoContents = toUTF8LBS $ generatePackageInfoModule pkg lbi
1193+
packageInfoContents = toUTF8LBS $ generatePackageInfoModule pkg
11941194
cppHeaderFile = AutogenFile $ toShortText cppHeaderName
11951195
cppHeaderContents = toUTF8LBS $ generateCabalMacrosHeader pkg lbi clbi
11961196

Cabal/src/Distribution/Simple/Build/PackageInfoModule.hs

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,14 @@ import Distribution.Compat.Prelude
1919
import Prelude ()
2020

2121
import Distribution.Package
22-
import Distribution.PackageDescription
23-
import Distribution.Simple.Compiler
24-
import Distribution.Simple.LocalBuildInfo
25-
import Distribution.Utils.ShortText
26-
import Distribution.Version
22+
( PackageName
23+
, packageName
24+
, packageVersion
25+
, unPackageName
26+
)
27+
import Distribution.Types.PackageDescription (PackageDescription (..))
28+
import Distribution.Types.Version (versionNumbers)
29+
import Distribution.Utils.ShortText (fromShortText)
2730

2831
import qualified Distribution.Simple.Build.PackageInfoModule.Z as Z
2932

@@ -33,24 +36,16 @@ import qualified Distribution.Simple.Build.PackageInfoModule.Z as Z
3336

3437
-- ------------------------------------------------------------
3538

36-
generatePackageInfoModule :: PackageDescription -> LocalBuildInfo -> String
37-
generatePackageInfoModule pkg_descr lbi =
39+
generatePackageInfoModule :: PackageDescription -> String
40+
generatePackageInfoModule pkg_descr =
3841
Z.render
3942
Z.Z
4043
{ Z.zPackageName = showPkgName $ packageName pkg_descr
4144
, Z.zVersionDigits = show $ versionNumbers $ packageVersion pkg_descr
4245
, Z.zSynopsis = fromShortText $ synopsis pkg_descr
4346
, Z.zCopyright = fromShortText $ copyright pkg_descr
4447
, Z.zHomepage = fromShortText $ homepage pkg_descr
45-
, Z.zSupportsNoRebindableSyntax = supports_rebindable_syntax
4648
}
47-
where
48-
supports_rebindable_syntax = ghc_newer_than (mkVersion [7, 0, 1])
49-
50-
ghc_newer_than minVersion =
51-
case compilerCompatVersion GHC (compiler lbi) of
52-
Nothing -> False
53-
Just version -> version `withinRange` orLaterVersion minVersion
5449

5550
showPkgName :: PackageName -> String
5651
showPkgName = map fixchar . unPackageName

Cabal/src/Distribution/Simple/Build/PackageInfoModule/Z.hs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,20 @@
22

33
module Distribution.Simple.Build.PackageInfoModule.Z (render, Z (..)) where
44

5-
import Distribution.ZinzaPrelude
5+
import Distribution.ZinzaPrelude (Generic, execWriter, tell)
66

77
data Z = Z
88
{ zPackageName :: String
99
, zVersionDigits :: String
1010
, zSynopsis :: String
1111
, zCopyright :: String
1212
, zHomepage :: String
13-
, zSupportsNoRebindableSyntax :: Bool
1413
}
1514
deriving (Generic)
1615

1716
render :: Z -> String
1817
render z_root = execWriter $ do
19-
if (zSupportsNoRebindableSyntax z_root)
20-
then do
21-
tell "{-# LANGUAGE NoRebindableSyntax #-}\n"
22-
return ()
23-
else do
24-
return ()
18+
tell "{-# LANGUAGE NoRebindableSyntax #-}\n"
2519
tell "{-# OPTIONS_GHC -w #-}\n"
2620
tell "\n"
2721
tell "{-|\n"

Cabal/src/Distribution/Simple/Build/PathsModule.hs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ generatePathsModule pkg_descr lbi clbi =
4444
Z.Z
4545
{ Z.zPackageName = packageName pkg_descr
4646
, Z.zVersionDigits = show $ versionNumbers $ packageVersion pkg_descr
47-
, Z.zSupportsCpp = supports_cpp
48-
, Z.zSupportsNoRebindableSyntax = supports_rebindable_syntax
4947
, Z.zAbsolute = absolute
5048
, Z.zRelocatable = relocatable lbi
5149
, Z.zIsWindows = isWindows
@@ -63,15 +61,6 @@ generatePathsModule pkg_descr lbi clbi =
6361
, Z.zSysconfdir = zSysconfdir
6462
}
6563
where
66-
supports_cpp = supports_language_pragma
67-
supports_rebindable_syntax = ghc_newer_than (mkVersion [7, 0, 1])
68-
supports_language_pragma = ghc_newer_than (mkVersion [6, 6, 1])
69-
70-
ghc_newer_than minVersion =
71-
case compilerCompatVersion GHC (compiler lbi) of
72-
Nothing -> False
73-
Just version -> version `withinRange` orLaterVersion minVersion
74-
7564
-- In several cases we cannot make relocatable installations
7665
absolute =
7766
hasLibs pkg_descr -- we can only make progs relocatable

Cabal/src/Distribution/Simple/Build/PathsModule/Z.hs

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import Distribution.ZinzaPrelude
55
data Z
66
= Z {zPackageName :: PackageName,
77
zVersionDigits :: String,
8-
zSupportsCpp :: Bool,
9-
zSupportsNoRebindableSyntax :: Bool,
108
zAbsolute :: Bool,
119
zRelocatable :: Bool,
1210
zIsWindows :: Bool,
@@ -25,18 +23,8 @@ data Z
2523
deriving Generic
2624
render :: Z -> String
2725
render z_root = execWriter $ do
28-
if (zSupportsCpp z_root)
29-
then do
30-
tell "{-# LANGUAGE CPP #-}\n"
31-
return ()
32-
else do
33-
return ()
34-
if (zSupportsNoRebindableSyntax z_root)
35-
then do
36-
tell "{-# LANGUAGE NoRebindableSyntax #-}\n"
37-
return ()
38-
else do
39-
return ()
26+
tell "{-# LANGUAGE CPP #-}\n"
27+
tell "{-# LANGUAGE NoRebindableSyntax #-}\n"
4028
if (zNot z_root (zAbsolute z_root))
4129
then do
4230
tell "{-# LANGUAGE ForeignFunctionInterface #-}\n"
@@ -91,25 +79,8 @@ render z_root = execWriter $ do
9179
else do
9280
return ()
9381
tell "\n"
94-
if (zSupportsCpp z_root)
95-
then do
96-
tell "#if defined(VERSION_base)\n"
97-
tell "\n"
98-
tell "#if MIN_VERSION_base(4,0,0)\n"
99-
tell "catchIO :: IO a -> (Exception.IOException -> IO a) -> IO a\n"
100-
tell "#else\n"
101-
tell "catchIO :: IO a -> (Exception.Exception -> IO a) -> IO a\n"
102-
tell "#endif\n"
103-
tell "\n"
104-
tell "#else\n"
105-
tell "catchIO :: IO a -> (Exception.IOException -> IO a) -> IO a\n"
106-
tell "#endif\n"
107-
tell "catchIO = Exception.catch\n"
108-
return ()
109-
else do
110-
tell "catchIO :: IO a -> (Exception.IOException -> IO a) -> IO a\n"
111-
tell "catchIO = Exception.catch\n"
112-
return ()
82+
tell "catchIO :: IO a -> (Exception.IOException -> IO a) -> IO a\n"
83+
tell "catchIO = Exception.catch\n"
11384
tell "\n"
11485
tell "-- |The package version.\n"
11586
tell "version :: Version\n"

Cabal/src/Distribution/Simple/Compiler.hs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -492,15 +492,8 @@ reexportedAsSupported comp = case compilerFlavor comp of
492492
-- "dynamic-library-dirs"?
493493
libraryDynDirSupported :: Compiler -> Bool
494494
libraryDynDirSupported comp = case compilerFlavor comp of
495-
GHC ->
496-
-- Not just v >= mkVersion [8,0,1,20161022], as there
497-
-- are many GHC 8.1 nightlies which don't support this.
498-
( (v >= mkVersion [8, 0, 1, 20161022] && v < mkVersion [8, 1])
499-
|| v >= mkVersion [8, 1, 20161021]
500-
)
495+
GHC -> True
501496
_ -> False
502-
where
503-
v = compilerVersion comp
504497

505498
-- | Does this compiler's "ar" command supports response file
506499
-- arguments (i.e. @file-style arguments).

Cabal/src/Distribution/Simple/Configure.hs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2096,7 +2096,7 @@ getInstalledPackages verbosity comp mbWorkDir packageDBs progdb = do
20962096
-- do not check empty packagedbs (ghc-pkg would error out)
20972097
packageDBs' <- filterM packageDBExists packageDBs
20982098
case compilerFlavor comp of
2099-
GHC -> GHC.getInstalledPackages verbosity comp mbWorkDir packageDBs' progdb
2099+
GHC -> GHC.getInstalledPackages verbosity mbWorkDir packageDBs' progdb
21002100
GHCJS -> GHCJS.getInstalledPackages verbosity mbWorkDir packageDBs' progdb
21012101
UHC -> UHC.getInstalledPackages verbosity comp mbWorkDir packageDBs' progdb
21022102
flv ->
@@ -2923,12 +2923,7 @@ checkForeignLibSupported :: Compiler -> Platform -> ForeignLib -> Maybe String
29232923
checkForeignLibSupported comp platform flib = go (compilerFlavor comp)
29242924
where
29252925
go :: CompilerFlavor -> Maybe String
2926-
go GHC
2927-
| compilerVersion comp < mkVersion [7, 8] =
2928-
unsupported
2929-
[ "Building foreign libraries is only supported with GHC >= 7.8"
2930-
]
2931-
| otherwise = goGhcPlatform platform
2926+
go GHC = goGhcPlatform platform
29322927
go _ =
29332928
unsupported
29342929
[ "Building foreign libraries is currently only supported with ghc"

Cabal/src/Distribution/Simple/GHC.hs

Lines changed: 9 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,8 @@ configureCompiler verbosity hcPath conf0 = do
200200
++ prettyShow ghcVersion
201201

202202
let implInfo = ghcVersionImplInfo ghcVersion
203-
languages <- Internal.getLanguages verbosity implInfo ghcProg
204-
extensions0 <- Internal.getExtensions verbosity implInfo ghcProg
203+
languages <- Internal.getLanguages implInfo
204+
extensions0 <- Internal.getExtensions verbosity ghcProg
205205

206206
ghcInfo <- Internal.getGhcInfo verbosity implInfo ghcProg
207207

@@ -489,14 +489,13 @@ getPackageDBContents verbosity mbWorkDir packagedb progdb = do
489489
-- | Given a package DB stack, return all installed packages.
490490
getInstalledPackages
491491
:: Verbosity
492-
-> Compiler
493492
-> Maybe (SymbolicPath CWD (Dir from))
494493
-> PackageDBStackX (SymbolicPath from (Dir PkgDB))
495494
-> ProgramDb
496495
-> IO InstalledPackageIndex
497-
getInstalledPackages verbosity comp mbWorkDir packagedbs progdb = do
496+
getInstalledPackages verbosity mbWorkDir packagedbs progdb = do
498497
checkPackageDbEnvVar verbosity
499-
checkPackageDbStack verbosity comp packagedbs
498+
checkPackageDbStack verbosity packagedbs
500499
pkgss <- getInstalledPackages' verbosity mbWorkDir packagedbs progdb
501500
index <- toPackageIndex verbosity pkgss progdb
502501
return $! hackRtsPackage index
@@ -576,13 +575,8 @@ checkPackageDbEnvVar :: Verbosity -> IO ()
576575
checkPackageDbEnvVar verbosity =
577576
Internal.checkPackageDbEnvVar verbosity "GHC" "GHC_PACKAGE_PATH"
578577

579-
checkPackageDbStack :: Eq fp => Verbosity -> Compiler -> PackageDBStackX fp -> IO ()
580-
checkPackageDbStack verbosity comp =
581-
if flagPackageConf implInfo
582-
then checkPackageDbStackPre76 verbosity
583-
else checkPackageDbStackPost76 verbosity
584-
where
585-
implInfo = ghcVersionImplInfo (compilerVersion comp)
578+
checkPackageDbStack :: Eq fp => Verbosity -> PackageDBStackX fp -> IO ()
579+
checkPackageDbStack verbosity = checkPackageDbStackPost76 verbosity
586580

587581
checkPackageDbStackPost76 :: Eq fp => Verbosity -> PackageDBStackX fp -> IO ()
588582
checkPackageDbStackPost76 _ (GlobalPackageDB : rest)
@@ -592,15 +586,6 @@ checkPackageDbStackPost76 verbosity rest
592586
dieWithException verbosity CheckPackageDbStackPost76
593587
checkPackageDbStackPost76 _ _ = return ()
594588

595-
checkPackageDbStackPre76 :: Eq fp => Verbosity -> PackageDBStackX fp -> IO ()
596-
checkPackageDbStackPre76 _ (GlobalPackageDB : rest)
597-
| GlobalPackageDB `notElem` rest = return ()
598-
checkPackageDbStackPre76 verbosity rest
599-
| GlobalPackageDB `notElem` rest =
600-
dieWithException verbosity CheckPackageDbStackPre76
601-
checkPackageDbStackPre76 verbosity _ =
602-
dieWithException verbosity GlobalPackageDbSpecifiedFirst
603-
604589
-- GHC < 6.10 put "$topdir/include/mingw" in rts's installDirs. This
605590
-- breaks when you want to use a different gcc, so we need to filter
606591
-- it out.
@@ -710,7 +695,7 @@ startInterpreter verbosity progdb comp platform packageDBs = do
710695
{ ghcOptMode = toFlag GhcModeInteractive
711696
, ghcOptPackageDBs = packageDBs
712697
}
713-
checkPackageDbStack verbosity comp packageDBs
698+
checkPackageDbStack verbosity packageDBs
714699
(ghcProg, _) <- requireProgram verbosity ghcProgram progdb
715700
-- This doesn't pass source file arguments to GHC, so we don't have to worry
716701
-- about using a response file here.
@@ -1134,23 +1119,9 @@ installLib verbosity lbi targetDir dynlibTargetDir bytecodeTargetDir _builtDir p
11341119
-- -----------------------------------------------------------------------------
11351120
-- Registering
11361121

1137-
hcPkgInfo :: ProgramDb -> HcPkg.HcPkgInfo
1122+
hcPkgInfo :: ProgramDb -> HcPkg.ConfiguredProgram
11381123
hcPkgInfo progdb =
1139-
HcPkg.HcPkgInfo
1140-
{ HcPkg.hcPkgProgram = ghcPkgProg
1141-
, HcPkg.noPkgDbStack = v < [6, 9]
1142-
, HcPkg.noVerboseFlag = v < [6, 11]
1143-
, HcPkg.flagPackageConf = v < [7, 5]
1144-
, HcPkg.supportsDirDbs = v >= [6, 8]
1145-
, HcPkg.requiresDirDbs = v >= [7, 10]
1146-
, HcPkg.nativeMultiInstance = v >= [7, 10]
1147-
, HcPkg.recacheMultiInstance = v >= [6, 12]
1148-
, HcPkg.suppressFilesCheck = v >= [6, 6]
1149-
}
1150-
where
1151-
v = versionNumbers ver
1152-
ghcPkgProg = fromMaybe (error "GHC.hcPkgInfo: no ghc program") $ lookupProgram ghcPkgProgram progdb
1153-
ver = fromMaybe (error "GHC.hcPkgInfo: no ghc version") $ programVersion ghcPkgProg
1124+
fromMaybe (error "GHC.hcPkgInfo: no ghc program") $ lookupProgram ghcPkgProgram progdb
11541125

11551126
registerPackage
11561127
:: Verbosity

0 commit comments

Comments
 (0)