robots
package robots
- Alphabetic
- By Inheritance
- robots
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
-
final
case class
PValidator[F[_], E, A, B](validate: (A) ⇒ F[E], f: (A) ⇒ B)(implicit FF: Traverse[F], M: MonoidK[F]) extends Product with Serializable
PValidator
wraps up a validation functionvalidate: A => F[E]
which validates the inputA
and returns a structure of error messagesF[E]
.PValidator
wraps up a validation functionvalidate: A => F[E]
which validates the inputA
and returns a structure of error messagesF[E]
.The
P
inPValidator
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 anOption[A]
is not empty to safely unwrap the option's inner value. -
type
Validator[F[_], E, A] = PValidator[F, E, A, A]
A
Validator[F[_], E, A]
wraps a validation functionA => 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.
Value Members
-
object
PValidator extends PValidatorInstances with Serializable
The companion object for
PValidator
provides various type class instances forPValidator
. -
object
Validator
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
andEq
instances, respectively.There are also functions provided for constructing validators which always pass and which always fail.