diff options
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/GHC/Core/Lint.hs | 6 | ||||
-rw-r--r-- | compiler/GHC/Core/Make.hs | 3 | ||||
-rw-r--r-- | compiler/GHC/Core/Op/ConstantFold.hs | 7 | ||||
-rw-r--r-- | compiler/GHC/Core/Op/Specialise.hs | 6 | ||||
-rw-r--r-- | compiler/GHC/Core/Unify.hs | 6 | ||||
-rw-r--r-- | compiler/basicTypes/UniqSupply.hs | 3 | ||||
-rw-r--r-- | compiler/main/SysTools/Process.hs | 4 | ||||
-rw-r--r-- | compiler/typecheck/TcRnTypes.hs | 6 | ||||
-rw-r--r-- | compiler/typecheck/TcSMonad.hs | 6 | ||||
-rw-r--r-- | compiler/utils/Binary.hs | 4 | ||||
-rw-r--r-- | compiler/utils/IOEnv.hs | 6 |
11 files changed, 9 insertions, 48 deletions
diff --git a/compiler/GHC/Core/Lint.hs b/compiler/GHC/Core/Lint.hs index 47a0a9cd2d..ae648e5b6e 100644 --- a/compiler/GHC/Core/Lint.hs +++ b/compiler/GHC/Core/Lint.hs @@ -70,7 +70,6 @@ import 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 d1fe1b0aa1..afed55c51b 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 126666a509..f88e223662 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 250a0f7313..83d7b88380 100644 --- a/compiler/GHC/Core/Op/Specialise.hs +++ b/compiler/GHC/Core/Op/Specialise.hs @@ -50,7 +50,6 @@ import UniqDFM 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 10b1a85342..e68a531137 100644 --- a/compiler/GHC/Core/Unify.hs +++ b/compiler/GHC/Core/Unify.hs @@ -46,7 +46,6 @@ import UniqFM import UniqSet 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/basicTypes/UniqSupply.hs b/compiler/basicTypes/UniqSupply.hs index fb321454aa..b9fbe6147f 100644 --- a/compiler/basicTypes/UniqSupply.hs +++ b/compiler/basicTypes/UniqSupply.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 aa5d6617d3..68c0ea4c9b 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 1f33287bb8..342b8e6fa6 100644 --- a/compiler/typecheck/TcRnTypes.hs +++ b/compiler/typecheck/TcRnTypes.hs @@ -124,7 +124,6 @@ import PrelNames ( isUnboundName ) import CostCentreState 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 fe74720796..f67b47ef58 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 16d7ccf37d..50ef5e12cf 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 8067123211..4311eaf12f 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 |