PValidator
wraps up a validation function validate: A => F[E]
which validates the input A
and returns a structure
of error messages F[E]
.
PValidator
wraps up a validation function validate: A => F[E]
which validates the input A
and returns a structure
of error messages F[E]
.
The P
in PValidator
denotes the fact that this validation is polymorphic, in the sense that its input does not have to be of the same type as its output.
This may be useful when a successful validation provides some knowledge about the value that is being validated that can be used to refine its type.
For example, a required
validator makes use of the fact that it has ensured that an Option[A]
is not empty to safely unwrap the option's inner value.
A Validator[F[_], E, A]
wraps a validation function A => F[E]
and provides functions to accumulate the results of this validation into different structures
and to combine validations together so that validations for properties of an object can be combined together to form a validator for the entire object.
The companion object for PValidator
provides various type class instances for PValidator
.
The companion object for Validator
provides a number of functions for constructing simple validators.
The companion object for Validator
provides a number of functions for constructing simple validators.
Validators for comparisons and equality checking can be constructed for types with Order
and Eq
instances, respectively.
There are also functions provided for constructing validators which always pass and which always fail.