The problem is that foo
is a method, not a function, and eta-expansion (which converts methods to functions) is not attempted until after implicit application. See section 6.26.2 of the language specification for the details, and this issue for additional discussion.
One workaround would be to write something like this:
provideCtx((ctx: ExecutionContext) => (a: Int) => foo(a)(ctx))
I'm not sure a more generic solution is possible (at least without some kind of reflection, etc.), since we can't even refer to foo
(except in a method call, of course) without an implicit in scope.