From this video by Functional Programming Principles in Scala "4.5 Variance" you can see a slide that says,
Say you have two function types:
type A = IntSet => NonEmpty type B = NonEmtpy => IntSetAccording to the Liskov Substitution Principle, which of the following should be true?
A <: B(checked)B <: AAandBare unrelated.
The video claims type A is a subtype of type B; but, it does so saying,
Type A satisfies the same contract as Type B if you give it a NonEmpty set it will give you back an IntSet, but it will actually satisfy more than B.
But that's not true, B includes the NonEmpty set which includes more than an IntSet. Is this video just straight up incorrect and confused?
I think it's implied (perhaps mentioned in a previous lesson?) that
NonEmptyis a subtype ofIntSet. Based on the way Odersky was speaking, it sounds likeNonEmptyis the subset ofIntSets that are not empty. SoAaccepts more argument values thanBdoes, and returns a narrower subset of values thanBdoes, a subset with additional properties.