shanethehat
shanethehat

Reputation: 15560

Calling a curried function that uses an implicit

Given the function

def func(implicit x: Foo, y: Bar): (ThingA => ThingB) = ???`

I can't figure out how to call it on one line. Obviously this works by storing the returned function in a val:

val f = func // Foo and Bar are implicitly applied
f(ThingA)

but how to do it without the assignment to val? func(ThingA) naturally complains that func has been called with too few arguments.

Upvotes: 0

Views: 68

Answers (1)

Régis Jean-Gilles
Régis Jean-Gilles

Reputation: 32719

The simplest is probably to explicitly call apply:

func.apply(ThingA)

Upvotes: 5

Related Questions