From http://stackoverflow.com/questions/7376789/how-to-use-the-function-type-in-scala-within-defined-in-type-meaningfully