| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Control.Monad.Validate.Class
Synopsis
- class (Monad m, Semigroup e) => MonadValidate e m | m -> e where
Documentation
class (Monad m, Semigroup e) => MonadValidate e m | m -> e where Source #
The class of validation monads, intended to be used to validate data structures while collecting
errors along the way. In a sense, MonadValidate is like a combination of
MonadError and MonadWriter, but it isn’t
entirely like either. The two essential differences are:
- Unlike
throwError, raising an error usingrefutedoes not always abort the entire computation—it may only abort a local part of it. - Unlike
tell, raising an error usingdisputestill causes the computation to globally fail, it just doesn’t affect local execution.
For a more thorough explanation, with examples, see the documentation for
ValidateT.
Minimal complete definition
Nothing
Methods
Raises a fatal validation error. Aborts the current branch of the validation (i.e. does not return).
Raises a non-fatal validation error. The overall validation fails, and the error is recorded, but validation continues in an attempt to try and discover more errors.
refute :: (MonadTrans t, MonadValidate e m', m ~ t m') => e -> m a Source #
Raises a fatal validation error. Aborts the current branch of the validation (i.e. does not return).
dispute :: (MonadTrans t, MonadValidate e m', m ~ t m') => e -> m () Source #
Raises a non-fatal validation error. The overall validation fails, and the error is recorded, but validation continues in an attempt to try and discover more errors.
Instances
| MonadValidate e m => MonadValidate e (MaybeT m) Source # | |
| (MonadValidate e m, Monoid w) => MonadValidate e (WriterT w m) Source # | |
| (MonadValidate e m, Monoid w) => MonadValidate e (WriterT w m) Source # | |
| MonadValidate e m => MonadValidate e (WriterT w m) Source # | |
| MonadValidate e m => MonadValidate e (StateT s m) Source # | |
| MonadValidate e m => MonadValidate e (StateT s m) Source # | |
| MonadValidate e m => MonadValidate e (ReaderT r m) Source # | |
| MonadValidate e m => MonadValidate e (IdentityT m) Source # | |
| MonadValidate e m => MonadValidate e (ExceptT a m) Source # | |
| (Monad m, Semigroup e) => MonadValidate e (ValidateT e m) Source # | |
| MonadValidate e m => MonadValidate e (ContT r m) Source # | |
| (MonadValidate e m, Monoid w) => MonadValidate e (RWST r w s m) Source # | |
| (MonadValidate e m, Monoid w) => MonadValidate e (RWST r w s m) Source # | |
| MonadValidate e m => MonadValidate e (RWST r w s m) Source # | |