Commit 57b888c0 authored by Ryan Scott's avatar Ryan Scott Committed by Marge Bot

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.
parent f024b6e3
Pipeline #17350 passed with stages
in 587 minutes and 23 seconds
...@@ -2,7 +2,7 @@ variables: ...@@ -2,7 +2,7 @@ variables:
GIT_SSL_NO_VERIFY: "1" GIT_SSL_NO_VERIFY: "1"
# Commit of ghc/ci-images repository from which to pull Docker images # Commit of ghc/ci-images repository from which to pull Docker images
DOCKER_REV: 408eff66aef6ca2b44446c694c5a56d6ca0460cc DOCKER_REV: 3f731f5d37a156e7ebe10cd32656946083baaf4a
# Sequential version number capturing the versions of all tools fetched by # Sequential version number capturing the versions of all tools fetched by
# .gitlab/ci.sh. # .gitlab/ci.sh.
...@@ -390,7 +390,7 @@ validate-x86_64-darwin: ...@@ -390,7 +390,7 @@ validate-x86_64-darwin:
tags: tags:
- x86_64-darwin - x86_64-darwin
variables: variables:
GHC_VERSION: 8.6.5 GHC_VERSION: 8.8.3
CABAL_INSTALL_VERSION: 3.0.0.0 CABAL_INSTALL_VERSION: 3.0.0.0
BIN_DIST_PREP_TAR_COMP: "ghc-x86_64-apple-darwin.tar.xz" BIN_DIST_PREP_TAR_COMP: "ghc-x86_64-apple-darwin.tar.xz"
MACOSX_DEPLOYMENT_TARGET: "10.7" MACOSX_DEPLOYMENT_TARGET: "10.7"
...@@ -419,7 +419,7 @@ validate-x86_64-darwin: ...@@ -419,7 +419,7 @@ validate-x86_64-darwin:
tags: tags:
- x86_64-darwin - x86_64-darwin
variables: variables:
GHC_VERSION: 8.6.3 GHC_VERSION: 8.8.3
MACOSX_DEPLOYMENT_TARGET: "10.7" MACOSX_DEPLOYMENT_TARGET: "10.7"
ac_cv_func_clock_gettime: "no" ac_cv_func_clock_gettime: "no"
LANG: "en_US.UTF-8" LANG: "en_US.UTF-8"
......
...@@ -70,7 +70,6 @@ import GHC.Types.Demand ( splitStrictSig, isBotDiv ) ...@@ -70,7 +70,6 @@ import GHC.Types.Demand ( splitStrictSig, isBotDiv )
import GHC.Driver.Types import GHC.Driver.Types
import GHC.Driver.Session import GHC.Driver.Session
import Control.Monad import Control.Monad
import qualified Control.Monad.Fail as MonadFail
import MonadUtils import MonadUtils
import Data.Foldable ( toList ) import Data.Foldable ( toList )
import Data.List.NonEmpty ( NonEmpty ) import Data.List.NonEmpty ( NonEmpty )
...@@ -2249,16 +2248,13 @@ instance Applicative LintM where ...@@ -2249,16 +2248,13 @@ instance Applicative LintM where
(<*>) = ap (<*>) = ap
instance Monad LintM where instance Monad LintM where
#if !MIN_VERSION_base(4,13,0)
fail = MonadFail.fail
#endif
m >>= k = LintM (\ env errs -> m >>= k = LintM (\ env errs ->
let (res, errs') = unLintM m env errs in let (res, errs') = unLintM m env errs in
case res of case res of
Just r -> unLintM (k r) env errs' Just r -> unLintM (k r) env errs'
Nothing -> (Nothing, errs')) Nothing -> (Nothing, errs'))
instance MonadFail.MonadFail LintM where instance MonadFail LintM where
fail err = failWithL (text err) fail err = failWithL (text err)
instance HasDynFlags LintM where instance HasDynFlags LintM where
......
...@@ -85,7 +85,6 @@ import Util ...@@ -85,7 +85,6 @@ import Util
import Data.List import Data.List
import Data.Char ( ord ) import Data.Char ( ord )
import Control.Monad.Fail as MonadFail ( MonadFail )
infixl 4 `mkCoreApp`, `mkCoreApps` infixl 4 `mkCoreApp`, `mkCoreApps`
...@@ -640,7 +639,7 @@ mkFoldrExpr elt_ty result_ty c n list = do ...@@ -640,7 +639,7 @@ mkFoldrExpr elt_ty result_ty c n list = do
`App` list) `App` list)
-- | Make a 'build' expression applied to a locally-bound worker function -- | 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 => Type -- ^ Type of list elements to be built
-> ((Id, Type) -> (Id, Type) -> m CoreExpr) -- ^ Function that, given information about the 'Id's -> ((Id, Type) -> (Id, Type) -> m CoreExpr) -- ^ Function that, given information about the 'Id's
-- of the binders for the build worker function, returns -- of the binders for the build worker function, returns
......
...@@ -61,7 +61,6 @@ import GHC.Core.Coercion (mkUnbranchedAxInstCo,mkSymCo,Role(..)) ...@@ -61,7 +61,6 @@ import GHC.Core.Coercion (mkUnbranchedAxInstCo,mkSymCo,Role(..))
import Control.Applicative ( Alternative(..) ) import Control.Applicative ( Alternative(..) )
import Control.Monad import Control.Monad
import qualified Control.Monad.Fail as MonadFail
import Data.Bits as Bits import Data.Bits as Bits
import qualified Data.ByteString as BS import qualified Data.ByteString as BS
import Data.Int import Data.Int
...@@ -796,11 +795,7 @@ instance Monad RuleM where ...@@ -796,11 +795,7 @@ instance Monad RuleM where
Nothing -> Nothing Nothing -> Nothing
Just r -> runRuleM (g r) env iu fn args Just r -> runRuleM (g r) env iu fn args
#if !MIN_VERSION_base(4,13,0) instance MonadFail RuleM where
fail = MonadFail.fail
#endif
instance MonadFail.MonadFail RuleM where
fail _ = mzero fail _ = mzero
instance Alternative RuleM where instance Alternative RuleM where
......
...@@ -50,7 +50,6 @@ import GHC.Types.Unique.DFM ...@@ -50,7 +50,6 @@ import GHC.Types.Unique.DFM
import GHC.Core.TyCo.Rep (TyCoBinder (..)) import GHC.Core.TyCo.Rep (TyCoBinder (..))
import Control.Monad import Control.Monad
import qualified Control.Monad.Fail as MonadFail
{- {-
************************************************************************ ************************************************************************
...@@ -2551,11 +2550,8 @@ instance Monad SpecM where ...@@ -2551,11 +2550,8 @@ instance Monad SpecM where
case f y of case f y of
SpecM z -> SpecM z ->
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 fail str = SpecM $ error str
instance MonadUnique SpecM where instance MonadUnique SpecM where
......
...@@ -46,7 +46,6 @@ import GHC.Types.Unique.FM ...@@ -46,7 +46,6 @@ import GHC.Types.Unique.FM
import GHC.Types.Unique.Set import GHC.Types.Unique.Set
import Control.Monad import Control.Monad
import qualified Control.Monad.Fail as MonadFail
import Control.Applicative hiding ( empty ) import Control.Applicative hiding ( empty )
import qualified Control.Applicative import qualified Control.Applicative
...@@ -1244,9 +1243,6 @@ instance Applicative UM where ...@@ -1244,9 +1243,6 @@ instance Applicative UM where
(<*>) = ap (<*>) = ap
instance Monad UM where instance Monad UM where
#if !MIN_VERSION_base(4,13,0)
fail = MonadFail.fail
#endif
m >>= k = UM (\state -> m >>= k = UM (\state ->
do { (state', v) <- unUM m state do { (state', v) <- unUM m state
; unUM (k v) state' }) ; unUM (k v) state' })
...@@ -1260,7 +1256,7 @@ instance Alternative UM where ...@@ -1260,7 +1256,7 @@ instance Alternative UM where
instance MonadPlus UM instance MonadPlus UM
instance MonadFail.MonadFail UM where instance MonadFail UM where
fail _ = UM (\_ -> SurelyApart) -- failed pattern match fail _ = UM (\_ -> SurelyApart) -- failed pattern match
initUM :: TvSubstEnv -- subst to extend initUM :: TvSubstEnv -- subst to extend
......
...@@ -44,7 +44,6 @@ import MonadUtils ...@@ -44,7 +44,6 @@ import MonadUtils
import Control.Monad import Control.Monad
import Data.Bits import Data.Bits
import Data.Char import Data.Char
import Control.Monad.Fail as Fail
#include "Unique.h" #include "Unique.h"
...@@ -156,7 +155,7 @@ instance Applicative UniqSM where ...@@ -156,7 +155,7 @@ instance Applicative UniqSM where
(*>) = thenUs_ (*>) = thenUs_
-- TODO: try to get rid of this instance -- TODO: try to get rid of this instance
instance Fail.MonadFail UniqSM where instance MonadFail UniqSM where
fail = panic fail = panic
-- | Run the 'UniqSM' action, returning the final 'UniqSupply' -- | Run the 'UniqSM' action, returning the final 'UniqSupply'
......
...@@ -36,14 +36,10 @@ import FileCleanup ...@@ -36,14 +36,10 @@ import FileCleanup
-- @process >= 1.6.8.0@). -- @process >= 1.6.8.0@).
enableProcessJobs :: CreateProcess -> CreateProcess enableProcessJobs :: CreateProcess -> CreateProcess
#if defined(MIN_VERSION_process) #if defined(MIN_VERSION_process)
#if MIN_VERSION_process(1,6,8)
enableProcessJobs opts = opts { use_process_jobs = True } enableProcessJobs opts = opts { use_process_jobs = True }
#else #else
enableProcessJobs opts = opts enableProcessJobs opts = opts
#endif #endif
#else
enableProcessJobs opts = opts
#endif
-- Similar to System.Process.readCreateProcessWithExitCode, but stderr is -- Similar to System.Process.readCreateProcessWithExitCode, but stderr is
-- inherited from the parent process, and output to stderr is not captured. -- inherited from the parent process, and output to stderr is not captured.
......
...@@ -124,7 +124,6 @@ import PrelNames ( isUnboundName ) ...@@ -124,7 +124,6 @@ import PrelNames ( isUnboundName )
import GHC.Types.CostCentre.State import GHC.Types.CostCentre.State
import Control.Monad (ap) import Control.Monad (ap)
import qualified Control.Monad.Fail as MonadFail
import Data.Set ( Set ) import Data.Set ( Set )
import qualified Data.Set as S import qualified Data.Set as S
...@@ -1653,14 +1652,11 @@ instance Applicative TcPluginM where ...@@ -1653,14 +1652,11 @@ instance Applicative TcPluginM where
(<*>) = ap (<*>) = ap
instance Monad TcPluginM where instance Monad TcPluginM where
#if !MIN_VERSION_base(4,13,0)
fail = MonadFail.fail
#endif
TcPluginM m >>= k = TcPluginM m >>= k =
TcPluginM (\ ev -> do a <- m ev TcPluginM (\ ev -> do a <- m ev
runTcPluginM (k a) ev) runTcPluginM (k a) ev)
instance MonadFail.MonadFail TcPluginM where instance MonadFail TcPluginM where
fail x = TcPluginM (const $ fail x) fail x = TcPluginM (const $ fail x)
runTcPluginM :: TcPluginM a -> EvBindsVar -> TcM a runTcPluginM :: TcPluginM a -> EvBindsVar -> TcM a
......
...@@ -177,7 +177,6 @@ import Maybes ...@@ -177,7 +177,6 @@ import Maybes
import GHC.Core.Map import GHC.Core.Map
import Control.Monad import Control.Monad
import qualified Control.Monad.Fail as MonadFail
import MonadUtils import MonadUtils
import Data.IORef import Data.IORef
import Data.List ( partition, mapAccumL ) import Data.List ( partition, mapAccumL )
...@@ -2699,12 +2698,9 @@ instance Applicative TcS where ...@@ -2699,12 +2698,9 @@ instance Applicative TcS where
(<*>) = ap (<*>) = ap
instance Monad TcS where 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) 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) fail err = TcS (\_ -> fail err)
instance MonadUnique TcS where instance MonadUnique TcS where
......
...@@ -829,12 +829,10 @@ instance Binary RuntimeRep where ...@@ -829,12 +829,10 @@ instance Binary RuntimeRep where
put_ bh AddrRep = putByte bh 9 put_ bh AddrRep = putByte bh 9
put_ bh FloatRep = putByte bh 10 put_ bh FloatRep = putByte bh 10
put_ bh DoubleRep = putByte bh 11 put_ bh DoubleRep = putByte bh 11
#if __GLASGOW_HASKELL__ >= 807
put_ bh Int8Rep = putByte bh 12 put_ bh Int8Rep = putByte bh 12
put_ bh Word8Rep = putByte bh 13 put_ bh Word8Rep = putByte bh 13
put_ bh Int16Rep = putByte bh 14 put_ bh Int16Rep = putByte bh 14
put_ bh Word16Rep = putByte bh 15 put_ bh Word16Rep = putByte bh 15
#endif
#if __GLASGOW_HASKELL__ >= 809 #if __GLASGOW_HASKELL__ >= 809
put_ bh Int32Rep = putByte bh 16 put_ bh Int32Rep = putByte bh 16
put_ bh Word32Rep = putByte bh 17 put_ bh Word32Rep = putByte bh 17
...@@ -855,12 +853,10 @@ instance Binary RuntimeRep where ...@@ -855,12 +853,10 @@ instance Binary RuntimeRep where
9 -> pure AddrRep 9 -> pure AddrRep
10 -> pure FloatRep 10 -> pure FloatRep
11 -> pure DoubleRep 11 -> pure DoubleRep
#if __GLASGOW_HASKELL__ >= 807
12 -> pure Int8Rep 12 -> pure Int8Rep
13 -> pure Word8Rep 13 -> pure Word8Rep
14 -> pure Int16Rep 14 -> pure Int16Rep
15 -> pure Word16Rep 15 -> pure Word16Rep
#endif
#if __GLASGOW_HASKELL__ >= 809 #if __GLASGOW_HASKELL__ >= 809
16 -> pure Int32Rep 16 -> pure Int32Rep
17 -> pure Word32Rep 17 -> pure Word32Rep
......
...@@ -43,7 +43,6 @@ import Data.IORef ( IORef, newIORef, readIORef, writeIORef, modifyIORef, ...@@ -43,7 +43,6 @@ import Data.IORef ( IORef, newIORef, readIORef, writeIORef, modifyIORef,
import System.IO.Unsafe ( unsafeInterleaveIO ) import System.IO.Unsafe ( unsafeInterleaveIO )
import System.IO ( fixIO ) import System.IO ( fixIO )
import Control.Monad import Control.Monad
import qualified Control.Monad.Fail as MonadFail
import MonadUtils import MonadUtils
import Control.Applicative (Alternative(..)) import Control.Applicative (Alternative(..))
...@@ -60,11 +59,8 @@ unIOEnv (IOEnv m) = m ...@@ -60,11 +59,8 @@ unIOEnv (IOEnv m) = m
instance Monad (IOEnv m) where instance Monad (IOEnv m) where
(>>=) = thenM (>>=) = 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 fail _ = failM -- Ignore the string
instance Applicative (IOEnv m) where instance Applicative (IOEnv m) where
......
...@@ -158,8 +158,8 @@ if test "$WithGhc" = "" ...@@ -158,8 +158,8 @@ if test "$WithGhc" = ""
then then
AC_MSG_ERROR([GHC is required.]) AC_MSG_ERROR([GHC is required.])
fi fi
FP_COMPARE_VERSIONS([$GhcVersion],[-lt],[8.6], FP_COMPARE_VERSIONS([$GhcVersion],[-lt],[8.8],
[AC_MSG_ERROR([GHC version 8.6 or later is required to compile GHC.])]) [AC_MSG_ERROR([GHC version 8.8 or later is required to compile GHC.])])
if test `expr $GhcMinVersion % 2` = "1" if test `expr $GhcMinVersion % 2` = "1"
then then
......
...@@ -40,7 +40,6 @@ import Data.Char ...@@ -40,7 +40,6 @@ import Data.Char
import Data.Dynamic (Dynamic, fromDynamic, toDyn) import Data.Dynamic (Dynamic, fromDynamic, toDyn)
import Data.Functor import Data.Functor
import Data.HashMap.Strict (HashMap) import Data.HashMap.Strict (HashMap)
import Data.List (isPrefixOf)
import Data.List.Extra import Data.List.Extra
import Data.Maybe import Data.Maybe
import Data.Typeable (TypeRep, typeOf) import Data.Typeable (TypeRep, typeOf)
......
module Settings.Builders.Cabal (cabalBuilderArgs) where module Settings.Builders.Cabal (cabalBuilderArgs) where
import Hadrian.Builder (getBuilderPath, needBuilder)
import Hadrian.Haskell.Cabal import Hadrian.Haskell.Cabal
import Builder import Builder
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
module Settings.Builders.Ghc (ghcBuilderArgs, haddockGhcArgs) where module Settings.Builders.Ghc (ghcBuilderArgs, haddockGhcArgs) where
import Data.List.Extra (splitOn)
import Hadrian.Haskell.Cabal import Hadrian.Haskell.Cabal
import Hadrian.Haskell.Cabal.Type import Hadrian.Haskell.Cabal.Type
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
-- Module : Control.Monad.ST.Lazy.Imp -- Module : Control.Monad.ST.Lazy.Imp
-- Copyright : (c) The University of Glasgow 2001 -- Copyright : (c) The University of Glasgow 2001
-- License : BSD-style (see the file libraries/base/LICENSE) -- License : BSD-style (see the file libraries/base/LICENSE)
-- --
-- Maintainer : libraries@haskell.org -- Maintainer : libraries@haskell.org
-- Stability : provisional -- Stability : provisional
-- Portability : non-portable (requires universal quantification for runST) -- Portability : non-portable (requires universal quantification for runST)
...@@ -44,7 +44,6 @@ import qualified Control.Monad.ST.Unsafe as ST ...@@ -44,7 +44,6 @@ import qualified Control.Monad.ST.Unsafe as ST
import qualified GHC.ST as GHC.ST import qualified GHC.ST as GHC.ST
import GHC.Base import GHC.Base
import qualified Control.Monad.Fail as Fail
-- | The lazy @'ST' monad. -- | The lazy @'ST' monad.
-- The ST monad allows for destructive updates, but is escapable (unlike IO). -- The ST monad allows for destructive updates, but is escapable (unlike IO).
...@@ -192,7 +191,7 @@ instance Monad (ST s) where ...@@ -192,7 +191,7 @@ instance Monad (ST s) where
unST (k r) new_s unST (k r) new_s
-- | @since 4.10 -- | @since 4.10
instance Fail.MonadFail (ST s) where instance MonadFail (ST s) where
fail s = errorWithoutStackTrace s fail s = errorWithoutStackTrace s
-- | Return the value computed by an 'ST' computation. -- | Return the value computed by an 'ST' computation.
...@@ -205,8 +204,8 @@ runST (ST st) = runRW# (\s -> case st (S# s) of (r, _) -> r) ...@@ -205,8 +204,8 @@ runST (ST st) = runRW# (\s -> case st (S# s) of (r, _) -> r)
-- inside the computation. -- inside the computation.
-- Note that if @f@ is strict, @'fixST' f = _|_@. -- Note that if @f@ is strict, @'fixST' f = _|_@.
fixST :: (a -> ST s a) -> ST s a fixST :: (a -> ST s a) -> ST s a
fixST m = ST (\ s -> fixST m = ST (\ s ->
let let
q@(r,_s') = unST (m r) s q@(r,_s') = unST (m r) s
in q) in q)
-- Why don't we need unsafePerformIO in fixST? We create a thunk, q, -- Why don't we need unsafePerformIO in fixST? We create a thunk, q,
...@@ -233,7 +232,7 @@ strictToLazyST (GHC.ST.ST m) = ST $ \(S# s) -> ...@@ -233,7 +232,7 @@ strictToLazyST (GHC.ST.ST m) = ST $ \(S# s) ->
(# s', a #) -> (a, S# s') (# s', a #) -> (a, S# s')
-- See Note [Lazy ST: not producing lazy pairs] -- See Note [Lazy ST: not producing lazy pairs]
{-| {-|
Convert a lazy 'ST' computation into a strict one. Convert a lazy 'ST' computation into a strict one.
-} -}
lazyToStrictST :: ST s a -> ST.ST s a lazyToStrictST :: ST s a -> ST.ST s a
......
...@@ -26,7 +26,7 @@ module GHC.ST ( ...@@ -26,7 +26,7 @@ module GHC.ST (
import GHC.Base import GHC.Base
import GHC.Show import GHC.Show
import qualified Control.Monad.Fail as Fail import Control.Monad.Fail
default () default ()
...@@ -79,7 +79,7 @@ instance Monad (ST s) where ...@@ -79,7 +79,7 @@ instance Monad (ST s) where
(k2 new_s) }}) (k2 new_s) }})
-- | @since 4.11.0.0 -- | @since 4.11.0.0
instance Fail.MonadFail (ST s) where instance MonadFail (ST s) where
fail s = errorWithoutStackTrace s fail s = errorWithoutStackTrace s
-- | @since 4.11.0.0 -- | @since 4.11.0.0
......
...@@ -64,7 +64,7 @@ import qualified Text.ParserCombinators.ReadP as ReadP ...@@ -64,7 +64,7 @@ import qualified Text.ParserCombinators.ReadP as ReadP
import GHC.Num( Num(..) ) import GHC.Num( Num(..) )
import GHC.Base import GHC.Base
import qualified Control.Monad.Fail as MonadFail import Control.Monad.Fail
-- --------------------------------------------------------------------------- -- ---------------------------------------------------------------------------
-- The readPrec type -- The readPrec type
...@@ -88,8 +88,8 @@ instance Monad ReadPrec where ...@@ -88,8 +88,8 @@ instance Monad ReadPrec where
P f >>= k = P (\n -> do a <- f n; let P f' = k a in f' n) P f >>= k = P (\n -> do a <- f n; let P f' = k a in f' n)
-- | @since 4.9.0.0 -- | @since 4.9.0.0
instance MonadFail.MonadFail ReadPrec where instance MonadFail ReadPrec where
fail s = P (\_ -> MonadFail.fail s) fail s = P (\_ -> fail s)
-- | @since 2.01 -- | @since 2.01
instance MonadPlus ReadPrec instance MonadPlus ReadPrec
......
...@@ -97,7 +97,6 @@ import GHCi.RemoteTypes ...@@ -97,7 +97,6 @@ import GHCi.RemoteTypes
import GHC.Serialized import GHC.Serialized
import Control.Exception import Control.Exception
import qualified Control.Monad.Fail as Fail
import Control.Monad.IO.Class (MonadIO (..)) import Control.Monad.IO.Class (MonadIO (..))
import Data.Binary import Data.Binary
import Data.Binary.Put import Data.Binary.Put
...@@ -144,11 +143,8 @@ instance Monad GHCiQ where ...@@ -144,11 +143,8 @@ instance Monad GHCiQ where
do (m', s') <- runGHCiQ m s do (m', s') <- runGHCiQ m s
(a, s'') <- runGHCiQ (f m') s' (a, s'') <- runGHCiQ (f m') s'
return (a, s'') return (a, s'')
#if !MIN_VERSION_base(4,13,0)
fail = Fail.fail
#endif
instance Fail.MonadFail GHCiQ where instance MonadFail GHCiQ where
fail err = GHCiQ $ \s -> throwIO (GHCiQException s err) fail err = GHCiQ $ \s -> throwIO (GHCiQException s err)
getState :: GHCiQ QState getState :: GHCiQ QState
......
...@@ -52,15 +52,13 @@ import Numeric.Natural ...@@ -52,15 +52,13 @@ import Numeric.Natural
import Prelude import Prelude
import Foreign.ForeignPtr import Foreign.ForeignPtr
import qualified Control.Monad.Fail as Fail
----------------------------------------------------- -----------------------------------------------------
-- --
-- The Quasi class -- The Quasi class
-- --
----------------------------------------------------- -----------------------------------------------------
class (MonadIO m, Fail.MonadFail m) => Quasi m where class (MonadIO m, MonadFail m) => Quasi m where
qNewName :: String -> m Name qNewName :: String -> m Name
-- ^ Fresh names -- ^ Fresh names
...@@ -187,12 +185,9 @@ runQ (Q m) = m ...@@ -187,12 +185,9 @@ runQ (Q m) = m
instance Monad Q where instance Monad Q where
Q m >>= k = Q (m >>= \x -> unQ (k x)) Q m >>= k = Q (m >>= \x -> unQ (k x))
(>>) = (*>) (>>) = (*>)
#if !MIN_VERSION_base(4,13,0)
fail = Fail.fail
#endif
instance Fail.MonadFail Q where instance MonadFail Q where
fail s = report True s >> Q (Fail.fail "Q monad failure") fail s = report True s >> Q (fail "Q monad failure")
instance Functor Q where instance Functor Q where
fmap f (Q x) = Q (fmap f x) fmap f (Q x) = Q (fmap f x)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment