summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libraries/base/Control/Monad.hs4
-rw-r--r--libraries/base/Control/Monad/ST/Lazy/Imp.hs3
-rw-r--r--libraries/base/GHC/Base.hs16
-rw-r--r--libraries/base/GHC/Conc/Sync.hs2
-rw-r--r--libraries/base/GHC/TopHandler.hs2
-rw-r--r--libraries/base/Prelude.hs3
-rw-r--r--libraries/base/System/IO.hs2
-rw-r--r--libraries/base/Text/ParserCombinators/ReadP.hs3
-rw-r--r--libraries/base/Text/ParserCombinators/ReadPrec.hs1
-rw-r--r--libraries/base/base.cabal4
10 files changed, 10 insertions, 30 deletions
diff --git a/libraries/base/Control/Monad.hs b/libraries/base/Control/Monad.hs
index fbdb99e5f4..a0d428482d 100644
--- a/libraries/base/Control/Monad.hs
+++ b/libraries/base/Control/Monad.hs
@@ -19,7 +19,8 @@ module Control.Monad
-- * Functor and monad classes
Functor(fmap)
- , Monad((>>=), (>>), return, fail)
+ , Monad((>>=), (>>), return)
+ , MonadFail(fail)
, MonadPlus(mzero, mplus)
-- * Functions
@@ -75,6 +76,7 @@ module Control.Monad
, (<$!>)
) where
+import Control.Monad.Fail ( MonadFail(fail) )
import Data.Foldable ( Foldable, sequence_, sequenceA_, msum, mapM_, foldlM, forM_ )
import Data.Functor ( void, (<$>) )
import Data.Traversable ( forM, mapM, traverse, sequence, sequenceA )
diff --git a/libraries/base/Control/Monad/ST/Lazy/Imp.hs b/libraries/base/Control/Monad/ST/Lazy/Imp.hs
index f8d35b9953..5bb1a06caf 100644
--- a/libraries/base/Control/Monad/ST/Lazy/Imp.hs
+++ b/libraries/base/Control/Monad/ST/Lazy/Imp.hs
@@ -180,9 +180,6 @@ instance Applicative (ST s) where
-- | @since 2.01
instance Monad (ST s) where
-
- fail s = errorWithoutStackTrace s
-
(>>) = (*>)
m >>= k = ST $ \ s ->
diff --git a/libraries/base/GHC/Base.hs b/libraries/base/GHC/Base.hs
index 6b606d32ed..60a485c9bd 100644
--- a/libraries/base/GHC/Base.hs
+++ b/libraries/base/GHC/Base.hs
@@ -664,17 +664,6 @@ class Applicative m => Monad m where
return :: a -> m a
return = pure
- -- | Fail with a message. This operation is not part of the
- -- mathematical definition of a monad, but is invoked on pattern-match
- -- failure in a @do@ expression.
- --
- -- As part of the MonadFail proposal (MFP), this function is moved
- -- to its own class 'Control.Monad.MonadFail' (see "Control.Monad.Fail" for
- -- more details). The definition here will be removed in a future
- -- release.
- fail :: String -> m a
- fail s = errorWithoutStackTrace s
-
{- Note [Recursive bindings for Applicative/Monad]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -855,8 +844,6 @@ instance Monad Maybe where
(>>) = (*>)
- fail _ = Nothing
-
-- -----------------------------------------------------------------------------
-- The Alternative class definition
@@ -984,8 +971,6 @@ instance Monad [] where
xs >>= f = [y | x <- xs, y <- f x]
{-# INLINE (>>) #-}
(>>) = (*>)
- {-# INLINE fail #-}
- fail _ = []
-- | @since 2.01
instance Alternative [] where
@@ -1365,7 +1350,6 @@ instance Monad IO where
{-# INLINE (>>=) #-}
(>>) = (*>)
(>>=) = bindIO
- fail s = failIO s
-- | @since 4.9.0.0
instance Alternative IO where
diff --git a/libraries/base/GHC/Conc/Sync.hs b/libraries/base/GHC/Conc/Sync.hs
index 7038b0db04..5c3e63a8e3 100644
--- a/libraries/base/GHC/Conc/Sync.hs
+++ b/libraries/base/GHC/Conc/Sync.hs
@@ -367,7 +367,7 @@ to avoid contention with other processes in the machine.
-}
setNumCapabilities :: Int -> IO ()
setNumCapabilities i
- | i <= 0 = fail $ "setNumCapabilities: Capability count ("++show i++") must be positive"
+ | i <= 0 = failIO $ "setNumCapabilities: Capability count ("++show i++") must be positive"
| otherwise = c_setNumCapabilities (fromIntegral i)
foreign import ccall safe "setNumCapabilities"
diff --git a/libraries/base/GHC/TopHandler.hs b/libraries/base/GHC/TopHandler.hs
index d98836988a..bb358a337f 100644
--- a/libraries/base/GHC/TopHandler.hs
+++ b/libraries/base/GHC/TopHandler.hs
@@ -241,7 +241,7 @@ safeExit = exitHelper useSafeExit
fastExit = exitHelper useFastExit
unreachable :: IO a
-unreachable = fail "If you can read this, shutdownHaskellAndExit did not exit."
+unreachable = failIO "If you can read this, shutdownHaskellAndExit did not exit."
exitHelper :: CInt -> Int -> IO a
#if defined(mingw32_HOST_OS)
diff --git a/libraries/base/Prelude.hs b/libraries/base/Prelude.hs
index 15e392f271..f7b2fd9c2e 100644
--- a/libraries/base/Prelude.hs
+++ b/libraries/base/Prelude.hs
@@ -73,7 +73,8 @@ module Prelude (
-- ** Monads and functors
Functor(fmap, (<$)), (<$>),
Applicative(pure, (<*>), (*>), (<*)),
- Monad((>>=), (>>), return, fail),
+ Monad((>>=), (>>), return),
+ MonadFail(fail),
mapM_, sequence_, (=<<),
-- ** Folds and traversals
diff --git a/libraries/base/System/IO.hs b/libraries/base/System/IO.hs
index 1fc39bed25..08416ff42f 100644
--- a/libraries/base/System/IO.hs
+++ b/libraries/base/System/IO.hs
@@ -485,7 +485,7 @@ openTempFile' :: String -> FilePath -> String -> Bool -> CMode
-> IO (FilePath, Handle)
openTempFile' loc tmp_dir template binary mode
| pathSeparator template
- = fail $ "openTempFile': Template string must not contain path separator characters: "++template
+ = failIO $ "openTempFile': Template string must not contain path separator characters: "++template
| otherwise = findTempName
where
-- We split off the last extension, so we can use .foo.ext files
diff --git a/libraries/base/Text/ParserCombinators/ReadP.hs b/libraries/base/Text/ParserCombinators/ReadP.hs
index e28f32d53a..e6dcab55e0 100644
--- a/libraries/base/Text/ParserCombinators/ReadP.hs
+++ b/libraries/base/Text/ParserCombinators/ReadP.hs
@@ -120,8 +120,6 @@ instance Monad P where
(Result x p) >>= k = k x <|> (p >>= k)
(Final (r:|rs)) >>= k = final [ys' | (x,s) <- (r:rs), ys' <- run (k x) s]
- fail _ = Fail
-
-- | @since 4.9.0.0
instance MonadFail P where
fail _ = Fail
@@ -177,7 +175,6 @@ instance Applicative ReadP where
-- | @since 2.01
instance Monad ReadP where
- fail _ = R (\_ -> Fail)
R m >>= f = R (\k -> m (\a -> let R m' = f a in m' k))
-- | @since 4.9.0.0
diff --git a/libraries/base/Text/ParserCombinators/ReadPrec.hs b/libraries/base/Text/ParserCombinators/ReadPrec.hs
index 2b30fe08ac..df7704549a 100644
--- a/libraries/base/Text/ParserCombinators/ReadPrec.hs
+++ b/libraries/base/Text/ParserCombinators/ReadPrec.hs
@@ -85,7 +85,6 @@ instance Applicative ReadPrec where
-- | @since 2.01
instance Monad ReadPrec where
- fail s = P (\_ -> fail s)
P f >>= k = P (\n -> do a <- f n; let P f' = k a in f' n)
-- | @since 4.9.0.0
diff --git a/libraries/base/base.cabal b/libraries/base/base.cabal
index 4e809e70c7..a2c91641f4 100644
--- a/libraries/base/base.cabal
+++ b/libraries/base/base.cabal
@@ -1,6 +1,6 @@
-cabal-version: 2.1
+cabal-version: 2.2
name: base
-version: 4.12.0.0
+version: 4.13.0.0
-- NOTE: Don't forget to update ./changelog.md
license: BSD-3-Clause