diff options
| author | Michael Williamson <mike@zwobble.org> | 2024-12-10 23:22:20 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2024-12-10 23:22:56 +0000 |
| commit | e0bbcd3fb41b54f8d72bf2d08a592def2e44d3b7 (patch) | |
| tree | 793329284914e5bdd1aeae1d59379f418e62307e /examples/27-effect-handler-nested | |
| parent | a3d55321537a29401fe487e040e3b6ebbd04fc3e (diff) | |
Add disabled example for struct positional fields
Diffstat (limited to 'examples/27-effect-handler-nested')
| -rw-r--r-- | examples/27-effect-handler-nested/shed.toml | 7 | ||||
| -rw-r--r-- | examples/27-effect-handler-nested/src/Example.shed | 42 |
2 files changed, 49 insertions, 0 deletions
diff --git a/examples/27-effect-handler-nested/shed.toml b/examples/27-effect-handler-nested/shed.toml new file mode 100644 index 00000000..291ca6db --- /dev/null +++ b/examples/27-effect-handler-nested/shed.toml @@ -0,0 +1,7 @@ +[[shed.bins]] +name = "example" +main-namespace = "Example" + +[[shed.examples]] +bin = "example" +expected-output = "a outer\na inner\na inner\nb\na inner\na inner\na outer" diff --git a/examples/27-effect-handler-nested/src/Example.shed b/examples/27-effect-handler-nested/src/Example.shed new file mode 100644 index 00000000..2a8e4781 --- /dev/null +++ b/examples/27-effect-handler-nested/src/Example.shed @@ -0,0 +1,42 @@ +effect A { + fun a() -> Unit; +} + +effect B { + fun b() -> Unit; +} + +pub fun main() ! Io -> Unit { + try { + A.a!(); + + try { + A.a!(); + + try { + A.a!(); + B.b!(); + A.a!(); + } handle B { + fun b() { + print!("b\n"); + resume; + } + } + + A.a!(); + } handle A { + fun a() { + print!("a inner\n"); + resume; + } + } + + A.a!(); + } handle A { + fun a() { + print!("a outer\n"); + resume; + } + } +} |
