Skip to content

Instantly share code, notes, and snippets.

@kciesielski
Last active December 25, 2015 14:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kciesielski/36d0e31b1d57772367e5 to your computer and use it in GitHub Desktop.
Save kciesielski/36d0e31b1d57772367e5 to your computer and use it in GitHub Desktop.
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