Package com.alliander.result

Types

Failure
Link copied to clipboard
data class Failure<Error, Value>(error: Error) : Result<Error, Value>
A failed result of a computation
Result
Link copied to clipboard
sealed class Result<Error, Value>
Return type of a computation that could fail.
Success
Link copied to clipboard
data class Success<Error, Value>(data: Value) : Result<Error, Value>
A successful result of a computation.

Functions

map2
Link copied to clipboard
fun <E, U, V, W> map2(left: Result<E, U>, right: Result<E, V>, transform: (U, V) -> W): Result<E, W>
Map over two results.
map3
Link copied to clipboard
fun <E, U, V, W, X> map3(left: Result<E, U>, middle: Result<E, V>, right: Result<E, W>, transform: (U, V, W) -> X): Result<E, X>
Map over three results.
toResult
Link copied to clipboard
inline fun <T> T?.toResult(): Result<Unit, T>
Turn a nullable type into a Result.