From 027d73dea19c4154d27c77cd82dd4b28649cdf3f Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sun, 12 Jan 2025 15:11:04 +0000 Subject: Support recursive project dependencies --- .../29-effect-handler-nested/shed-examples.json5 | 9 +++++ examples/29-effect-handler-nested/shed.json5 | 8 +++++ examples/29-effect-handler-nested/src/Example.shed | 42 ++++++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 examples/29-effect-handler-nested/shed-examples.json5 create mode 100644 examples/29-effect-handler-nested/shed.json5 create mode 100644 examples/29-effect-handler-nested/src/Example.shed (limited to 'examples/29-effect-handler-nested') diff --git a/examples/29-effect-handler-nested/shed-examples.json5 b/examples/29-effect-handler-nested/shed-examples.json5 new file mode 100644 index 00000000..13ea0b50 --- /dev/null +++ b/examples/29-effect-handler-nested/shed-examples.json5 @@ -0,0 +1,9 @@ +{ + examples: [ + { + project: ".", + bin: "example", + expectedOutput: "a outer\na inner\na inner\nb\na inner\na inner\na outer", + }, + ], +} diff --git a/examples/29-effect-handler-nested/shed.json5 b/examples/29-effect-handler-nested/shed.json5 new file mode 100644 index 00000000..e642a813 --- /dev/null +++ b/examples/29-effect-handler-nested/shed.json5 @@ -0,0 +1,8 @@ +{ + bins: [ + { + name: "example", + mainNamespace: "Example", + }, + ], +} 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; + } + } +} -- cgit v1.2.3