summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ellis <tom-git@jaguarpaw.co.uk>2022-04-17 10:49:36 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-05-05 12:48:09 -0400
commit7da90ae34bda878f201da040799498ca873b356b (patch)
tree7e813db5643a84af3ca1d0b07fd27712fc4b2e11
parentf050557eba193f92d818de7c9fc261af595173d0 (diff)
downloadhaskell-7da90ae34bda878f201da040799498ca873b356b.tar.gz
Explain that 'fail s' should run in the monad itself
-rw-r--r--libraries/base/Control/Monad/Fail.hs4
1 files changed, 4 insertions, 0 deletions
diff --git a/libraries/base/Control/Monad/Fail.hs b/libraries/base/Control/Monad/Fail.hs
index 3d7da77134..fcc6d1920b 100644
--- a/libraries/base/Control/Monad/Fail.hs
+++ b/libraries/base/Control/Monad/Fail.hs
@@ -61,6 +61,10 @@ import GHC.Base (String, Monad(), Maybe(Nothing), IO(), failIO)
-- fail _ = mzero
-- @
--
+-- @fail s@ should be an action that runs in the monad itself, not an
+-- exception (except in instances of @MonadIO@). In particular,
+-- @fail@ should not be implemented in terms of @error@.
+--
-- @since 4.9.0.0
class Monad m => MonadFail m where
fail :: String -> m a