Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
object TrySequence {
operator fun <T> Try<T>.component1(): T = when (this) {
is Success -> this.value
is Failure -> throw this.error
}
}
fun <T> Try.Companion.sequential(func: TrySequence.() -> T): Try<T> {
return Try { func(TrySequence) }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.