effekt-lang / effekt-lang/effekt

Not enough unification of capture set between handler body and implementation

Open
#1,236 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Scala
Stars
469
Forks
41
Avg merge
1d 16h
Merged PRs (30d)
23

Description

Consider the following program:

```
effect something(): Unit

def main(): Unit = {
val thunk = try {
do something()
box { return () }
} with something {
box { println("hello"); val _ = resume(()) }
}
thunk()
}
```

It fails to typecheck with "Not allowed {io}". I would like it to typecheck as written.

The following two variants do typecheck:

```
effect something(): Unit

def main(): Unit = {
val thunk = try {
do something()
box { return () } at io
} with something {
box { println("hello"); val _ = resume(()) }
}
thunk()
}
```

Where we explicitly annotate the `io` capture on the returned box.

Also, surprisingly:

```
effect something(): Unit

def main(): Unit = {
val thunk = try {
do something()
box { return () }
} with something {
box { println("hello") }
}
thunk()
}
```

Where we do not resume.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.