Copyright | (C) CSIRO 2017-2018 |
---|---|
License | BSD3 |
Maintainer | Isaac Elliott <isaace71295@gmail.com> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- newtype ValidateM e m a = ValidateM {
- unValidateM :: Compose m (Validation e) a
- runValidateM :: ValidateM e m a -> m (Validation e a)
- bindVM :: Monad m => m a -> (a -> ValidateM e m b) -> ValidateM e m b
- liftVM0 :: (Functor m, Semigroup e) => m a -> ValidateM e m a
- liftVM1 :: (forall x. m x -> m x) -> ValidateM e m a -> ValidateM e m a
- errorVM :: Applicative m => e -> ValidateM e m a
- errorVM1 :: (Applicative f, Applicative m) => e -> ValidateM (f e) m a
Documentation
newtype ValidateM e m a Source #
The composition of Validation
with another Applicative
functor.
Validation
is not a Monad
, and ValidateM
is not a monad transformer.
It is equipped with a useful bind function, but that function does not have
the right type to make ValidateM
a Monad
(besides which it would break
the laws)
ValidateM | |
|
Instances
Functor m => Functor (ValidateM e m) Source # | |
(Applicative m, Semigroup e) => Applicative (ValidateM e m) Source # | |
Defined in Data.Validate.Monadic pure :: a -> ValidateM e m a # (<*>) :: ValidateM e m (a -> b) -> ValidateM e m a -> ValidateM e m b # liftA2 :: (a -> b -> c) -> ValidateM e m a -> ValidateM e m b -> ValidateM e m c # (*>) :: ValidateM e m a -> ValidateM e m b -> ValidateM e m b # (<*) :: ValidateM e m a -> ValidateM e m b -> ValidateM e m a # |
runValidateM :: ValidateM e m a -> m (Validation e a) Source #
Unwrap a ValidateM
bindVM :: Monad m => m a -> (a -> ValidateM e m b) -> ValidateM e m b Source #
Bind into a ValidateM
. Note that the first parameter is m a
, not ValidateM e m a
.
liftVM0 :: (Functor m, Semigroup e) => m a -> ValidateM e m a Source #
Lift into a succeeding validation
liftVM1 :: (forall x. m x -> m x) -> ValidateM e m a -> ValidateM e m a Source #
Run a natural transformation across ValidateM
to alter m
errorVM1 :: (Applicative f, Applicative m) => e -> ValidateM (f e) m a Source #
Lift an error in an Applicative
into ValidateM
. This is especially
useful if you're using list or NonEmpty
to collect errors.