- Companion:
- class
Type members
Value members
Concrete methods
Turns an Either[Seq[String], A]
into a Validated[A]
Turns an Either[Seq[String], A]
into a Validated[A]
Turns None
into an invalid value, using the given error
message.
Turns a Some[A]
value into a Valid[A]
value.
Turns None
into an invalid value, using the given error
message.
Turns a Some[A]
value into a Valid[A]
value.
Turns a Success[A]
into a Valid[A]
Turns a Success[A]
into a Valid[A]
Turns a Failure[A]
into an invalid value, using the exception message as an 'error' message
Turns a collection of valid values into a valid collection of values.
If all the values in the collection are Valid
, the result will be Valid
.
If there is at least one Invalid
, the result will be an Invalid
containing the error messages of all Invalid
s
If the collection is empty, it will return a Valid
empty collection.
Turns a collection of valid values into a valid collection of values.
If all the values in the collection are Valid
, the result will be Valid
.
If there is at least one Invalid
, the result will be an Invalid
containing the error messages of all Invalid
s
If the collection is empty, it will return a Valid
empty collection.
- Type parameters:
- A
the type of the
Validated
values (e.g.Int
)- CC
the type of the collection of
Validated
values (e.g.List
)
- Value parameters:
- in
the collection of
Validated
values that will be sequenced
- Returns:
the
Validated
of the resulting collection- See also:
scala.concurrent.Future.sequence
Validates a collection of values using the provided function A => Validated[B]
to validate every value.
If all the values in the collection are Valid
, the result will be Valid
.
If there is at least one Invalid
, the result will be an Invalid
containing the error messages of all Invalid
s
If the collection is empty, it will return a Valid
empty collection.
Validates a collection of values using the provided function A => Validated[B]
to validate every value.
If all the values in the collection are Valid
, the result will be Valid
.
If there is at least one Invalid
, the result will be an Invalid
containing the error messages of all Invalid
s
If the collection is empty, it will return a Valid
empty collection.
val myValidatedList = Validated.traverse(myList)(x => myValidateFunc(x))
- Type parameters:
- A
the type of the values to be validated (e.g.
String
)- B
the type of the returned validated values (e.g.
Int
)- CC
the type of the collection of
Validated
(e.g.List
)
- Value parameters:
- fn
the validation function
- in
the collection of values to be validated with the provided function
- Returns:
the
Validated
of the resulting collection- See also:
scala.concurrent.Future.traverse