summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorRyan Scott <ryan.gl.scott@gmail.com>2020-03-25 13:50:38 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-03-31 10:54:20 -0400
commit57b888c0e90be7189285a6b078c30b26d0923809 (patch)
tree2635fd3a7205c11b85392d3ef815e247ea7b17ec /compiler
parentf024b6e385bd1448968b7bf20de05f655c815bae (diff)
downloadhaskell-57b888c0e90be7189285a6b078c30b26d0923809.tar.gz
Require GHC 8.8 as the minimum compiler for bootstrapping
This allows us to remove several bits of CPP that are either always true or no longer reachable. As an added bonus, we no longer need to worry about importing `Control.Monad.Fail.fail` qualified to avoid clashing with `Control.Monad.fail`, since the latter is now the same as the former.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/GHC/Core/Lint.hs6
-rw-r--r--compiler/GHC/Core/Make.hs3
-rw-r--r--compiler/GHC/Core/Op/ConstantFold.hs7
-rw-r--r--compiler/GHC/Core/Op/Specialise.hs6
-rw-r--r--compiler/GHC/Core/Unify.hs6
-rw-r--r--compiler/GHC/Types/Unique/Supply.hs3
-rw-r--r--compiler/main/SysTools/Process.hs4
-rw-r--r--compiler/typecheck/TcRnTypes.hs6
-rw-r--r--compiler/typecheck/TcSMonad.hs6
-rw-r--r--compiler/utils/Binary.hs4
-rw-r--r--compiler/utils/IOEnv.hs6
11 files changed, 9 insertions, 48 deletions
diff --git a/compiler/GHC/Core/Lint.hs b/compiler/GHC/Core/Lint.hs
index 86c7ebdeea..3aeb05700c 100644
--- a/compiler/GHC/Core/Lint.hs
+++ b/compiler/GHC/Core/Lint.hs
@@ -70,7 +70,6 @@ import GHC.Types.Demand ( splitStrictSig, isBotDiv )
import GHC.Driver.Types
import GHC.Driver.Session
import Control.Monad
-import qualified Control.Monad.Fail as MonadFail
import MonadUtils
import Data.Foldable ( toList )
import Data.List.NonEmpty ( NonEmpty )
@@ -2249,16 +2248,13 @@ instance Applicative LintM where
(<*>) = ap
instance Monad LintM where
-#if !MIN_VERSION_base(4,13,0)
- fail = MonadFail.fail
-#endif
m >>= k = LintM (\ env errs ->
let (res, errs') = unLintM m env errs in
case res of
Just r -> unLintM (k r) env errs'
Nothing -> (Nothing, errs'))
-instance MonadFail.MonadFail LintM where
+instance MonadFail LintM where
fail err = failWithL (text err)
instance HasDynFlags LintM where
diff --git a/compiler/GHC/Core/Make.hs b/compiler/GHC/Core/Make.hs
index 599b28a22e..8ae58c5948 100644
--- a/compiler/GHC/Core/Make.hs
+++ b/compiler/GHC/Core/Make.hs
@@ -85,7 +85,6 @@ import Util
import Data.List
import Data.Char ( ord )
-import Control.Monad.Fail as MonadFail ( MonadFail )
infixl 4 `mkCoreApp`, `mkCoreApps`
@@ -640,7 +639,7 @@ mkFoldrExpr elt_ty result_ty c n list = do
`App` list)
-- | Make a 'build' expression applied to a locally-bound worker function
-mkBuildExpr :: (MonadFail.MonadFail m, MonadThings m, MonadUnique m)
+mkBuildExpr :: (MonadFail m, MonadThings m, MonadUnique m)
=> Type -- ^ Type of list elements to be built
-> ((Id, Type) -> (Id, Type) -> m CoreExpr) -- ^ Function that, given information about the 'Id's
-- of the binders for the build worker function, returns
diff --git a/compiler/GHC/Core/Op/ConstantFold.hs b/compiler/GHC/Core/Op/ConstantFold.hs
index 9b897f8efd..710d9ac75b 100644
--- a/compiler/GHC/Core/Op/ConstantFold.hs
+++ b/compiler/GHC/Core/Op/ConstantFold.hs
@@ -61,7 +61,6 @@ import GHC.Core.Coercion (mkUnbranchedAxInstCo,mkSymCo,Role(..))
import Control.Applicative ( Alternative(..) )
import Control.Monad
-import qualified Control.Monad.Fail as MonadFail
import Data.Bits as Bits
import qualified Data.ByteString as BS
import Data.Int
@@ -796,11 +795,7 @@ instance Monad RuleM where
Nothing -> Nothing
Just r -> runRuleM (g r) env iu fn args
-#if !MIN_VERSION_base(4,13,0)
- fail = MonadFail.fail
-#endif
-
-instance MonadFail.MonadFail RuleM where
+instance MonadFail RuleM where
fail _ = mzero
instance Alternative RuleM where
diff --git a/compiler/GHC/Core/Op/Specialise.hs b/compiler/GHC/Core/Op/Specialise.hs
index b43bc90ef1..0a09d818f9 100644
--- a/compiler/GHC/Core/Op/Specialise.hs
+++ b/compiler/GHC/Core/Op/Specialise.hs
@@ -50,7 +50,6 @@ import GHC.Types.Unique.DFM
import GHC.Core.TyCo.Rep (TyCoBinder (..))
import Control.Monad
-import qualified Control.Monad.Fail as MonadFail
{-
************************************************************************
@@ -2551,11 +2550,8 @@ instance Monad SpecM where
case f y of
SpecM z ->
z
-#if !MIN_VERSION_base(4,13,0)
- fail = MonadFail.fail
-#endif
-instance MonadFail.MonadFail SpecM where
+instance MonadFail SpecM where
fail str = SpecM $ error str
instance MonadUnique SpecM where
diff --git a/compiler/GHC/Core/Unify.hs b/compiler/GHC/Core/Unify.hs
index 99c206472c..72b62ab9cd 100644
--- a/compiler/GHC/Core/Unify.hs
+++ b/compiler/GHC/Core/Unify.hs
@@ -46,7 +46,6 @@ import GHC.Types.Unique.FM
import GHC.Types.Unique.Set
import Control.Monad
-import qualified Control.Monad.Fail as MonadFail
import Control.Applicative hiding ( empty )
import qualified Control.Applicative
@@ -1244,9 +1243,6 @@ instance Applicative UM where
(<*>) = ap
instance Monad UM where
-#if !MIN_VERSION_base(4,13,0)
- fail = MonadFail.fail
-#endif
m >>= k = UM (\state ->
do { (state', v) <- unUM m state
; unUM (k v) state' })
@@ -1260,7 +1256,7 @@ instance Alternative UM where
instance MonadPlus UM
-instance MonadFail.MonadFail UM where
+instance MonadFail UM where
fail _ = UM (\_ -> SurelyApart) -- failed pattern match
initUM :: TvSubstEnv -- subst to extend
diff --git a/compiler/GHC/Types/Unique/Supply.hs b/compiler/GHC/Types/Unique/Supply.hs
index 56c85efcce..403b88917e 100644
--- a/compiler/GHC/Types/Unique/Supply.hs
+++ b/compiler/GHC/Types/Unique/Supply.hs
@@ -44,7 +44,6 @@ import MonadUtils
import Control.Monad
import Data.Bits
import Data.Char
-import Control.Monad.Fail as Fail
#include "Unique.h"
@@ -156,7 +155,7 @@ instance Applicative UniqSM where
(*>) = thenUs_
-- TODO: try to get rid of this instance
-instance Fail.MonadFail UniqSM where
+instance MonadFail UniqSM where
fail = panic
-- | Run the 'UniqSM' action, returning the final 'UniqSupply'
diff --git a/compiler/main/SysTools/Process.hs b/compiler/main/SysTools/Process.hs
index a95d9c958a..eda4b29bc0 100644
--- a/compiler/main/SysTools/Process.hs
+++ b/compiler/main/SysTools/Process.hs
@@ -36,14 +36,10 @@ import FileCleanup
-- @process >= 1.6.8.0@).
enableProcessJobs :: CreateProcess -> CreateProcess
#if defined(MIN_VERSION_process)
-#if MIN_VERSION_process(1,6,8)
enableProcessJobs opts = opts { use_process_jobs = True }
#else
enableProcessJobs opts = opts
#endif
-#else
-enableProcessJobs opts = opts
-#endif
-- Similar to System.Process.readCreateProcessWithExitCode, but stderr is
-- inherited from the parent process, and output to stderr is not captured.
diff --git a/compiler/typecheck/TcRnTypes.hs b/compiler/typecheck/TcRnTypes.hs
index ab4d783143..aa3c0412ee 100644
--- a/compiler/typecheck/TcRnTypes.hs
+++ b/compiler/typecheck/TcRnTypes.hs
@@ -124,7 +124,6 @@ import PrelNames ( isUnboundName )
import GHC.Types.CostCentre.State
import Control.Monad (ap)
-import qualified Control.Monad.Fail as MonadFail
import Data.Set ( Set )
import qualified Data.Set as S
@@ -1653,14 +1652,11 @@ instance Applicative TcPluginM where
(<*>) = ap
instance Monad TcPluginM where
-#if !MIN_VERSION_base(4,13,0)
- fail = MonadFail.fail
-#endif
TcPluginM m >>= k =
TcPluginM (\ ev -> do a <- m ev
runTcPluginM (k a) ev)
-instance MonadFail.MonadFail TcPluginM where
+instance MonadFail TcPluginM where
fail x = TcPluginM (const $ fail x)
runTcPluginM :: TcPluginM a -> EvBindsVar -> TcM a
diff --git a/compiler/typecheck/TcSMonad.hs b/compiler/typecheck/TcSMonad.hs
index 9e934172fc..bddbcd0451 100644
--- a/compiler/typecheck/TcSMonad.hs
+++ b/compiler/typecheck/TcSMonad.hs
@@ -177,7 +177,6 @@ import Maybes
import GHC.Core.Map
import Control.Monad
-import qualified Control.Monad.Fail as MonadFail
import MonadUtils
import Data.IORef
import Data.List ( partition, mapAccumL )
@@ -2699,12 +2698,9 @@ instance Applicative TcS where
(<*>) = ap
instance Monad TcS where
-#if !MIN_VERSION_base(4,13,0)
- fail = MonadFail.fail
-#endif
m >>= k = TcS (\ebs -> unTcS m ebs >>= \r -> unTcS (k r) ebs)
-instance MonadFail.MonadFail TcS where
+instance MonadFail TcS where
fail err = TcS (\_ -> fail err)
instance MonadUnique TcS where
diff --git a/compiler/utils/Binary.hs b/compiler/utils/Binary.hs
index bedf380d29..98d4e5ad56 100644
--- a/compiler/utils/Binary.hs
+++ b/compiler/utils/Binary.hs
@@ -829,12 +829,10 @@ instance Binary RuntimeRep where
put_ bh AddrRep = putByte bh 9
put_ bh FloatRep = putByte bh 10
put_ bh DoubleRep = putByte bh 11
-#if __GLASGOW_HASKELL__ >= 807
put_ bh Int8Rep = putByte bh 12
put_ bh Word8Rep = putByte bh 13
put_ bh Int16Rep = putByte bh 14
put_ bh Word16Rep = putByte bh 15
-#endif
#if __GLASGOW_HASKELL__ >= 809
put_ bh Int32Rep = putByte bh 16
put_ bh Word32Rep = putByte bh 17
@@ -855,12 +853,10 @@ instance Binary RuntimeRep where
9 -> pure AddrRep
10 -> pure FloatRep
11 -> pure DoubleRep
-#if __GLASGOW_HASKELL__ >= 807
12 -> pure Int8Rep
13 -> pure Word8Rep
14 -> pure Int16Rep
15 -> pure Word16Rep
-#endif
#if __GLASGOW_HASKELL__ >= 809
16 -> pure Int32Rep
17 -> pure Word32Rep
diff --git a/compiler/utils/IOEnv.hs b/compiler/utils/IOEnv.hs
index fd6f6722cd..f9da146da5 100644
--- a/compiler/utils/IOEnv.hs
+++ b/compiler/utils/IOEnv.hs
@@ -43,7 +43,6 @@ import Data.IORef ( IORef, newIORef, readIORef, writeIORef, modifyIORef,
import System.IO.Unsafe ( unsafeInterleaveIO )
import System.IO ( fixIO )
import Control.Monad
-import qualified Control.Monad.Fail as MonadFail
import MonadUtils
import Control.Applicative (Alternative(..))
@@ -60,11 +59,8 @@ unIOEnv (IOEnv m) = m
instance Monad (IOEnv m) where
(>>=) = thenM
(>>) = (*>)
-#if !MIN_VERSION_base(4,13,0)
- fail = MonadFail.fail
-#endif
-instance MonadFail.MonadFail (IOEnv m) where
+instance MonadFail (IOEnv m) where
fail _ = failM -- Ignore the string
instance Applicative (IOEnv m) where