From 7da90ae34bda878f201da040799498ca873b356b Mon Sep 17 00:00:00 2001 From: Tom Ellis Date: Sun, 17 Apr 2022 10:49:36 +0100 Subject: Explain that 'fail s' should run in the monad itself --- libraries/base/Control/Monad/Fail.hs | 4 ++++ 1 file changed, 4 insertions(+) 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 -- cgit v1.2.1