Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
case class SortableSeq[A](seq: Seq[A]): // <1>
def sortByImplicits[B](transform: A => B)(implicit o: Ordering[B]): SortableSeq[A] =
new SortableSeq(seq.sortBy(transform)(o))
def sortBy1a[B](transform: A => B)(using o: Ordering[B]): SortableSeq[A] =
new SortableSeq(seq.sortBy(transform)(o))
def sortBy1b[B](transform: A => B)(using Ordering[B]): SortableSeq[A] =
new SortableSeq(seq.sortBy(transform)(summon[Ordering[B]]))
def sortBy2[B : Ordering](transform: A => B): SortableSeq[A] =
new SortableSeq(seq.sortBy(transform)(summon[Ordering[B]]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.