You would just need to normalize the type before applying the Negation, it doesn't seem like an insurmountable problem to me at all
-
-
Replying to @LukaJacobowitz @guizmaii
I think you're misreading... there are literally two distinct solutions for x in that example, regardless of whether you normalize (plus potentially others). This could work if type intersections formed a free monoid, but it's not free...
2 replies 0 retweets 0 likes -
Replying to @propensive @guizmaii
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
1 reply 0 retweets 1 like -
Replying to @LukaJacobowitz @guizmaii
Ok, but what should (A ∩ B) \ B give if A = C ∩ B? A might be abstract. Here's a concrete example with types. What is, (Some[Int] with Product) \ Product ?
1 reply 0 retweets 0 likes -
Replying to @propensive @guizmaii
I think that would just be Some[Int] \ Product (maybe the scala compiler can prove this is Nothing, but it's not a deal breaker either way)
1 reply 0 retweets 0 likes -
-
Some[Int] is a Product, so if you forbid Product then nothing can satisfy Some[Int] right?
2 replies 0 retweets 1 like -
I concur, it's kinda how you can have `Int & String` it's also equivalent to `Nothing`, but the compiler can't necessarily check that
2 replies 0 retweets 0 likes -
Int & String is not equivalent to Nothing at all! They happen to have the same members, but they're very different types. Types are defined by their properties, and Int & String represents the union of the sets of properties of Int and String...
2 replies 0 retweets 0 likes -
Right, maybe we're talking about different equivalence relations. `Int & String` may not be `=:=` to Nothing, but sure as hell is isomorphic to it
2 replies 0 retweets 0 likes
But it's not if you use that type as a bound, or for resolving an implicit, and types can be used in this way in Scala. It's only equivalent if you treat it as a set of values, and that's not what it is!
-
-
It seems like we might be agreeing?
Can you name me one use case where `Int & String` would be a useful type and `Nothing` wouldn't do?1 reply 0 retweets 0 likes -
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]).
1 reply 0 retweets 0 likes - Show replies
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.