Given an uninitialised abstract type member is =:=
equal to an existential type
implicitly[Undefined =:= x forSome { type x }] // ok
then why there seems to be a difference between them in
object O {
type Undefined
implicitly[Undefined =:= _] // ok
def g[F[_]](fun: F[_] => F[_]) = ???
def h[F[_]](fun: F[Undefined] => F[Undefined]) = ???
g[List](l => List(42)) // ok
h[List](l => List(42)) // error
}
Note how g
compiles whilst h
raises type mismatch error. Furthermore consider
object O {
type Undefined
type Existential = x forSome { type x }
implicitly[Undefined =:= x forSome { type x }] // ok
implicitly[Undefined =:= Existential] // error
}
If Undefined
equals x forSome { type x }
, and x forSome { type x }
equals Existential
, then why does Undefined
not equal Existential
?