-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding get, getOrElse, toFuture to zio.prelude.Validation #791
Comments
@subotic Yes that would be great! I think I would prefer to avoid
trait ZValidation[+W, +E, +A] {
def getOrElse[A1 >: A](fallback: A1): A1 =
???
} It could also make sense to have a variant that returned the log: trait ZValidation[+W, +E, +A] {
def getOrElseLog[A1 >: A](fallback: A1): (W, A1) =
???
}
trait ZValidation[+W, +E, +A] {
def toFuture(implicit ev: E <:< Throwable): Future[A] =
???
} |
@adamgfraser thanks for the pointers. Let's see how far I'll get. |
We could also use something like this trait ZValidation[+W, +E, +A] {
final def valueOr[A1 >: A](f: NonEmptyChunk[E] => A1): A1
???
} Analogously to |
We should be careful about |
Yes. I think we could have a variant that let the user provide a function to convert the errors to a |
😃 Yes we were debating the merits of suppressed exceptions though I think we have gone more in that direction with the recent efforts to make ZIO traces more similar to Java stack traces. |
I would like to suggest a few methods for
zio.prelude.Validation
:get
getOrElse
toFuture
If someone would be generous enough to provide some pointers and to hold my hand a bit, I would like to take a stab at implementing those myself.
The text was updated successfully, but these errors were encountered: