vanshg
05/10/2023, 3:45 PMYoussef Shoaib [MOD]
05/11/2023, 3:25 AMSuccess
exist standalone as a sealed interface, and then use the normal Result
class, and deal with the different types of success using a when
on the actual value inside of the Result (because what's the point of treating a failure as a Result<SuccessType1>
Vs a Result<SuccessType2>
)vanshg
05/11/2023, 1:24 PMYoussef Shoaib [MOD]
05/11/2023, 1:46 PMResult<SuccessType1>
instead of a more general Result<Success>
?vanshg
05/11/2023, 3:46 PM(result as Success).value.someProperty
)
I'm leaning towards approach 2 though if my original approach using sealed classes doesn't workYoussef Shoaib [MOD]
05/11/2023, 3:52 PMResult
with no further wrappersvanshg
05/11/2023, 3:54 PMParcelable
Youssef Shoaib [MOD]
05/11/2023, 4:06 PMEither
, or if you really want the value class
performance, then just copy the Result source code and make it additionally parcelable (although note that that will box)