How to define function literal with multiple implicit arguments in Scala? I\'ve tried this way:
def create = authAction { (implicit request, user) ⇒ // Synta
There is no way to define an anonymous function with multiple implicit parameters.
To elaborate on @pagoda_5b's answer and @paradigmatic's comment, section 6.23 of the Scala Language Specification defines anonymous functions like so:
Expr ::= (Bindings | [‘implicit’] id | ‘_’) ‘=>’ Expr
ResultExpr ::= (Bindings | ([‘implicit’] id | ‘_’) ‘:’ CompoundType) ‘=>’ Block
Bindings ::= ‘(’ Binding {‘,’ Binding} ‘)’
Binding ::= (id | ‘_’) [‘:’ Type]
As you can see, you can either define a list of parameters or a single implicit parameter.
If you need multiple parameters to be implicit, you need to curry them.