How can you return a generic function from another generic function? This doesn't work
def gen1[A](a: A) = [B](b: B) => ???
But i don't want to define the second generic in the first function like this
def gen1[A, B](a: A) = (b: B) => ???
Is it possible?
Error here:
illegal start of simple expression
[error] def gen1[A](a: A) = [B](b: B) => ???
[error] ^
[error] one error found
[error] (Compile / compileIncremental) Compilation failed
What I'm trying to do is the equivalent of dotty's:
def gen1 = [A] => (a: A) => [B] => (b: B) => (a, b)
But can't find documentation for it in scala 2
def foo() = { def bar[B](b: B) = ??? ; bar _ }