Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Compatibility layer for Control.Monad.Fail
Documentation
class Monad m => MonadFail (m :: Type -> Type) where Source #
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
Since: base-4.9.0.0
Instances
MonadFail ParsecParser Source # | |
Defined in Distribution.Parsec fail :: String -> ParsecParser a Source # | |
MonadFail P | Since: base-4.9.0.0 |
Defined in Text.ParserCombinators.ReadP | |
MonadFail ReadP | Since: base-4.9.0.0 |
MonadFail ReadPrec | Since: base-4.9.0.0 |
MonadFail Get | |
MonadFail IO | Since: base-4.9.0.0 |
MonadFail Q | |
Defined in Language.Haskell.TH.Syntax | |
MonadFail Maybe | Since: base-4.9.0.0 |
MonadFail [] | Since: base-4.9.0.0 |
Defined in Control.Monad.Fail | |
MonadFail f => MonadFail (Ap f) | Since: base-4.12.0.0 |
(Monad m, Error e) => MonadFail (ErrorT e m) | |
MonadFail m => MonadFail (IdentityT m) | |
MonadFail m => MonadFail (ReaderT r m) | |
MonadFail m => MonadFail (StateT s m) | |
MonadFail m => MonadFail (StateT s m) | |
(Monoid w, MonadFail m) => MonadFail (WriterT w m) | |
(Monoid w, MonadFail m) => MonadFail (WriterT w m) | |
MonadFail (ParsecT s u m) | Since: parsec-3.1.12.0 |
(Monoid w, MonadFail m) => MonadFail (RWST r w s m) | |
(Monoid w, MonadFail m) => MonadFail (RWST r w s m) | |