summaryrefslogtreecommitdiff
path: root/libraries
diff options
context:
space:
mode:
authorArtem Pelenitsyn <a.pelenitsyn@gmail.com>2022-01-23 22:59:08 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-03-05 01:06:47 -0500
commit6f84ee332fd243e83004bdbc92a6970e96ab3189 (patch)
treea79a465d0116805da7e5b10c4d72534cd66705e9 /libraries
parent3570eda512d157a38da391b6f1d57dfbab72dd09 (diff)
downloadhaskell-6f84ee332fd243e83004bdbc92a6970e96ab3189.tar.gz
remove MonadFail instances of ST
CLC proposal: https://github.com/haskell/core-libraries-committee/issues/33 The instances had `fail` implemented in terms of `error`, whereas the idea of the `MonadFail` class is that the `fail` method should be implemented in terms of the monad itself.
Diffstat (limited to 'libraries')
-rw-r--r--libraries/base/Control/Monad/ST/Lazy/Imp.hs4
-rw-r--r--libraries/base/GHC/ST.hs5
-rw-r--r--libraries/base/changelog.md5
3 files changed, 5 insertions, 9 deletions
diff --git a/libraries/base/Control/Monad/ST/Lazy/Imp.hs b/libraries/base/Control/Monad/ST/Lazy/Imp.hs
index 888839132e..e67daf9dd1 100644
--- a/libraries/base/Control/Monad/ST/Lazy/Imp.hs
+++ b/libraries/base/Control/Monad/ST/Lazy/Imp.hs
@@ -190,10 +190,6 @@ instance Monad (ST s) where
in
unST (k r) new_s
--- | @since 4.10
-instance MonadFail (ST s) where
- fail s = errorWithoutStackTrace s
-
-- | Return the value computed by an 'ST' computation.
-- The @forall@ ensures that the internal state used by the 'ST'
-- computation is inaccessible to the rest of the program.
diff --git a/libraries/base/GHC/ST.hs b/libraries/base/GHC/ST.hs
index 98ba18b3d8..27749e83bb 100644
--- a/libraries/base/GHC/ST.hs
+++ b/libraries/base/GHC/ST.hs
@@ -26,7 +26,6 @@ module GHC.ST (
import GHC.Base
import GHC.Show
-import Control.Monad.Fail
default ()
@@ -79,10 +78,6 @@ instance Monad (ST s) where
(k2 new_s) }})
-- | @since 4.11.0.0
-instance MonadFail (ST s) where
- fail s = errorWithoutStackTrace s
-
--- | @since 4.11.0.0
instance Semigroup a => Semigroup (ST s a) where
(<>) = liftA2 (<>)
diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md
index a905e2d2f3..ed12f00737 100644
--- a/libraries/base/changelog.md
+++ b/libraries/base/changelog.md
@@ -43,6 +43,11 @@
CPtrdiff, CSize, CWchar, CSigAtomic, CLLong, CULLong, CBool, CIntPtr, CUIntPtr,
CIntMax, CUIntMax.
+ * Remove instances of `MonadFail` for the `ST` monad (lazy and strict) as per
+ the [Core Libraries proposal](https://github.com/haskell/core-libraries-committee/issues/33).
+ A [migration guide](https://github.com/haskell/core-libraries-committee/blob/main/guides/no-monadfail-st-inst.md)
+ is available.
+
## 4.16.0.0 *Nov 2021*