João Gabriel Zó
02/16/2023, 5:23 PMResult<Unit>
the best thing to do here or is there anything else in the std library?wakingrufus
02/16/2023, 8:57 PMsealed class ExternalCallResult {
object Success : ExternalCallResult
object Failure : ExternalCallResult
}
andylamax
02/17/2023, 7:28 AMnothing
, you can also go with Result<Nothing?>
simon.vergauwen
02/17/2023, 8:45 AMResult<Unit>
where Unit
represents a side-effect without any meaningful result, so "succes" and the Result.failure
holds the failure.
The only value that can be given to Nothing?
is null
since Nothing
has not value, so you can only fill in null
. So it's isomorphic to Unit
.typealias Null = Nothing?
since Nothing?
is the generic way to represent only null
can be a valid value.