| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Data.Validation
Contents
Description
Data types similar to Data.Either that are explicit about failure and success.
- data AccValidation err a
- = AccFailure err
- | AccSuccess a
- data Validation err a
- data ValidationT err m a = ValidationT {
- runValidationT :: m (Validation err a)
- data ValidationB m err a = ValidationB {
- runValidationB :: m (Validation err a)
- type Validation' err a = ValidationT err Identity a
- _Failure :: Validate f => Prism (f e1 a) (f e2 a) e1 e2
- _Success :: Validate f => Prism (f e a) (f e b) a b
- class Validate f where
Data types
data AccValidation err a Source #
A value of the type err or a, however, the Applicative instance
accumulates values. This is witnessed by the Semigroup context on the instance.
Note that there is no Monad such that ap = (*).
>>>_Success # (+1) <*> _Success # 7 :: AccValidation String IntAccSuccess 8
>>>_Failure # ["f1"] <*> _Success # 7 :: AccValidation [String] IntAccFailure ["f1"]
>>>_Success # (+1) <*> _Failure # ["f2"] :: AccValidation [String] IntAccFailure ["f2"]
>>>_Failure # ["f1"] <*> _Failure # ["f2"] :: AccValidation [String] IntAccFailure ["f1","f2"]
Constructors
| AccFailure err | |
| AccSuccess a |
Instances
data Validation err a Source #
A value of the type err or a and isomorphic to Data.Either.
>>>_Success # (+1) <*> _Success # 7 :: Validation String IntSuccess 8
>>>_Failure # ["f1"] <*> _Success # 7 :: Validation [String] IntFailure ["f1"]
>>>_Success # (+1) <*> _Failure # ["f2"] :: Validation [String] IntFailure ["f2"]
>>>_Failure # ["f1"] <*> _Failure # ["f2"] :: Validation [String] IntFailure ["f1"]
Instances
| Bifunctor Validation Source # | |
| Bitraversable Validation Source # | |
| Bifoldable Validation Source # | |
| Swapped Validation Source # | |
| Validate Validation Source # | |
| Monad (Validation err) Source # | |
| Functor (Validation err) Source # | |
| Applicative (Validation err) Source # | |
| Foldable (Validation err) Source # | |
| Traversable (Validation err) Source # | |
| Alt (Validation err) Source # | |
| Apply (Validation err) Source # | |
| Bind (Validation err) Source # | |
| (Eq a, Eq err) => Eq (Validation err a) Source # | |
| (Data a, Data err) => Data (Validation err a) Source # | |
| (Ord a, Ord err) => Ord (Validation err a) Source # | |
| (Show a, Show err) => Show (Validation err a) Source # | |
data ValidationT err m a Source #
The transformer version of Validation.
Constructors
| ValidationT | |
Fields
| |
Instances
| MonadTrans (ValidationT err) Source # | |
| Monad m => Monad (ValidationT err m) Source # | |
| Functor m => Functor (ValidationT err m) Source # | |
| Applicative m => Applicative (ValidationT err m) Source # | |
| Foldable m => Foldable (ValidationT err m) Source # | |
| Traversable m => Traversable (ValidationT err m) Source # | |
| (Functor m, Monad m) => Alt (ValidationT err m) Source # | |
| Apply m => Apply (ValidationT err m) Source # | |
| (Apply m, Monad m) => Bind (ValidationT err m) Source # | |
data ValidationB m err a Source #
The bifunctor version of ValidationT
Constructors
| ValidationB | |
Fields
| |
Instances
| Functor m => Bifunctor (ValidationB m) Source # | |
| Traversable m => Bitraversable (ValidationB m) Source # | |
| Foldable m => Bifoldable (ValidationB m) Source # | |
| Functor f => Swapped (ValidationB f) Source # | |
| (~) (* -> *) m Identity => Validate (ValidationB m) Source # | |
| Monad m => Monad (ValidationB m err) Source # | |
| Functor m => Functor (ValidationB m err) Source # | |
| Applicative m => Applicative (ValidationB m err) Source # | |
| Foldable m => Foldable (ValidationB m err) Source # | |
| Traversable m => Traversable (ValidationB m err) Source # | |
| (Functor m, Monad m) => Alt (ValidationB m err) Source # | |
| Apply m => Apply (ValidationB m err) Source # | |
| (Apply m, Monad m) => Bind (ValidationB m err) Source # | |
type Validation' err a = ValidationT err Identity a Source #
Prisms
Isomorphisms
class Validate f where Source #
Methods
_Validation :: Iso (f e a) (f g b) (Validation e a) (Validation g b) Source #
_Validation' :: Iso (f e a) (f g b) (Validation' e a) (Validation' g b) Source #
_AccValidation :: Iso (f e a) (f g b) (AccValidation e a) (AccValidation g b) Source #
_Either :: Iso (f e a) (f g b) (Either e a) (Either g b) Source #