effekt-lang / effekt

A research language with effect handlers and lightweight effect polymorphism

Home Page:https://effekt-lang.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Type omission for computation literals with higher-rank-poly

dvdvgt opened this issue · comments

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.

#417 fixed this for higher-order functions but not higher-rank, my bad.