<https://kotlinlang.slack.com/archives/C0B9K7EP2/p...
# arrow-meta
m
This is awesome! Really looking forward to this.
f
Is it not possible to have a syntax of the form
String | Int
instead of
Union2<String, Int>
?
Copy code
fun f(): Union2<String, Union2<Int, Double>> = 2
           fun y(): Union3<String, Int, Double> = f()
           fun x(): Int? = y()
Shouldn’t
x()
produce a type mismatch compilation error since
y()
may return types that are not
Int?
?
i
Shouldn’t 
x()
 produce a type mismatch compilation error since 
y()
 may return types that are not 
Int?
?
If they do it simply results in null. That is one of the proofs defined in the prelude.
In other words there is a proof to unbox a Union to a given type, if it is part of the union.
r
It won’t let you unbox to a type that is not in the union, but if the type is in the union you access it safely with its nullable type without matching or folding in all cases
i
A bit poorly phrased from my side. 😄 I get why that could be misunderstood.