In this example we will see how to reimplement =:= using phantom types and in the process fix a vulnerability that it has.
It is a simplified version of TypeConstraint which also implements <:<.
Type constraints =:= gives an evidence that two generic types are in fact equal and provides a mechanism to safely cast one type to the other. In the following example we want to assign an x: X to an ys: Array[Y] where we don't know if it is possible (this will be known at call site). Therefore we use an implicit evidence ev: X =:= Y to know that they are equal and ev(x) to cast x form X to Y.