Scala - ordering a list

I am trying to sort a List of XMLMessage which in turn, derive from Message. The Message trait extends Ordered and provides comparison function based on timestamps. However, when I try to say:


the error says

error: diverging implicit expansion for type scala.math.Ordering[domain.XMLMessage]
starting with method comparatorToOrdering in trait LowPriorityOrderingImplicits

How can I provide ordering on the Messages so that list.sorted would work? Thanks


sorted requires an Ordering[XMLMessage], but you (through implicits) can only provide an Ordering[Message]. Ordering is invariant, hence the sort cannot use it. The easiest way to achieve what you want is probably:

list.sortBy(_: Message)

Need Your Help

Django IntegrityError signup_simplesubscriber.date_created may not be NULL

django django-forms

I've read every "InterityError" + "may no be NULL" post and still can't track down what's causing this error.

Differences between (R)Unified Process And Extreme Programming

extreme-programming rational-unified-process

I've searched for at question like this and i dont think there are one.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.