scala/scala — pull request #3992 by puffnfresh (2014-09-22 03:51:42+00:00)
Title: Add composition and subst methods to =:= and <:<

Both scalaz.Leibniz and scalaz.Liskov have useful methods which are not
present in Predef.

https://github.com/scalaz/scalaz/blob/series/7.2.x/core/src/main/scala/scalaz/Leibniz.scala

https://github.com/scalaz/scalaz/blob/series/7.2.x/core/src/main/scala/scalaz/Liskov.scala

I don't see a reason why some of the methods should not be present in
scala-library itself, other than the implementations of these methods
have to be done carefully, since Predef uses the singleton trick. You
can read how scalaz makes a different trade-off on the Typelevel blog:

http://typelevel.org/blog/2014/07/06/singleton_instance_trick_unsafe.html

This commit adds the following:

* <:<#compose
* <:<#andThen
* <:<#subst

* =:=#symm
* =:=#compose
* =:=#andThen
* =:=#subst

This means equality is now an equivalence relation:

* Reflexivity (already existed)
* Symmetry
* Transitivity

I find these very useful when trying to do proofs of equality in Scala.

---

Carefully reviewing this code is important, all implementations are casts.

@djspiewak

@S11001001