Skip to content

Instantly share code, notes, and snippets.

@kciesielski kciesielski/wrapperWithArg.scala Secret
Last active Dec 25, 2015

Embed
What would you like to do?
def logged[K, T](f: (K) => T)(arg: K): T = {
// log arg
f(arg)
// log arg
}
def someFunction(value: Integer): Integer = {
Integer.valueOf(value * 2)
}
def theExecution() {
// here we go: the 'execution' object has exactly the same type as 'someFunction'
val execution = logged(someFunction) _
execution(2)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.