Scala: Merge sort for lists with pattern binding and pairs