What would be a good name for a union of Loading, ...
# arrow
u
What would be a good name for a union of Loading, Success, Error?
r
This is what people frequently call Result if Error is a throwable. If Error is a custom user type it would be Either and in the upcoming IO E is also available so it's built-in in IO in case you are already using that
We also have proper unions coming up with Arrow where this would be Union2 if it's not biased because Unions are commutative
Union<A, B> is the same as Union<B, A>
u
hmm but its 3 values
yes im looking for a semantic name for the Union3, but Result in kotlin is already taken by the Union2<Succ, Err>
a
you would be able to use Union3<Loading, Success, Error> as well
u
sure im just casually looking for a good name, like Either, albeit it do is Union2
s
Mosby (the MVP library) calls it LCE (loading, content, error)
r
There is also Coproduct in arrow generic
But you will get a better API creating your own ADT with three cases until we have proper union support. What Stojan suggest for name looks good to me but I don't seem much acronyms used in Kotlin.
u
yea I'm aware of LCE but not a fan, airbnb uses Async, but thats way too overloaded of a term for ADT, I think