Ordered
is not a typeclass, but a trait
, that classes or other traits inherit from to be orderable. So you can't implicitly get an instance of Ordered
. You have to modify your type parameter to make shure, that A
extends Ordered[A]
or can be viewed as one (<%
is a view bound and means there exists an implicit conversion from A
to Ordered[A]
) and then you can simply call compare
:
case class Value[A <% Ordered[A]](value: A) extends Ordered[Value[A]] {
def compare(other: Value[A]) = value compare other.value
}