Scala typed insertion sort