links
links copied to clipboard
Type annotations on parameterised resumptions
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.