variance_hw

Just for understanding variance in scala

Tasks:

  • implement all needed case class and case object for proposed traits
    trait ContrVOrdering[-T] {
      def compare(a: T, b: T): Int
    }
    and
    trait BiTree[+T] {
      val value: T
      val left: BiTree[T]
      val right: BiTree[T]
      def add[U/*Think about bound here*/](value: U)(implicit ord: ContrVOrdering[U]): BiTree[U]
    }
  • write tests using scalatest
  • write tests using scalacheck

NOTE: Feel free to extend / change any interface if needed.