Suppose I have two types Type1
and Type2
and (non-diverging) values of type Type1 <:< Type2
and Type2 <:< Type1
, is it possible for Type1
and Type2
to not be the same type?
Assuming such a thing is not possible (and I don't think it is), are the functions in the standard library for manipulating this sort of evidence? For instance, functions like:
def eq[A, B](ev1: A <:< B, ev2: B <:< A): A =:= B = ???
def sym[A, B](ev: A =:= B): B =:= A = ???
Basically something equivalent to Data.Type.Equality
in Haskell (but with utilities involving subtyping too).
EDIT
I could obviously cheat my way to a couple of primitives, but that sort of defeats the point of using =:=
and <:<
in the first place...
def eq[A, B](ev1: A <:< B, ev2: B <:< A): A =:= B = =:=.tpEquals[A,A].asInstanceOf
def sym[A, B](ev: A =:= B): B =:= A = =:=.tpEquals[A,A].asInstanceOf