aboutsummaryrefslogtreecommitdiff
path: root/examples/28-effect-in-handler/src
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2024-12-10 23:22:20 +0000
committerMichael Williamson <mike@zwobble.org>2024-12-10 23:22:56 +0000
commite0bbcd3fb41b54f8d72bf2d08a592def2e44d3b7 (patch)
tree793329284914e5bdd1aeae1d59379f418e62307e /examples/28-effect-in-handler/src
parenta3d55321537a29401fe487e040e3b6ebbd04fc3e (diff)
Add disabled example for struct positional fields
Diffstat (limited to 'examples/28-effect-in-handler/src')
-rw-r--r--examples/28-effect-in-handler/src/Example.shed44
1 files changed, 44 insertions, 0 deletions
diff --git a/examples/28-effect-in-handler/src/Example.shed b/examples/28-effect-in-handler/src/Example.shed
new file mode 100644
index 00000000..568d9ea8
--- /dev/null
+++ b/examples/28-effect-in-handler/src/Example.shed
@@ -0,0 +1,44 @@
+effect A {
+ fun a() -> Unit;
+}
+
+effect B {
+ fun b() -> Unit;
+}
+
+pub fun main() ! Io -> Unit {
+ try {
+ A.a!();
+
+ try {
+ A.a!();
+
+ try {
+ B.b!();
+ } handle B {
+ fun b() {
+ print!("b start\n");
+ A.a!();
+ print!("b end\n");
+ resume;
+ }
+ }
+
+ A.a!();
+ } handle A {
+ fun a() {
+ print!("a inner start\n");
+ A.a!();
+ print!("a inner end\n");
+ resume;
+ }
+ }
+
+ A.a!();
+ } handle A {
+ fun a() {
+ print!("a outer\n");
+ resume;
+ }
+ }
+}