-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A data-type like Either but with an accumulating Applicative -- -- -- A data-type like Either but with differing properties and type-class -- instances. -- -- Library support is provided for this different representation, include -- lens-related functions for converting between each and -- abstracting over their similarities. -- --
-- validate :: e -> (a -> Bool) -> a -> AccValidation e a --validate :: Validate v => e -> (a -> Bool) -> a -> v e a -- | validationNel is liftError specialised to -- NonEmpty lists, since they are a common semigroup to use. validationNel :: Either e a -> AccValidation (NonEmpty e) a -- | Converts from Either to AccValidation. fromEither :: Either e a -> AccValidation e a -- | liftError is useful for converting an Either to an -- AccValidation when the Left of the Either needs -- to be lifted into a Semigroup. liftError :: (b -> e) -> Either b a -> AccValidation e a -- | validation is the catamorphism for AccValidation. validation :: (e -> c) -> (a -> c) -> AccValidation e a -> c -- | Converts from AccValidation to Either. toEither :: AccValidation e a -> Either e a -- | v orElse a returns a when v is -- AccFailure, and the a in AccSuccess a. -- -- This can be thought of as having the less general type: -- --
-- orElse :: AccValidation e a -> a -> a --orElse :: Validate v => v e a -> a -> a -- | Return the a or run the given function over the e. -- -- This can be thought of as having the less general type: -- --
-- valueOr :: (e -> a) -> AccValidation e a -> a --valueOr :: Validate v => (e -> a) -> v e a -> a -- | ensure leaves the validation unchanged when the predicate -- holds, or fails with e otherwise. -- -- This can be thought of as having the less general type: -- --
-- ensure :: e -> (a -> Bool) -> AccValidation e a -> AccValidation e a --ensure :: Validate v => e -> (a -> Bool) -> v e a -> v e a -- | codiagonal gets the value out of either side. codiagonal :: AccValidation a a -> a -- | This prism generalises _Left. It targets the failure case of -- either Either or AccValidation. _Failure :: Validate f => Prism (f e1 a) (f e2 a) e1 e2 -- | This prism generalises _Right. It targets the success case of -- either Either or AccValidation. _Success :: Validate f => Prism (f e a) (f e b) a b -- | The Validate class carries around witnesses that the type -- f is isomorphic to AccValidation, and hence isomorphic to -- Either. class Validate f where _Either = _EitherV _AccValidation :: Validate f => Iso (f e a) (f g b) (AccValidation e a) (AccValidation g b) _Either :: Validate f => Iso (f e a) (f g b) (Either e a) (Either g b) -- | revalidate converts between any two instances of -- Validate. revalidate :: (Validate f, Validate g) => Iso (f e1 s) (f e2 t) (g e1 s) (g e2 t) instance (Data.Data.Data a, Data.Data.Data err) => Data.Data.Data (Data.Validation.AccValidation err a) instance (GHC.Show.Show a, GHC.Show.Show err) => GHC.Show.Show (Data.Validation.AccValidation err a) instance (GHC.Classes.Ord a, GHC.Classes.Ord err) => GHC.Classes.Ord (Data.Validation.AccValidation err a) instance (GHC.Classes.Eq a, GHC.Classes.Eq err) => GHC.Classes.Eq (Data.Validation.AccValidation err a) instance GHC.Base.Functor (Data.Validation.AccValidation err) instance Data.Semigroup.Semigroup err => Data.Functor.Bind.Class.Apply (Data.Validation.AccValidation err) instance Data.Semigroup.Semigroup err => GHC.Base.Applicative (Data.Validation.AccValidation err) instance Data.Functor.Alt.Alt (Data.Validation.AccValidation err) instance Data.Foldable.Foldable (Data.Validation.AccValidation err) instance Data.Traversable.Traversable (Data.Validation.AccValidation err) instance Data.Bifunctor.Bifunctor Data.Validation.AccValidation instance Data.Bifoldable.Bifoldable Data.Validation.AccValidation instance Data.Bitraversable.Bitraversable Data.Validation.AccValidation instance Data.Semigroup.Semigroup e => Data.Semigroup.Semigroup (Data.Validation.AccValidation e a) instance GHC.Base.Monoid e => GHC.Base.Monoid (Data.Validation.AccValidation e a) instance Control.Lens.Iso.Swapped Data.Validation.AccValidation instance Data.Validation.Validate Data.Validation.AccValidation instance Data.Validation.Validate Data.Either.Either