Open b-studios opened 2 years ago
This seems to me like a straightforward transformation to codata:
I guess the tricky part would be inferring the correct instance.
A suggestion for syntax:
class C[A] {
// function declarations
}
instance C[T] {
// function definitions
}
// type constraints
def f [A] <C[A]> (a: A) = {...}
Another idea would be to add implicit parameters to Effekt and use regular codata to express type classes:
// implicit parameter of type A
def f () <a: A> = {...}
def main() = {
f() // passes implicit value iff there is exactly one value of type A in scope
}
We should consider adding typeclasses or similar to prevent repeating code such as sorting datastructures, etc.