Skip to content

Commit

Permalink
add: ZValidation#isSuccess & ZValidation#isFailure (#1367)
Browse files Browse the repository at this point in the history
  • Loading branch information
hearnadam authored Aug 28, 2024
1 parent 259d520 commit e3c62ff
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/shared/src/main/scala/zio/prelude/ZValidation.scala
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ sealed trait ZValidation[+W, +E, +A] { self =>

override final def hashCode(): Int = toEitherMultiSet.hashCode()

final def isSuccess: Boolean = self.isInstanceOf[Success[?, ?]]

final def isFailure: Boolean = !isSuccess

/**
* Transforms the value of this `ZValidation` with the specified validation
* function if it is a success or returns the value unchanged otherwise.
Expand Down

0 comments on commit e3c62ff

Please sign in to comment.