effekt-lang / effekt-lang/effekt

Resume both bidirectional and normal handlers with both either a block or a value

Open
#686 2 comments 1 reaction 0 assignees View on GitHub
feature requires-design
Dominant language
Scala
Stars
469
Forks
41
Avg merge
1d 16h
Merged PRs (30d)
23

Description

Consider the following program which works fine in Effekt:

```effekt
effect stop(): Unit

effect yield(): Unit / stop

def main() = {
try {
do yield()
} with stop {
resume(())
} with yield {
resume { () }
}
}
```

Indeed, `stop` is a normal effect and we resume it with `resume(())`, and `yield` is a bidirectional effect and we resume it with `resume { () }`.

I would like the following program to be accepted too and be the same as the previous one:

```effekt
effect stop(): Unit

effect yield(): Unit / stop

def main() = {
try {
do yield()
} with stop {
resume { () }
} with yield {
resume(())
}
}
```

We should be able to resume both kinds of effects with both kinds of syntax. `resume(v)` should be syntactic sugar for `resume { v }`.

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.