A ValidationResult
describes the state of a Field
once it has been validated.
It can contain the value of the field if the validation Passed
or
an error if the validation Failed
map : (a -> b) -> ValidationResult x a -> ValidationResult x b
Apply a function to a ValidationResult
. If the ValidationResult
is Passed
, it will be converted.
if the ValidationResult
has Failed
then the failure will propogate
contraMap : (a -> b) -> ValidationResult a x -> ValidationResult b x
Apply a function to a ValidationResult
. If the ValidationResult
is Failed
, it will be converted.
if the ValidationResult
has Passed
then the passed state will propogate
andThen : (v -> ValidationResult e v) -> ValidationResult e v -> ValidationResult e v
Chain multiple validation functions
filterFailures : List (ValidationResult e v) -> List (ValidationResult e v)
Get all ValidationResults that Failed
filterPassed : List (ValidationResult e v) -> List (ValidationResult e v)
Get all ValidationResults that Passed