links-lang / links

Links: Linking Theory to Practice for the Web
http://www.links-lang.org
Other
320 stars 42 forks source link

Type annotations on parameterised resumptions #329

Open dhil opened 6 years ago

dhil commented 6 years ago

In the parameterised effect handlers patch it is currently not possible to add type annotations to parameterised resumptions. The following program illustrates the bug

> fun(m) { 
    handle(m())(true -> st) { 
       case <Foo => (resume : ((Int,Bool) {Foo{_} |_}~> a)> -> resume(42,st) 
       case x -> x } 
};
<stdin>:1: Type error: The resumption
    `resume'
has type
    `(Int) -a-> b'
but it is annotated with type
    `(Int, Bool) {Foo{c}|d}~> e'
In expression: Foo(resume : ((Int,Bool) {Foo{_} |_}~> a)).

The problem is that the piece of code that type patterns do not have access to the arity information for the resumption. The fix is rather simple, but I cannot be bothered to do it now, because I am planning to rewrite that part of the code base when I add support for multi-handlers.

dhil commented 5 years ago

This issue would become irrelevant once #588 has been realised.