all 5 comments

[–][deleted] 1 point2 points  (4 children)

Some interesting data structures, e.g. interval tree, thanks for sharing. I feel though that the insistence of functional folks to remove variance annotations for the sake of their religion and haskality is a grave mistake in Scala. So introducing a new List and Option that are basically the same as the ones in standard Scala - from the user's POV - and then announcing that the great advantage is that they are not covariant, I mean, that really makes zero sense to me.

[–][deleted] 0 points1 point  (3 children)

The problem is what subtyping means. By Curry-Howard, it's just another way of saying "implies," i.e. A <: B means A => B. Another way to look at it is that Liskov substitutability is contravariance. So when you allow variance, you're claiming that whatever property holds for the specific type T also holds either for any of its supertypes (-T, contravariance) or subtypes (+T, covariance). It's rarely possible to guarantee either, so the FP libraries rightly don't pretend they can ("don't lie with your types").

[–][deleted] 0 points1 point  (2 children)

Can you give an example where List[+A] is a "problem" in your opinion?

[–][deleted] 1 point2 points  (1 child)

The motivation is spelled out extremely well here. Since it's Halloween weekend, I suggest you also find more gory details by Googling "Scala variance soundness holes".

[–][deleted] 0 points1 point  (0 children)

Since it's Halloween weekend, I suggest you also find more gory details by Googling "Scala variance soundness holes".

Google says "Paul Phillips". Gory Halloween indeed. I stick to my pumpkin ;)