We can use the same example with set intersection: x ∩ B = A ∩ B Yes, x could be both A or (A ∩ B) or (A ∩ A ∩ B ∩ B ∩ B), that doesn't mean that (A ∩ B) \ B = A. It is NOT subtraction, but difference or negation. I.e. the difference between a Group and a Boolean algebra
I don't think so, unfortunately... it would be useful as the lower bound of an existential parameter to an invariant type which should accept String and Int as the parameter, but not much else. It will be inferred from, say, List(Ordering[Int], Ordering[String]).
-
-
Now, you *could* use Nothing as the lower bound, but you would be losing type information when you don't need to, and it would allow you to have Orderings of any type in your List.
-
In general, when the compiler can't find a universal solution to a least upper-bound, it will infer an existential, bounded above by the LUB of the types, and bounded below by the GLB, which is the intersection type.
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
Can you name me one use case where `Int & String` would be a useful type and `Nothing` wouldn't do?