I recently wrote the following bit of Scala:
val f: File = ... // pretend this file came from somewhere val foo = toFoo(io.Source.fromFile(f).mkString) >
val f: File = ... // pretend this file came from somewhere val foo = toFoo(io.Source.fromFile(f).mkString)
You add toFoo to String through the pimp my library pattern. Then it becomes:
toFoo
String
val foo = Source fromFile f mkString () toFoo