Scala equivalent of extension methods