Skip to content

Commit

Permalink
Review
Browse files Browse the repository at this point in the history
  • Loading branch information
guizmaii committed Aug 13, 2024
1 parent 8abe1ed commit 968b0b6
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions core/shared/src/main/scala/zio/prelude/ZValidation.scala
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ sealed trait ZValidation[+W, +E, +A] { self =>
*/
final def flatMap[W1 >: W, E1 >: E, B](f: A => ZValidation[W1, E1, B]): ZValidation[W1, E1, B] =
self match {
case failure @ Failure(_, _) => failure
case Success(w, a) =>
case failure: Failure[_, _] => failure
case Success(w, a) =>
f(a) match {
case Failure(w1, e) => Failure(w ++ w1, e)
case Success(w1, b) => Success(w ++ w1, b)
Expand All @@ -97,8 +97,8 @@ sealed trait ZValidation[+W, +E, +A] { self =>
*/
final def forEach[F[+_]: IdentityBoth: Covariant, B](f: A => F[B]): F[ZValidation[W, E, B]] =
self match {
case failure @ Failure(_, _) => failure.succeed[F]
case Success(w, a) => f(a).map(Success(w, _))
case failure: Failure[_, _] => failure.succeed[F]
case Success(w, a) => f(a).map(Success(w, _))
}

/**
Expand Down Expand Up @@ -157,8 +157,8 @@ sealed trait ZValidation[+W, +E, +A] { self =>
*/
final def map[B](f: A => B): ZValidation[W, E, B] =
self match {
case failure @ Failure(_, _) => failure
case Success(w, a) => Success(w, f(a))
case failure: Failure[_, _] => failure
case Success(w, a) => Success(w, f(a))
}

/**
Expand Down Expand Up @@ -254,8 +254,8 @@ sealed trait ZValidation[+W, +E, +A] { self =>
*/
final def toEitherMultiSet: Either[NonEmptyMultiSet[E], A] =
self match {
case failure @ Failure(_, _) => Left(failure.errorsUnordered)
case Success(_, value) => Right(value)
case failure: Failure[_, _] => Left(failure.errorsUnordered)
case Success(_, value) => Right(value)
}

/**
Expand Down Expand Up @@ -335,7 +335,7 @@ sealed trait ZValidation[+W, +E, +A] { self =>
final def zipPar[W1 >: W, E1 >: E, B](that: ZValidation[W1, E1, B])(implicit
zippable: Zippable[A, B]
): ZValidation[W1, E1, zippable.Out] =
zipWithPar(that)(zippable.zip)
zipWithPar(that) { case (a, b) => zippable.zip(a, b) }

/**
* Combines this `ZValidation` with the specified `ZValidation`, using the
Expand Down

0 comments on commit 968b0b6

Please sign in to comment.