fail package:fused-effects

An effect providing failure with an error message. This effect is invoked through the fail method from MonadFail. Predefined carriers:
Run a Fail effect, returning failure messages in Left and successful computations’ results in Right.
runFail (pure a) = pure (Right a)
runFail (fail s) = pure (Left s)
Fail the current branch, and prevent backtracking within the nearest enclosing call (if any). Contrast with empty, which fails the current branch but allows backtracking.
cutfail >>= k = cutfail
cutfail <|> m = cutfail
When a value is bound in do-notation, the pattern on the left hand side of <- might not match. In this case, this class provides a function to recover. A Monad without a MonadFail instance may only be used in conjunction with pattern that always match, such as newtypes, tuples, data types with only a single data constructor, and irrefutable patterns (~pat). Instances of MonadFail should satisfy the following law: fail s should be a left zero for >>=,
fail s >>= f  =  fail s
If your Monad is also MonadPlus, a popular definition is
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.