aboutsummaryrefslogtreecommitdiff
path: root/examples/29-effect-handler-nested/src/Example.shed
diff options
context:
space:
mode:
Diffstat (limited to 'examples/29-effect-handler-nested/src/Example.shed')
-rw-r--r--examples/29-effect-handler-nested/src/Example.shed42
1 files changed, 42 insertions, 0 deletions
diff --git a/examples/29-effect-handler-nested/src/Example.shed b/examples/29-effect-handler-nested/src/Example.shed
new file mode 100644
index 00000000..2a8e4781
--- /dev/null
+++ b/examples/29-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;
+ }
+ }
+}