sealed trait ZValidation[+W, +E, +A] extends AnyRef
ZValidation
represents either a success of type A
or a collection of one
or more errors of type E
along with in either case a log with entries of
type W
. Unlike Either
, ZValidation
does not "short circuit" on
failures and instead allows accumulating multiple errors. This can be
particularly useful in validating data, where we want to attempt to validate
all of the data and retain information about all errors that arose, rather
than failing at the first error.
- Self Type
- ZValidation[W, E, A]
- Alphabetic
- By Inheritance
- ZValidation
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def &>[W1 >: W, E1 >: E, B](that: ZValidation[W1, E1, B]): ZValidation[W1, E1, B]
A symbolic alias for
zipParRight
. - final def <&[W1 >: W, E1 >: E, B](that: ZValidation[W1, E1, B]): ZValidation[W1, E1, A]
A symbolic alias for
zipParLeft
. - final def <&>[W1 >: W, E1 >: E, B](that: ZValidation[W1, E1, B]): ZValidation[W1, E1, (A, B)]
A symbolic alias for
zipPar
. - final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ??[W1 >: W](w1: W1): ZValidation[W1, E, A]
A symbolic alias for
log
. - final def as[B](b: B): ZValidation[W, E, B]
Maps the successful value of this
ZValidation
to the specified constant value. - final def asError[E2](e: E2): ZValidation[W, E2, A]
Maps the error value of this
ZValidation
to the specified constant value. - final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def equals(that: Any): Boolean
Returns whether this
ZValidation
and the specifiedZValidation
are equal to each other.Returns whether this
ZValidation
and the specifiedZValidation
are equal to each other.- Definition Classes
- ZValidation → AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def flatMap[W1 >: W, E1 >: E, B](f: (A) => ZValidation[W1, E1, B]): ZValidation[W1, E1, B]
Transforms the value of this
ZValidation
with the specified validation function if it is a success or returns the value unchanged otherwise. - final def flatten[W1 >: W, E1 >: E, B](implicit ev1: <:<[A, ZValidation[W1, E1, B]]): ZValidation[W1, E1, B]
Returns a ZValidation that is this ZValidation if failing or the inner ZValidation if the outer one succeeds.
Returns a ZValidation that is this ZValidation if failing or the inner ZValidation if the outer one succeeds. In particular, the sequential aspect of this combinator precludes combining error values of outer and inner ZValidations. This method can be used to "flatten" nested ZValidation.
- final def fold[B](failure: (NonEmptyChunk[E]) => B, success: (A) => B): B
Folds over the error and success values of this
ZValidation
. - final def forEach[F[+_], B](f: (A) => F[B])(implicit arg0: IdentityBoth[F], arg1: Covariant[F]): F[ZValidation[W, E, B]]
Transforms the value of this
ZValidation
with the specified effectual function if it is a success or returns the value unchanged otherwise. - final def get(implicit ev: <:<[E, Nothing]): A
Returns the value, because no error has occurred.
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def getLog: Chunk[W]
Returns the value of the log.
- final def getOrElse[A1 >: A](fallback: => A1): A1
Returns the value, if successful, or the provided
fallback
value. - final def getOrElseWith[A1 >: A](f: (NonEmptyChunk[E]) => A1): A1
Returns the successful value or handles the errors that have accumulated.
- final def hashCode(): Int
- Definition Classes
- ZValidation → AnyRef → Any
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def log[W1 >: W](w1: W1): ZValidation[W1, E, A]
Writes an entry to the log.
- final def map[B](f: (A) => B): ZValidation[W, E, B]
Transforms the successful value of this
ZValidation
with the specified function. - final def mapError[E2](f: (E) => E2): ZValidation[W, E2, A]
Transforms the error value of this
ZValidation
with the specified function. - final def mapErrorAll[E2](f: (NonEmptyChunk[E]) => NonEmptyChunk[E2]): ZValidation[W, E2, A]
Transforms all the error values of this
ZValidation
with the specified function. - final def mapLog[W2](f: (W) => W2): ZValidation[W2, E, A]
Transforms the log entries of this
ZValidation
with the specified function. - final def mapLogAll[W2](f: (Chunk[W]) => Chunk[W2]): ZValidation[W2, E, A]
Transforms all the log entries of this
ZValidation
with the specified function. - final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def orElse[W1 >: W, E1, A1 >: A](that: ZValidation[W1, E1, A1]): ZValidation[W1, E1, A1]
- final def orElseLog[W1 >: W, E1, A1 >: A](that: ZValidation[W1, E1, A1])(implicit ev: <:<[E, W1]): ZValidation[W1, E1, A1]
- final def runLog[B]: (Chunk[W], Either[NonEmptyChunk[E], A])
Exposes the result of this validation function as either a
Right
with a success of typeA
or aLeft
with one or more errors of typeE
, along with the log. - final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- final def toEither: Either[NonEmptyChunk[E], A]
Transforms this
ZValidation
to anEither
, discarding the log. - final def toEitherAssociative[E1 >: E](implicit A: Associative[E1]): Either[E1, A]
Transforms this
ZValidation
to anEither
, aggregating errors using providedAssociative
instance, discarding the log. - final def toEitherMultiSet: Either[NonEmptyMultiSet[E], A]
Transforms this
ZValidation
to anEither
, discarding the order in which the errors occurred and discarding the log. - final def toEitherWith[E2](f: (NonEmptyChunk[E]) => E2): Either[E2, A]
Transforms this
ZValidation
to anEither
, transforming the accumulated errors and discarding the log. - final def toOption: Option[A]
Transforms this
ZValidation
to anOption
, discarding information about the errors and log. - def toString(): String
- Definition Classes
- AnyRef → Any
- final def toTry(implicit ev: <:<[E, Throwable]): Try[A]
Transforms this
ZValidation
to aTry
, discarding all but the first error and the log. - final def toZIO: IO[E, A]
Converts this
ZValidation
into aZIO
effect, discarding the log. - final def toZIOAssociative[E1 >: E](implicit A: Associative[E1]): IO[E1, A]
Transforms this
ZValidation
to anZIO
effect, aggregating errors using providedAssociative
instance, discarding the log. - final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def zipPar[W1 >: W, E1 >: E, B](that: ZValidation[W1, E1, B]): ZValidation[W1, E1, (A, B)]
Combines this
ZValidation
with the specifiedZValidation
, returning a tuple of their results.Combines this
ZValidation
with the specifiedZValidation
, returning a tuple of their results. Returns either the combined result if both were successes or otherwise returns a failure with all errors. - final def zipParLeft[W1 >: W, E1 >: E, B](that: ZValidation[W1, E1, B]): ZValidation[W1, E1, A]
A variant of
zipPar
that keeps only the left success value, but returns a failure with all errors if either thisZValidation
or the specifiedZValidation
fail. - final def zipParRight[W1 >: W, E1 >: E, B](that: ZValidation[W1, E1, B]): ZValidation[W1, E1, B]
A variant of
zipPar
that keeps only the right success value, but returns a failure with all errors if either thisZValidation
or the specifiedZValidation
fail. - final def zipWithPar[W1 >: W, E1 >: E, B, C](that: ZValidation[W1, E1, B])(f: (A, B) => C): ZValidation[W1, E1, C]
Combines this
ZValidation
with the specifiedZValidation
, using the functionf
to combine their success values.Combines this
ZValidation
with the specifiedZValidation
, using the functionf
to combine their success values. Returns either the combined result if both were successes or otherwise returns a failure with all errors.