effekt
effekt copied to clipboard
Type omission for computation literals with higher-rank-poly
Description
Currently, it is possible to omit parameter types for computation literals like in this (minimal) example
def f() { g: Int => Int }: Int = g(42)
// ...
f { a => a + 1 }
// equals
f { (a: Int) => a + 1 }
However, with the proper implementation of higher-rank-polymorphism in #246, it should also be possible to omit the type parameter and parameter type:
def h() { g: [A](A) => A }: Unit = { g(42); () }
// ...
h { a => a } // error: Wrong number of type arguments, given 0, but function expects 1.
h { [A](a: A) => a } // checks out
We should investigate, whether this can be made possible.