fail

Important note

This ignores whatever String you give it. It is a bad idea to use fail as a form of labelled error; instead, it should only be defaulted to when a pattern match fails.
Forward-compatible MonadFail class This package contains the Control.Monad.Fail module providing the MonadFail class that became available in base-4.9.0.0 for older base package versions. This package turns into an empty package when used with GHC versions which already provide the Control.Monad.Fail module to make way for GHC's own Control.Monad.Fail module.
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 MonadFail (see Control.Monad.Fail for more details). The definition here will be removed in a future release.
Fail with the provided error message.
Lift an IOError to the answer type, similar to fail. This fail function aims to be used as the last statement of a do block.
Constructs a validator that always fails with provided error e.

Example

>>> validateP ( fail "YOU SHALL NOT PASS!!!" ) 1
Right "YOU SHALL NOT PASS!!!"
Transitional module providing the MonadFail class and primitive instances. This module can be imported for defining forward compatible MonadFail instances:
import qualified Control.Monad.Fail as Fail

instance Monad Foo where
(>>=) = {- ...bind impl... -}

-- Provide legacy fail implementation for when
-- new-style MonadFail desugaring is not enabled.
fail = Fail.fail

instance Fail.MonadFail Foo where
fail = {- ...fail implementation... -}
See https://gitlab.haskell.org/haskell/prime/-/wikis/libraries/proposals/monad-fail for more details.
The decoder ran into an error. The decoder either used fail or was not provided enough input. Contains any unconsumed input and the number of bytes consumed.
The decoder ran into an error. The decoder either used fail or was not provided enough input.
The parse failed. The i parameter is the input that had not yet been consumed when the failure occurred. The [String] is a list of contexts in which the error occurred. The String is the message describing the error, if any.
The parse failed. The ByteString is the input that had not yet been consumed when the failure occurred. The [String] is a list of contexts in which the error occurred. The String is the message describing the error, if any.
The parse failed. The Text is the input that had not yet been consumed when the failure occurred. The [String] is a list of contexts in which the error occurred. The String is the message describing the error, if any.
The parse failed. The String is the message describing the error, if any.
Occurs when flattening a line. The layouter will reject this document, choosing a more suitable rendering.
Keep trying other paths. The ServantError should only be 404, 405 or 406.
Transitional module providing the MonadFail class and primitive instances. This module can be imported for defining forward compatible MonadFail instances:
import qualified Control.Monad.Fail as Fail

instance Monad Foo where
(>>=) = {- ...bind impl... -}

-- Provide legacy fail implementation for when
-- new-style MonadFail desugaring is not enabled.
fail = Fail.fail

instance Fail.MonadFail Foo where
fail = {- ...fail implementation... -}
See https://prime.haskell.org/wiki/Libraries/Proposals/MonadFail for more details.
The input data was malformed. The first field contains any unconsumed input and second field contains information about the parse error.
This effect abstracts the concept of MonadFail, which is a built-in mechanism that converts pattern matching errors to calls to the current monad's instance of that class. The instance defined in Polysemy.Internal uses this effect to catch those errors.