Several data-types like Either but with differing properties and type-class instances.
Library support is provided for those different representations, include
lens-related functions for converting between each and abstracting over their
Download from hackage.
AccValidationdata type is isomorphic to
Either, but has an instance of
Applicativethat accumulates on the error side. That is to say, if two (or more) errors are encountered, they are appended using a
As a consequence of this
Applicativeinstance, there is no corresponding
AccValidationis an example of, "An applicative functor that is not a monad."
Validationdata type is isomorphic to
Eitherand has a
Monadinstance that does the same as
Either. The only difference to
Eitheris the constructor names and surrounding library support.
ValidationTdata type is the monad transformer for
Validation. An instance of
MonadTransis provided for
(ValidationT err). Due to the arrangement of the
ValidationTtype constructor, which permits a
MonadTrans instance, there is no possibleBifunctor
instance. Consequently, theValidationB
data type provides aBifunctor
instance (but not aMonadTrans
instance). Library support is provided to exploit the isomorphism toValidationB`.
Note that since
AccValidationis not a monad, there is also no corresponding monad transformer for this data type.
ValidationBdata type is similar to the monad transformer for
ValidationT), however, due to the arrangement of the
ValidationBtype constructor, which permits a
Bifunctorinstance, there is no possible
MonadTransinstance. Consequently, the
ValidationTdata type provides a
MonadTransinstance (but not a
Bifunctorinstance). Library support is provided to exploit the isomorphism to