List Params in Scala function. Can someone explain the code?

Can someone explain the Scala code used in the Protected application value for the playframework zentask example:

def IsAuthenticated(f: => String => Request[AnyContent] => Result) = Security.Authenticated(username, onUnauthorized) { user =>
Action(request => f(user)(request))
}

I just started to learn Scala and cannot understand this sequence f: => String => Request[AnyContent] => Result. What does it mean? I cannot find examples in manuals that use a few =>instead of a list of parameters for a function.

What am I missing?

+5
source share
2 answers

Maybe this is easier if you add some brackets:

f: => (String => (Request[AnyContent] => Result))

fis a call-by-name parameter ; this is a function that takes Stringand returns: a function that takes Request[AnyContent]and returns a Result.

+7

f - , , a String , , a Result[AnyContent] Result.

2. f user, String, request .

currying. , : http://www.scala-lang.org/node/135

+4