diff options
author | Ryan Scott <ryan.gl.scott@gmail.com> | 2020-03-25 13:50:38 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-03-31 10:54:20 -0400 |
commit | 57b888c0e90be7189285a6b078c30b26d0923809 (patch) | |
tree | 2635fd3a7205c11b85392d3ef815e247ea7b17ec /libraries | |
parent | f024b6e385bd1448968b7bf20de05f655c815bae (diff) | |
download | haskell-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 'libraries')
-rw-r--r-- | libraries/base/Control/Monad/ST/Lazy/Imp.hs | 11 | ||||
-rw-r--r-- | libraries/base/GHC/ST.hs | 4 | ||||
-rw-r--r-- | libraries/base/Text/ParserCombinators/ReadPrec.hs | 6 | ||||
-rw-r--r-- | libraries/ghci/GHCi/TH.hs | 6 | ||||
-rw-r--r-- | libraries/template-haskell/Language/Haskell/TH/Syntax.hs | 11 |
5 files changed, 14 insertions, 24 deletions
diff --git a/libraries/base/Control/Monad/ST/Lazy/Imp.hs b/libraries/base/Control/Monad/ST/Lazy/Imp.hs index 5bb1a06caf..625bcb0fe3 100644 --- a/libraries/base/Control/Monad/ST/Lazy/Imp.hs +++ b/libraries/base/Control/Monad/ST/Lazy/Imp.hs @@ -8,7 +8,7 @@ -- Module : Control.Monad.ST.Lazy.Imp -- Copyright : (c) The University of Glasgow 2001 -- License : BSD-style (see the file libraries/base/LICENSE) --- +-- -- Maintainer : libraries@haskell.org -- Stability : provisional -- Portability : non-portable (requires universal quantification for runST) @@ -44,7 +44,6 @@ import qualified Control.Monad.ST.Unsafe as ST import qualified GHC.ST as GHC.ST import GHC.Base -import qualified Control.Monad.Fail as Fail -- | The lazy @'ST' monad. -- The ST monad allows for destructive updates, but is escapable (unlike IO). @@ -192,7 +191,7 @@ instance Monad (ST s) where unST (k r) new_s -- | @since 4.10 -instance Fail.MonadFail (ST s) where +instance MonadFail (ST s) where fail s = errorWithoutStackTrace s -- | Return the value computed by an 'ST' computation. @@ -205,8 +204,8 @@ runST (ST st) = runRW# (\s -> case st (S# s) of (r, _) -> r) -- inside the computation. -- Note that if @f@ is strict, @'fixST' f = _|_@. fixST :: (a -> ST s a) -> ST s a -fixST m = ST (\ s -> - let +fixST m = ST (\ s -> + let q@(r,_s') = unST (m r) s in 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) -> (# s', a #) -> (a, S# s') -- See Note [Lazy ST: not producing lazy pairs] -{-| +{-| Convert a lazy 'ST' computation into a strict one. -} lazyToStrictST :: ST s a -> ST.ST s a diff --git a/libraries/base/GHC/ST.hs b/libraries/base/GHC/ST.hs index e9061b7433..98ba18b3d8 100644 --- a/libraries/base/GHC/ST.hs +++ b/libraries/base/GHC/ST.hs @@ -26,7 +26,7 @@ module GHC.ST ( import GHC.Base import GHC.Show -import qualified Control.Monad.Fail as Fail +import Control.Monad.Fail default () @@ -79,7 +79,7 @@ instance Monad (ST s) where (k2 new_s) }}) -- | @since 4.11.0.0 -instance Fail.MonadFail (ST s) where +instance MonadFail (ST s) where fail s = errorWithoutStackTrace s -- | @since 4.11.0.0 diff --git a/libraries/base/Text/ParserCombinators/ReadPrec.hs b/libraries/base/Text/ParserCombinators/ReadPrec.hs index df7704549a..bf4dad91f3 100644 --- a/libraries/base/Text/ParserCombinators/ReadPrec.hs +++ b/libraries/base/Text/ParserCombinators/ReadPrec.hs @@ -64,7 +64,7 @@ import qualified Text.ParserCombinators.ReadP as ReadP import GHC.Num( Num(..) ) import GHC.Base -import qualified Control.Monad.Fail as MonadFail +import Control.Monad.Fail -- --------------------------------------------------------------------------- -- The readPrec type @@ -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) -- | @since 4.9.0.0 -instance MonadFail.MonadFail ReadPrec where - fail s = P (\_ -> MonadFail.fail s) +instance MonadFail ReadPrec where + fail s = P (\_ -> fail s) -- | @since 2.01 instance MonadPlus ReadPrec diff --git a/libraries/ghci/GHCi/TH.hs b/libraries/ghci/GHCi/TH.hs index 927376b53d..5351b90ef1 100644 --- a/libraries/ghci/GHCi/TH.hs +++ b/libraries/ghci/GHCi/TH.hs @@ -97,7 +97,6 @@ import GHCi.RemoteTypes import GHC.Serialized import Control.Exception -import qualified Control.Monad.Fail as Fail import Control.Monad.IO.Class (MonadIO (..)) import Data.Binary import Data.Binary.Put @@ -144,11 +143,8 @@ instance Monad GHCiQ where do (m', s') <- runGHCiQ m s (a, s'') <- runGHCiQ (f m') 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) getState :: GHCiQ QState diff --git a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs index f81c92f38d..8054f599ea 100644 --- a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs +++ b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs @@ -52,15 +52,13 @@ import Numeric.Natural import Prelude import Foreign.ForeignPtr -import qualified Control.Monad.Fail as Fail - ----------------------------------------------------- -- -- The Quasi class -- ----------------------------------------------------- -class (MonadIO m, Fail.MonadFail m) => Quasi m where +class (MonadIO m, MonadFail m) => Quasi m where qNewName :: String -> m Name -- ^ Fresh names @@ -187,12 +185,9 @@ runQ (Q m) = m instance Monad Q where 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 - fail s = report True s >> Q (Fail.fail "Q monad failure") +instance MonadFail Q where + fail s = report True s >> Q (fail "Q monad failure") instance Functor Q where fmap f (Q x) = Q (fmap f x) |