Check that the value v is valid in the context of the type W.
Check that the value v is valid in the context of the type W. If it is then
return a Right[V]
containing the value. In addition to validation, this provides
an opportunity to normalize the incoming value in some way for the returned value.
If the value is not valid then return a Left[String]
containing an error message.
The value to be validated and/or normalized
Right[V]
if v
is valid, or Left[String]
with an error message if v
is invalid
Defines a validation of values of type
V
in the context of another typeW
, for example ifW
instance wrap values of typeV
So if you have
case class UserId(id: Long)
you might define an implicitValidator[UserId, Long]
that checks that theLong
value is non-negative.The context in which the validation takes place
The type of the values that will be validated