I'm learning data structure recently. There is a case that I want to design a generic trait which type should support comparable. If I need to design a generic class, I can design like the following:
class SortedType [A: Ordering](val x: A)
val x = new SortedType(3)
val y = new SortedType("Hello, World!")
However, since in scala, the trait can't have parameters with context bounds, so I can't define a trait like this trait SortedType[A: Ordering]. How can I design the trait so that it's generic type support comparable?
Thanks for your generous advice!