From 6ead9f417fabd55cc26a93c6d54bdde1110fccd4 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sun, 2 Feb 2025 19:10:44 +0000 Subject: Add runtime support for relational int operations --- examples/07-int-comparisons/shed-examples.json5 | 21 +++++++++++ examples/07-int-comparisons/shed.json5 | 8 ++++ .../07-int-comparisons/src/IntComparisons.shed | 24 ++++++++++++ examples/07-mutual-recursion/shed-examples.json5 | 9 ----- examples/07-mutual-recursion/shed.json5 | 8 ---- .../07-mutual-recursion/src/MutualRecursion.shed | 20 ---------- examples/08-blocks/shed-examples.json5 | 9 ----- examples/08-blocks/shed.json5 | 8 ---- examples/08-blocks/src/Counting.shed | 22 ----------- examples/08-mutual-recursion/shed-examples.json5 | 9 +++++ examples/08-mutual-recursion/shed.json5 | 8 ++++ .../08-mutual-recursion/src/MutualRecursion.shed | 20 ++++++++++ examples/09-blocks/shed-examples.json5 | 9 +++++ examples/09-blocks/shed.json5 | 8 ++++ examples/09-blocks/src/Counting.shed | 22 +++++++++++ examples/09-var/shed-examples.json5 | 9 ----- examples/09-var/shed.json5 | 8 ---- examples/09-var/src/HelloWorld.shed | 5 --- examples/10-var/shed-examples.json5 | 9 +++++ examples/10-var/shed.json5 | 8 ++++ examples/10-var/src/HelloWorld.shed | 5 +++ examples/10-while/shed-examples.json5 | 9 ----- examples/10-while/shed.json5 | 8 ---- examples/10-while/src/Counting.shed | 18 --------- examples/11-tuples/shed-examples.json5 | 9 ----- examples/11-tuples/shed.json5 | 8 ---- examples/11-tuples/src/HelloWorld.shed | 9 ----- examples/11-while/shed-examples.json5 | 9 +++++ examples/11-while/shed.json5 | 8 ++++ examples/11-while/src/Counting.shed | 18 +++++++++ examples/12-named-args/shed-examples.json5 | 9 ----- examples/12-named-args/shed.json5 | 8 ---- examples/12-named-args/src/HelloWorld.shed | 11 ------ examples/12-tuples/shed-examples.json5 | 9 +++++ examples/12-tuples/shed.json5 | 8 ++++ examples/12-tuples/src/HelloWorld.shed | 9 +++++ examples/13-named-args/shed-examples.json5 | 9 +++++ examples/13-named-args/shed.json5 | 8 ++++ examples/13-named-args/src/HelloWorld.shed | 11 ++++++ examples/13-target-ignore/shed-examples.json5 | 9 ----- examples/13-target-ignore/shed.json5 | 8 ---- examples/13-target-ignore/src/HelloWorld.shed | 9 ----- examples/14-structs/shed-examples.json5 | 9 ----- examples/14-structs/shed.json5 | 8 ---- examples/14-structs/src/HelloWorld.shed | 15 -------- examples/14-target-ignore/shed-examples.json5 | 9 +++++ examples/14-target-ignore/shed.json5 | 8 ++++ examples/14-target-ignore/src/HelloWorld.shed | 9 +++++ examples/15-struct-hoisting/shed-examples.json5 | 9 ----- examples/15-struct-hoisting/shed.json5 | 8 ---- examples/15-struct-hoisting/src/HelloWorld.shed | 12 ------ examples/15-structs/shed-examples.json5 | 9 +++++ examples/15-structs/shed.json5 | 8 ++++ examples/15-structs/src/HelloWorld.shed | 15 ++++++++ examples/16-struct-hoisting/shed-examples.json5 | 9 +++++ examples/16-struct-hoisting/shed.json5 | 8 ++++ examples/16-struct-hoisting/src/HelloWorld.shed | 12 ++++++ .../shed-examples.json5 | 9 ----- examples/16-struct-positional-fields/shed.json5 | 8 ---- .../src/HelloWorld.shed | 17 --------- .../shed-examples.json5 | 9 +++++ examples/17-struct-positional-fields/shed.json5 | 8 ++++ .../src/HelloWorld.shed | 17 +++++++++ examples/17-sums/shed-examples.json5 | 9 ----- examples/17-sums/shed.json5 | 8 ---- examples/17-sums/src/HelloWorld.shed | 23 ----------- .../18-import-same-project/shed-examples.json5 | 9 ----- examples/18-import-same-project/shed.json5 | 8 ---- .../18-import-same-project/src/HelloWorld.shed | 5 --- examples/18-import-same-project/src/Message.shed | 1 - examples/18-sums/shed-examples.json5 | 9 +++++ examples/18-sums/shed.json5 | 8 ++++ examples/18-sums/src/HelloWorld.shed | 23 +++++++++++ .../hello-world/.gitignore | 1 - .../hello-world/shed.json5 | 13 ------- .../hello-world/src/HelloWorld.shed | 5 --- .../19-import-different-project/message/shed.json5 | 2 - .../message/src/Message.shed | 1 - .../shed-examples.json5 | 9 ----- .../19-import-same-project/shed-examples.json5 | 9 +++++ examples/19-import-same-project/shed.json5 | 8 ++++ .../19-import-same-project/src/HelloWorld.shed | 5 +++ examples/19-import-same-project/src/Message.shed | 1 + .../hello-world/.gitignore | 1 + .../hello-world/shed.json5 | 13 +++++++ .../hello-world/src/HelloWorld.shed | 5 +++ .../20-import-different-project/message/shed.json5 | 2 + .../message/src/Message.shed | 1 + .../shed-examples.json5 | 9 +++++ .../hello-world/.gitignore | 1 - .../hello-world/shed.json5 | 13 ------- .../hello-world/src/HelloWorld.shed | 5 --- .../message1/shed.json5 | 7 ---- .../message1/src/Message1.shed | 3 -- .../message2/shed.json5 | 2 - .../message2/src/Message2.shed | 1 - .../shed-examples.json5 | 9 ----- .../21-function-expression/shed-examples.json5 | 9 ----- examples/21-function-expression/shed.json5 | 8 ---- .../21-function-expression/src/HelloWorld.shed | 11 ------ .../hello-world/.gitignore | 1 + .../hello-world/shed.json5 | 13 +++++++ .../hello-world/src/HelloWorld.shed | 5 +++ .../message1/shed.json5 | 7 ++++ .../message1/src/Message1.shed | 3 ++ .../message2/shed.json5 | 2 + .../message2/src/Message2.shed | 1 + .../shed-examples.json5 | 9 +++++ .../shed-examples.json5 | 9 ----- .../shed.json5 | 8 ---- .../src/HelloWorld.shed | 4 -- .../22-function-expression/shed-examples.json5 | 9 +++++ examples/22-function-expression/shed.json5 | 8 ++++ .../22-function-expression/src/HelloWorld.shed | 11 ++++++ .../shed-examples.json5 | 9 ----- .../shed.json5 | 8 ---- .../src/HelloWorld.shed | 8 ---- .../shed-examples.json5 | 9 +++++ .../shed.json5 | 8 ++++ .../src/HelloWorld.shed | 4 ++ examples/24-effect-resume/shed-examples.json5 | 9 ----- examples/24-effect-resume/shed.json5 | 8 ---- examples/24-effect-resume/src/HelloWorld.shed | 23 ----------- .../shed-examples.json5 | 9 +++++ .../shed.json5 | 8 ++++ .../src/HelloWorld.shed | 8 ++++ .../shed-examples.json5 | 9 ----- examples/25-effect-resume-with-value/shed.json5 | 8 ---- .../src/HelloWorld.shed | 21 ----------- examples/25-effect-resume/shed-examples.json5 | 9 +++++ examples/25-effect-resume/shed.json5 | 8 ++++ examples/25-effect-resume/src/HelloWorld.shed | 23 +++++++++++ .../shed-examples.json5 | 9 +++++ examples/26-effect-resume-with-value/shed.json5 | 8 ++++ .../src/HelloWorld.shed | 21 +++++++++++ examples/26-effect-with-state/shed-examples.json5 | 9 ----- examples/26-effect-with-state/shed.json5 | 8 ---- examples/26-effect-with-state/src/HelloWorld.shed | 22 ----------- examples/27-effect-handler-pop/shed-examples.json5 | 9 ----- examples/27-effect-handler-pop/shed.json5 | 8 ---- examples/27-effect-handler-pop/src/HelloWorld.shed | 36 ------------------ examples/27-effect-with-state/shed-examples.json5 | 9 +++++ examples/27-effect-with-state/shed.json5 | 8 ++++ examples/27-effect-with-state/src/HelloWorld.shed | 22 +++++++++++ .../shed-examples.json5 | 9 ----- .../28-effect-handler-pop-on-return/shed.json5 | 8 ---- .../src/HelloWorld.shed | 41 -------------------- examples/28-effect-handler-pop/shed-examples.json5 | 9 +++++ examples/28-effect-handler-pop/shed.json5 | 8 ++++ examples/28-effect-handler-pop/src/HelloWorld.shed | 36 ++++++++++++++++++ .../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 --------------------- .../shed-examples.json5 | 9 +++++ .../29-effect-handler-pop-on-return/shed.json5 | 8 ++++ .../src/HelloWorld.shed | 41 ++++++++++++++++++++ .../30-effect-handler-nested/shed-examples.json5 | 9 +++++ examples/30-effect-handler-nested/shed.json5 | 8 ++++ examples/30-effect-handler-nested/src/Example.shed | 42 +++++++++++++++++++++ examples/30-effect-in-handler/shed-examples.json5 | 9 ----- examples/30-effect-in-handler/shed.json5 | 8 ---- examples/30-effect-in-handler/src/Example.shed | 44 ---------------------- examples/31-effect-break/shed-examples.json5 | 9 ----- examples/31-effect-break/shed.json5 | 8 ---- examples/31-effect-break/src/HelloWorld.shed | 27 ------------- examples/31-effect-in-handler/shed-examples.json5 | 9 +++++ examples/31-effect-in-handler/shed.json5 | 8 ++++ examples/31-effect-in-handler/src/Example.shed | 44 ++++++++++++++++++++++ examples/32-effect-break/shed-examples.json5 | 9 +++++ examples/32-effect-break/shed.json5 | 8 ++++ examples/32-effect-break/src/HelloWorld.shed | 27 +++++++++++++ examples/32-generic-structs/shed-examples.json5 | 9 ----- examples/32-generic-structs/shed.json5 | 8 ---- examples/32-generic-structs/src/HelloWorld.shed | 15 -------- examples/33-generic-structs/shed-examples.json5 | 9 +++++ examples/33-generic-structs/shed.json5 | 8 ++++ examples/33-generic-structs/src/HelloWorld.shed | 15 ++++++++ examples/33-generic-sums/shed-examples.json5 | 9 ----- examples/33-generic-sums/shed.json5 | 8 ---- examples/33-generic-sums/src/HelloWorld.shed | 23 ----------- .../shed-examples.json5 | 9 ----- .../shed.json5 | 8 ---- .../src/HelloWorld.shed | 23 ----------- examples/34-generic-sums/shed-examples.json5 | 9 +++++ examples/34-generic-sums/shed.json5 | 8 ++++ examples/34-generic-sums/src/HelloWorld.shed | 23 +++++++++++ examples/35-generic-functions/shed-examples.json5 | 9 ----- examples/35-generic-functions/shed.json5 | 8 ---- examples/35-generic-functions/src/HelloWorld.shed | 15 -------- .../shed-examples.json5 | 9 +++++ .../shed.json5 | 8 ++++ .../src/HelloWorld.shed | 23 +++++++++++ examples/36-generic-effects/shed-examples.json5 | 9 ----- examples/36-generic-effects/shed.json5 | 8 ---- examples/36-generic-effects/src/HelloWorld.shed | 11 ------ examples/36-generic-functions/shed-examples.json5 | 9 +++++ examples/36-generic-functions/shed.json5 | 8 ++++ examples/36-generic-functions/src/HelloWorld.shed | 15 ++++++++ examples/37-generic-effects/shed-examples.json5 | 9 +++++ examples/37-generic-effects/shed.json5 | 8 ++++ examples/37-generic-effects/src/HelloWorld.shed | 11 ++++++ examples/37-struct-methods/shed-examples.json5 | 9 ----- examples/37-struct-methods/shed.json5 | 8 ---- examples/37-struct-methods/src/HelloWorld.shed | 17 --------- .../shed-examples.json5 | 9 ----- examples/38-struct-method-references/shed.json5 | 8 ---- .../src/HelloWorld.shed | 25 ------------ examples/38-struct-methods/shed-examples.json5 | 9 +++++ examples/38-struct-methods/shed.json5 | 8 ++++ examples/38-struct-methods/src/HelloWorld.shed | 17 +++++++++ .../39-generic-struct-methods/shed-examples.json5 | 9 ----- examples/39-generic-struct-methods/shed.json5 | 8 ---- .../39-generic-struct-methods/src/HelloWorld.shed | 11 ------ .../shed-examples.json5 | 9 +++++ examples/39-struct-method-references/shed.json5 | 8 ++++ .../src/HelloWorld.shed | 25 ++++++++++++ .../shed-examples.json5 | 9 ----- examples/40-generic-struct-methods-this/shed.json5 | 8 ---- .../src/HelloWorld.shed | 15 -------- .../40-generic-struct-methods/shed-examples.json5 | 9 +++++ examples/40-generic-struct-methods/shed.json5 | 8 ++++ .../40-generic-struct-methods/src/HelloWorld.shed | 11 ++++++ .../shed-examples.json5 | 9 +++++ examples/41-generic-struct-methods-this/shed.json5 | 8 ++++ .../src/HelloWorld.shed | 15 ++++++++ examples/41-native-code/shed-examples.json5 | 9 ----- examples/41-native-code/shed.json5 | 11 ------ examples/41-native-code/src/False.shed | 5 --- examples/42-native-code/shed-examples.json5 | 9 +++++ examples/42-native-code/shed.json5 | 11 ++++++ examples/42-native-code/src/False.shed | 5 +++ 231 files changed, 1295 insertions(+), 1242 deletions(-) create mode 100644 examples/07-int-comparisons/shed-examples.json5 create mode 100644 examples/07-int-comparisons/shed.json5 create mode 100644 examples/07-int-comparisons/src/IntComparisons.shed delete mode 100644 examples/07-mutual-recursion/shed-examples.json5 delete mode 100644 examples/07-mutual-recursion/shed.json5 delete mode 100644 examples/07-mutual-recursion/src/MutualRecursion.shed delete mode 100644 examples/08-blocks/shed-examples.json5 delete mode 100644 examples/08-blocks/shed.json5 delete mode 100644 examples/08-blocks/src/Counting.shed create mode 100644 examples/08-mutual-recursion/shed-examples.json5 create mode 100644 examples/08-mutual-recursion/shed.json5 create mode 100644 examples/08-mutual-recursion/src/MutualRecursion.shed create mode 100644 examples/09-blocks/shed-examples.json5 create mode 100644 examples/09-blocks/shed.json5 create mode 100644 examples/09-blocks/src/Counting.shed delete mode 100644 examples/09-var/shed-examples.json5 delete mode 100644 examples/09-var/shed.json5 delete mode 100644 examples/09-var/src/HelloWorld.shed create mode 100644 examples/10-var/shed-examples.json5 create mode 100644 examples/10-var/shed.json5 create mode 100644 examples/10-var/src/HelloWorld.shed delete mode 100644 examples/10-while/shed-examples.json5 delete mode 100644 examples/10-while/shed.json5 delete mode 100644 examples/10-while/src/Counting.shed delete mode 100644 examples/11-tuples/shed-examples.json5 delete mode 100644 examples/11-tuples/shed.json5 delete mode 100644 examples/11-tuples/src/HelloWorld.shed create mode 100644 examples/11-while/shed-examples.json5 create mode 100644 examples/11-while/shed.json5 create mode 100644 examples/11-while/src/Counting.shed delete mode 100644 examples/12-named-args/shed-examples.json5 delete mode 100644 examples/12-named-args/shed.json5 delete mode 100644 examples/12-named-args/src/HelloWorld.shed create mode 100644 examples/12-tuples/shed-examples.json5 create mode 100644 examples/12-tuples/shed.json5 create mode 100644 examples/12-tuples/src/HelloWorld.shed create mode 100644 examples/13-named-args/shed-examples.json5 create mode 100644 examples/13-named-args/shed.json5 create mode 100644 examples/13-named-args/src/HelloWorld.shed delete mode 100644 examples/13-target-ignore/shed-examples.json5 delete mode 100644 examples/13-target-ignore/shed.json5 delete mode 100644 examples/13-target-ignore/src/HelloWorld.shed delete mode 100644 examples/14-structs/shed-examples.json5 delete mode 100644 examples/14-structs/shed.json5 delete mode 100644 examples/14-structs/src/HelloWorld.shed create mode 100644 examples/14-target-ignore/shed-examples.json5 create mode 100644 examples/14-target-ignore/shed.json5 create mode 100644 examples/14-target-ignore/src/HelloWorld.shed delete mode 100644 examples/15-struct-hoisting/shed-examples.json5 delete mode 100644 examples/15-struct-hoisting/shed.json5 delete mode 100644 examples/15-struct-hoisting/src/HelloWorld.shed create mode 100644 examples/15-structs/shed-examples.json5 create mode 100644 examples/15-structs/shed.json5 create mode 100644 examples/15-structs/src/HelloWorld.shed create mode 100644 examples/16-struct-hoisting/shed-examples.json5 create mode 100644 examples/16-struct-hoisting/shed.json5 create mode 100644 examples/16-struct-hoisting/src/HelloWorld.shed delete mode 100644 examples/16-struct-positional-fields/shed-examples.json5 delete mode 100644 examples/16-struct-positional-fields/shed.json5 delete mode 100644 examples/16-struct-positional-fields/src/HelloWorld.shed create mode 100644 examples/17-struct-positional-fields/shed-examples.json5 create mode 100644 examples/17-struct-positional-fields/shed.json5 create mode 100644 examples/17-struct-positional-fields/src/HelloWorld.shed delete mode 100644 examples/17-sums/shed-examples.json5 delete mode 100644 examples/17-sums/shed.json5 delete mode 100644 examples/17-sums/src/HelloWorld.shed delete mode 100644 examples/18-import-same-project/shed-examples.json5 delete mode 100644 examples/18-import-same-project/shed.json5 delete mode 100644 examples/18-import-same-project/src/HelloWorld.shed delete mode 100644 examples/18-import-same-project/src/Message.shed create mode 100644 examples/18-sums/shed-examples.json5 create mode 100644 examples/18-sums/shed.json5 create mode 100644 examples/18-sums/src/HelloWorld.shed delete mode 100644 examples/19-import-different-project/hello-world/.gitignore delete mode 100644 examples/19-import-different-project/hello-world/shed.json5 delete mode 100644 examples/19-import-different-project/hello-world/src/HelloWorld.shed delete mode 100644 examples/19-import-different-project/message/shed.json5 delete mode 100644 examples/19-import-different-project/message/src/Message.shed delete mode 100644 examples/19-import-different-project/shed-examples.json5 create mode 100644 examples/19-import-same-project/shed-examples.json5 create mode 100644 examples/19-import-same-project/shed.json5 create mode 100644 examples/19-import-same-project/src/HelloWorld.shed create mode 100644 examples/19-import-same-project/src/Message.shed create mode 100644 examples/20-import-different-project/hello-world/.gitignore create mode 100644 examples/20-import-different-project/hello-world/shed.json5 create mode 100644 examples/20-import-different-project/hello-world/src/HelloWorld.shed create mode 100644 examples/20-import-different-project/message/shed.json5 create mode 100644 examples/20-import-different-project/message/src/Message.shed create mode 100644 examples/20-import-different-project/shed-examples.json5 delete mode 100644 examples/20-import-recursive-dependency/hello-world/.gitignore delete mode 100644 examples/20-import-recursive-dependency/hello-world/shed.json5 delete mode 100644 examples/20-import-recursive-dependency/hello-world/src/HelloWorld.shed delete mode 100644 examples/20-import-recursive-dependency/message1/shed.json5 delete mode 100644 examples/20-import-recursive-dependency/message1/src/Message1.shed delete mode 100644 examples/20-import-recursive-dependency/message2/shed.json5 delete mode 100644 examples/20-import-recursive-dependency/message2/src/Message2.shed delete mode 100644 examples/20-import-recursive-dependency/shed-examples.json5 delete mode 100644 examples/21-function-expression/shed-examples.json5 delete mode 100644 examples/21-function-expression/shed.json5 delete mode 100644 examples/21-function-expression/src/HelloWorld.shed create mode 100644 examples/21-import-recursive-dependency/hello-world/.gitignore create mode 100644 examples/21-import-recursive-dependency/hello-world/shed.json5 create mode 100644 examples/21-import-recursive-dependency/hello-world/src/HelloWorld.shed create mode 100644 examples/21-import-recursive-dependency/message1/shed.json5 create mode 100644 examples/21-import-recursive-dependency/message1/src/Message1.shed create mode 100644 examples/21-import-recursive-dependency/message2/shed.json5 create mode 100644 examples/21-import-recursive-dependency/message2/src/Message2.shed create mode 100644 examples/21-import-recursive-dependency/shed-examples.json5 delete mode 100644 examples/22-function-expression-infer-return-type/shed-examples.json5 delete mode 100644 examples/22-function-expression-infer-return-type/shed.json5 delete mode 100644 examples/22-function-expression-infer-return-type/src/HelloWorld.shed create mode 100644 examples/22-function-expression/shed-examples.json5 create mode 100644 examples/22-function-expression/shed.json5 create mode 100644 examples/22-function-expression/src/HelloWorld.shed delete mode 100644 examples/23-function-expression-infer-param-type/shed-examples.json5 delete mode 100644 examples/23-function-expression-infer-param-type/shed.json5 delete mode 100644 examples/23-function-expression-infer-param-type/src/HelloWorld.shed create mode 100644 examples/23-function-expression-infer-return-type/shed-examples.json5 create mode 100644 examples/23-function-expression-infer-return-type/shed.json5 create mode 100644 examples/23-function-expression-infer-return-type/src/HelloWorld.shed delete mode 100644 examples/24-effect-resume/shed-examples.json5 delete mode 100644 examples/24-effect-resume/shed.json5 delete mode 100644 examples/24-effect-resume/src/HelloWorld.shed create mode 100644 examples/24-function-expression-infer-param-type/shed-examples.json5 create mode 100644 examples/24-function-expression-infer-param-type/shed.json5 create mode 100644 examples/24-function-expression-infer-param-type/src/HelloWorld.shed delete mode 100644 examples/25-effect-resume-with-value/shed-examples.json5 delete mode 100644 examples/25-effect-resume-with-value/shed.json5 delete mode 100644 examples/25-effect-resume-with-value/src/HelloWorld.shed create mode 100644 examples/25-effect-resume/shed-examples.json5 create mode 100644 examples/25-effect-resume/shed.json5 create mode 100644 examples/25-effect-resume/src/HelloWorld.shed create mode 100644 examples/26-effect-resume-with-value/shed-examples.json5 create mode 100644 examples/26-effect-resume-with-value/shed.json5 create mode 100644 examples/26-effect-resume-with-value/src/HelloWorld.shed delete mode 100644 examples/26-effect-with-state/shed-examples.json5 delete mode 100644 examples/26-effect-with-state/shed.json5 delete mode 100644 examples/26-effect-with-state/src/HelloWorld.shed delete mode 100644 examples/27-effect-handler-pop/shed-examples.json5 delete mode 100644 examples/27-effect-handler-pop/shed.json5 delete mode 100644 examples/27-effect-handler-pop/src/HelloWorld.shed create mode 100644 examples/27-effect-with-state/shed-examples.json5 create mode 100644 examples/27-effect-with-state/shed.json5 create mode 100644 examples/27-effect-with-state/src/HelloWorld.shed delete mode 100644 examples/28-effect-handler-pop-on-return/shed-examples.json5 delete mode 100644 examples/28-effect-handler-pop-on-return/shed.json5 delete mode 100644 examples/28-effect-handler-pop-on-return/src/HelloWorld.shed create mode 100644 examples/28-effect-handler-pop/shed-examples.json5 create mode 100644 examples/28-effect-handler-pop/shed.json5 create mode 100644 examples/28-effect-handler-pop/src/HelloWorld.shed delete mode 100644 examples/29-effect-handler-nested/shed-examples.json5 delete mode 100644 examples/29-effect-handler-nested/shed.json5 delete mode 100644 examples/29-effect-handler-nested/src/Example.shed create mode 100644 examples/29-effect-handler-pop-on-return/shed-examples.json5 create mode 100644 examples/29-effect-handler-pop-on-return/shed.json5 create mode 100644 examples/29-effect-handler-pop-on-return/src/HelloWorld.shed create mode 100644 examples/30-effect-handler-nested/shed-examples.json5 create mode 100644 examples/30-effect-handler-nested/shed.json5 create mode 100644 examples/30-effect-handler-nested/src/Example.shed delete mode 100644 examples/30-effect-in-handler/shed-examples.json5 delete mode 100644 examples/30-effect-in-handler/shed.json5 delete mode 100644 examples/30-effect-in-handler/src/Example.shed delete mode 100644 examples/31-effect-break/shed-examples.json5 delete mode 100644 examples/31-effect-break/shed.json5 delete mode 100644 examples/31-effect-break/src/HelloWorld.shed create mode 100644 examples/31-effect-in-handler/shed-examples.json5 create mode 100644 examples/31-effect-in-handler/shed.json5 create mode 100644 examples/31-effect-in-handler/src/Example.shed create mode 100644 examples/32-effect-break/shed-examples.json5 create mode 100644 examples/32-effect-break/shed.json5 create mode 100644 examples/32-effect-break/src/HelloWorld.shed delete mode 100644 examples/32-generic-structs/shed-examples.json5 delete mode 100644 examples/32-generic-structs/shed.json5 delete mode 100644 examples/32-generic-structs/src/HelloWorld.shed create mode 100644 examples/33-generic-structs/shed-examples.json5 create mode 100644 examples/33-generic-structs/shed.json5 create mode 100644 examples/33-generic-structs/src/HelloWorld.shed delete mode 100644 examples/33-generic-sums/shed-examples.json5 delete mode 100644 examples/33-generic-sums/shed.json5 delete mode 100644 examples/33-generic-sums/src/HelloWorld.shed delete mode 100644 examples/34-generic-structs-and-sums-inferred-type-args/shed-examples.json5 delete mode 100644 examples/34-generic-structs-and-sums-inferred-type-args/shed.json5 delete mode 100644 examples/34-generic-structs-and-sums-inferred-type-args/src/HelloWorld.shed create mode 100644 examples/34-generic-sums/shed-examples.json5 create mode 100644 examples/34-generic-sums/shed.json5 create mode 100644 examples/34-generic-sums/src/HelloWorld.shed delete mode 100644 examples/35-generic-functions/shed-examples.json5 delete mode 100644 examples/35-generic-functions/shed.json5 delete mode 100644 examples/35-generic-functions/src/HelloWorld.shed create mode 100644 examples/35-generic-structs-and-sums-inferred-type-args/shed-examples.json5 create mode 100644 examples/35-generic-structs-and-sums-inferred-type-args/shed.json5 create mode 100644 examples/35-generic-structs-and-sums-inferred-type-args/src/HelloWorld.shed delete mode 100644 examples/36-generic-effects/shed-examples.json5 delete mode 100644 examples/36-generic-effects/shed.json5 delete mode 100644 examples/36-generic-effects/src/HelloWorld.shed create mode 100644 examples/36-generic-functions/shed-examples.json5 create mode 100644 examples/36-generic-functions/shed.json5 create mode 100644 examples/36-generic-functions/src/HelloWorld.shed create mode 100644 examples/37-generic-effects/shed-examples.json5 create mode 100644 examples/37-generic-effects/shed.json5 create mode 100644 examples/37-generic-effects/src/HelloWorld.shed delete mode 100644 examples/37-struct-methods/shed-examples.json5 delete mode 100644 examples/37-struct-methods/shed.json5 delete mode 100644 examples/37-struct-methods/src/HelloWorld.shed delete mode 100644 examples/38-struct-method-references/shed-examples.json5 delete mode 100644 examples/38-struct-method-references/shed.json5 delete mode 100644 examples/38-struct-method-references/src/HelloWorld.shed create mode 100644 examples/38-struct-methods/shed-examples.json5 create mode 100644 examples/38-struct-methods/shed.json5 create mode 100644 examples/38-struct-methods/src/HelloWorld.shed delete mode 100644 examples/39-generic-struct-methods/shed-examples.json5 delete mode 100644 examples/39-generic-struct-methods/shed.json5 delete mode 100644 examples/39-generic-struct-methods/src/HelloWorld.shed create mode 100644 examples/39-struct-method-references/shed-examples.json5 create mode 100644 examples/39-struct-method-references/shed.json5 create mode 100644 examples/39-struct-method-references/src/HelloWorld.shed delete mode 100644 examples/40-generic-struct-methods-this/shed-examples.json5 delete mode 100644 examples/40-generic-struct-methods-this/shed.json5 delete mode 100644 examples/40-generic-struct-methods-this/src/HelloWorld.shed create mode 100644 examples/40-generic-struct-methods/shed-examples.json5 create mode 100644 examples/40-generic-struct-methods/shed.json5 create mode 100644 examples/40-generic-struct-methods/src/HelloWorld.shed create mode 100644 examples/41-generic-struct-methods-this/shed-examples.json5 create mode 100644 examples/41-generic-struct-methods-this/shed.json5 create mode 100644 examples/41-generic-struct-methods-this/src/HelloWorld.shed delete mode 100644 examples/41-native-code/shed-examples.json5 delete mode 100644 examples/41-native-code/shed.json5 delete mode 100644 examples/41-native-code/src/False.shed create mode 100644 examples/42-native-code/shed-examples.json5 create mode 100644 examples/42-native-code/shed.json5 create mode 100644 examples/42-native-code/src/False.shed (limited to 'examples') diff --git a/examples/07-int-comparisons/shed-examples.json5 b/examples/07-int-comparisons/shed-examples.json5 new file mode 100644 index 00000000..aff2b74e --- /dev/null +++ b/examples/07-int-comparisons/shed-examples.json5 @@ -0,0 +1,21 @@ +{ + examples: [ + { + project: ".", + bin: "int-comparisons", + expectedOutput: "\ +1 < 2 true\n\ +1 < 1 false\n\ +2 < 1 false\n\ +1 <= 2 true\n\ +1 <= 1 true\n\ +2 <= 1 false\n\ +1 > 2 false\n\ +1 > 1 false\n\ +2 > 1 true\n\ +1 >= 2 false\n\ +1 >= 1 true\n\ +2 >= 1 true", + }, + ], +} diff --git a/examples/07-int-comparisons/shed.json5 b/examples/07-int-comparisons/shed.json5 new file mode 100644 index 00000000..074274c9 --- /dev/null +++ b/examples/07-int-comparisons/shed.json5 @@ -0,0 +1,8 @@ +{ + bins: [ + { + name: "int-comparisons", + mainNamespace: "IntComparisons", + }, + ], +} diff --git a/examples/07-int-comparisons/src/IntComparisons.shed b/examples/07-int-comparisons/src/IntComparisons.shed new file mode 100644 index 00000000..447315a9 --- /dev/null +++ b/examples/07-int-comparisons/src/IntComparisons.shed @@ -0,0 +1,24 @@ +pub fun main() ! Io -> Unit { + comparison!("1 < 2", 1 < 2); + comparison!("1 < 1", 1 < 1); + comparison!("2 < 1", 2 < 1); + + comparison!("1 <= 2", 1 <= 2); + comparison!("1 <= 1", 1 <= 1); + comparison!("2 <= 1", 2 <= 1); + + comparison!("1 > 2", 1 > 2); + comparison!("1 > 1", 1 > 1); + comparison!("2 > 1", 2 > 1); + + comparison!("1 >= 2", 1 >= 2); + comparison!("1 >= 1", 1 >= 1); + comparison!("2 >= 1", 2 >= 1); +} + +fun comparison(description: String, value: Bool) ! Io -> Unit { + print!(description); + print!(" "); + print!(if (value) { "true" } else { "false" }); + print!("\n"); +} diff --git a/examples/07-mutual-recursion/shed-examples.json5 b/examples/07-mutual-recursion/shed-examples.json5 deleted file mode 100644 index b25c64d7..00000000 --- a/examples/07-mutual-recursion/shed-examples.json5 +++ /dev/null @@ -1,9 +0,0 @@ -{ - examples: [ - { - project: ".", - bin: "mutual-recursion", - expectedOutput: "ababa", - }, - ], -} diff --git a/examples/07-mutual-recursion/shed.json5 b/examples/07-mutual-recursion/shed.json5 deleted file mode 100644 index 06ce05ca..00000000 --- a/examples/07-mutual-recursion/shed.json5 +++ /dev/null @@ -1,8 +0,0 @@ -{ - bins: [ - { - name: "mutual-recursion", - mainNamespace: "MutualRecursion", - }, - ], -} diff --git a/examples/07-mutual-recursion/src/MutualRecursion.shed b/examples/07-mutual-recursion/src/MutualRecursion.shed deleted file mode 100644 index e72a15fc..00000000 --- a/examples/07-mutual-recursion/src/MutualRecursion.shed +++ /dev/null @@ -1,20 +0,0 @@ -pub fun main() ! Io -> Unit { - val message = a(5); - print!(message); -} - -fun a(x: Int) -> String { - if (x == 0) { - "" - } else { - "a" + b(x - 1) - } -} - -fun b(x: Int) -> String { - if (x == 0) { - "" - } else { - "b" + a(x - 1) - } -} diff --git a/examples/08-blocks/shed-examples.json5 b/examples/08-blocks/shed-examples.json5 deleted file mode 100644 index 112b5b2e..00000000 --- a/examples/08-blocks/shed-examples.json5 +++ /dev/null @@ -1,9 +0,0 @@ -{ - examples: [ - { - project: ".", - bin: "counting", - expectedOutput: "count=one\ncount=two\ncount=many", - }, - ], -} diff --git a/examples/08-blocks/shed.json5 b/examples/08-blocks/shed.json5 deleted file mode 100644 index 68d4287c..00000000 --- a/examples/08-blocks/shed.json5 +++ /dev/null @@ -1,8 +0,0 @@ -{ - bins: [ - { - name: "counting", - mainNamespace: "Counting", - }, - ], -} diff --git a/examples/08-blocks/src/Counting.shed b/examples/08-blocks/src/Counting.shed deleted file mode 100644 index 79496448..00000000 --- a/examples/08-blocks/src/Counting.shed +++ /dev/null @@ -1,22 +0,0 @@ -fun message(count: Int) -> String { - val message = "count="; - - val message2 = if (count == 1) { - val message = "one\n"; - message - } else if (count == 2) { - val message = "two\n"; - message - } else { - val message = "many\n"; - message - }; - - message + message2 -} - -pub fun main() ! Io -> Unit { - print!(message(1)); - print!(message(2)); - print!(message(3)); -} diff --git a/examples/08-mutual-recursion/shed-examples.json5 b/examples/08-mutual-recursion/shed-examples.json5 new file mode 100644 index 00000000..b25c64d7 --- /dev/null +++ b/examples/08-mutual-recursion/shed-examples.json5 @@ -0,0 +1,9 @@ +{ + examples: [ + { + project: ".", + bin: "mutual-recursion", + expectedOutput: "ababa", + }, + ], +} diff --git a/examples/08-mutual-recursion/shed.json5 b/examples/08-mutual-recursion/shed.json5 new file mode 100644 index 00000000..06ce05ca --- /dev/null +++ b/examples/08-mutual-recursion/shed.json5 @@ -0,0 +1,8 @@ +{ + bins: [ + { + name: "mutual-recursion", + mainNamespace: "MutualRecursion", + }, + ], +} diff --git a/examples/08-mutual-recursion/src/MutualRecursion.shed b/examples/08-mutual-recursion/src/MutualRecursion.shed new file mode 100644 index 00000000..e72a15fc --- /dev/null +++ b/examples/08-mutual-recursion/src/MutualRecursion.shed @@ -0,0 +1,20 @@ +pub fun main() ! Io -> Unit { + val message = a(5); + print!(message); +} + +fun a(x: Int) -> String { + if (x == 0) { + "" + } else { + "a" + b(x - 1) + } +} + +fun b(x: Int) -> String { + if (x == 0) { + "" + } else { + "b" + a(x - 1) + } +} diff --git a/examples/09-blocks/shed-examples.json5 b/examples/09-blocks/shed-examples.json5 new file mode 100644 index 00000000..112b5b2e --- /dev/null +++ b/examples/09-blocks/shed-examples.json5 @@ -0,0 +1,9 @@ +{ + examples: [ + { + project: ".", + bin: "counting", + expectedOutput: "count=one\ncount=two\ncount=many", + }, + ], +} diff --git a/examples/09-blocks/shed.json5 b/examples/09-blocks/shed.json5 new file mode 100644 index 00000000..68d4287c --- /dev/null +++ b/examples/09-blocks/shed.json5 @@ -0,0 +1,8 @@ +{ + bins: [ + { + name: "counting", + mainNamespace: "Counting", + }, + ], +} diff --git a/examples/09-blocks/src/Counting.shed b/examples/09-blocks/src/Counting.shed new file mode 100644 index 00000000..79496448 --- /dev/null +++ b/examples/09-blocks/src/Counting.shed @@ -0,0 +1,22 @@ +fun message(count: Int) -> String { + val message = "count="; + + val message2 = if (count == 1) { + val message = "one\n"; + message + } else if (count == 2) { + val message = "two\n"; + message + } else { + val message = "many\n"; + message + }; + + message + message2 +} + +pub fun main() ! Io -> Unit { + print!(message(1)); + print!(message(2)); + print!(message(3)); +} diff --git a/examples/09-var/shed-examples.json5 b/examples/09-var/shed-examples.json5 deleted file mode 100644 index 531c665f..00000000 --- a/examples/09-var/shed-examples.json5 +++ /dev/null @@ -1,9 +0,0 @@ -{ - examples: [ - { - project: ".", - bin: "hello-world", - expectedOutput: "hello, world", - }, - ], -} diff --git a/examples/09-var/shed.json5 b/examples/09-var/shed.json5 deleted file mode 100644 index a6c8e563..00000000 --- a/examples/09-var/shed.json5 +++ /dev/null @@ -1,8 +0,0 @@ -{ - bins: [ - { - name: "hello-world", - mainNamespace: "HelloWorld", - }, - ], -} diff --git a/examples/09-var/src/HelloWorld.shed b/examples/09-var/src/HelloWorld.shed deleted file mode 100644 index a1bafbf2..00000000 --- a/examples/09-var/src/HelloWorld.shed +++ /dev/null @@ -1,5 +0,0 @@ -pub fun main() ! Io -> Unit { - var message = "hello, "; - assign message = message + "world\n"; - print!(message); -} diff --git a/examples/10-var/shed-examples.json5 b/examples/10-var/shed-examples.json5 new file mode 100644 index 00000000..531c665f --- /dev/null +++ b/examples/10-var/shed-examples.json5 @@ -0,0 +1,9 @@ +{ + examples: [ + { + project: ".", + bin: "hello-world", + expectedOutput: "hello, world", + }, + ], +} diff --git a/examples/10-var/shed.json5 b/examples/10-var/shed.json5 new file mode 100644 index 00000000..a6c8e563 --- /dev/null +++ b/examples/10-var/shed.json5 @@ -0,0 +1,8 @@ +{ + bins: [ + { + name: "hello-world", + mainNamespace: "HelloWorld", + }, + ], +} diff --git a/examples/10-var/src/HelloWorld.shed b/examples/10-var/src/HelloWorld.shed new file mode 100644 index 00000000..a1bafbf2 --- /dev/null +++ b/examples/10-var/src/HelloWorld.shed @@ -0,0 +1,5 @@ +pub fun main() ! Io -> Unit { + var message = "hello, "; + assign message = message + "world\n"; + print!(message); +} diff --git a/examples/10-while/shed-examples.json5 b/examples/10-while/shed-examples.json5 deleted file mode 100644 index 3ca518d7..00000000 --- a/examples/10-while/shed-examples.json5 +++ /dev/null @@ -1,9 +0,0 @@ -{ - examples: [ - { - project: ".", - bin: "counting", - expectedOutput: "one\ntwo\nmany", - }, - ], -} diff --git a/examples/10-while/shed.json5 b/examples/10-while/shed.json5 deleted file mode 100644 index 68d4287c..00000000 --- a/examples/10-while/shed.json5 +++ /dev/null @@ -1,8 +0,0 @@ -{ - bins: [ - { - name: "counting", - mainNamespace: "Counting", - }, - ], -} diff --git a/examples/10-while/src/Counting.shed b/examples/10-while/src/Counting.shed deleted file mode 100644 index aa95f536..00000000 --- a/examples/10-while/src/Counting.shed +++ /dev/null @@ -1,18 +0,0 @@ -fun message(count: Int) -> String { - if (count == 1) { - "one\n" - } else if (count == 2) { - "two\n" - } else { - "many\n" - } -} - -pub fun main() ! Io -> Unit { - var count = 1; - - while (count != 4) { - print!(message(count)); - assign count = count + 1; - } -} diff --git a/examples/11-tuples/shed-examples.json5 b/examples/11-tuples/shed-examples.json5 deleted file mode 100644 index 531c665f..00000000 --- a/examples/11-tuples/shed-examples.json5 +++ /dev/null @@ -1,9 +0,0 @@ -{ - examples: [ - { - project: ".", - bin: "hello-world", - expectedOutput: "hello, world", - }, - ], -} diff --git a/examples/11-tuples/shed.json5 b/examples/11-tuples/shed.json5 deleted file mode 100644 index a6c8e563..00000000 --- a/examples/11-tuples/shed.json5 +++ /dev/null @@ -1,8 +0,0 @@ -{ - bins: [ - { - name: "hello-world", - mainNamespace: "HelloWorld", - }, - ], -} diff --git a/examples/11-tuples/src/HelloWorld.shed b/examples/11-tuples/src/HelloWorld.shed deleted file mode 100644 index ba93f6b2..00000000 --- a/examples/11-tuples/src/HelloWorld.shed +++ /dev/null @@ -1,9 +0,0 @@ -pub fun main() ! Io -> Unit { - #(val part1, val part2) = messageParts(); - print!(part1); - print!(part2); -} - -fun messageParts() -> #(String, String) { - #("hello, ", "world\n") -} diff --git a/examples/11-while/shed-examples.json5 b/examples/11-while/shed-examples.json5 new file mode 100644 index 00000000..3ca518d7 --- /dev/null +++ b/examples/11-while/shed-examples.json5 @@ -0,0 +1,9 @@ +{ + examples: [ + { + project: ".", + bin: "counting", + expectedOutput: "one\ntwo\nmany", + }, + ], +} diff --git a/examples/11-while/shed.json5 b/examples/11-while/shed.json5 new file mode 100644 index 00000000..68d4287c --- /dev/null +++ b/examples/11-while/shed.json5 @@ -0,0 +1,8 @@ +{ + bins: [ + { + name: "counting", + mainNamespace: "Counting", + }, + ], +} diff --git a/examples/11-while/src/Counting.shed b/examples/11-while/src/Counting.shed new file mode 100644 index 00000000..aa95f536 --- /dev/null +++ b/examples/11-while/src/Counting.shed @@ -0,0 +1,18 @@ +fun message(count: Int) -> String { + if (count == 1) { + "one\n" + } else if (count == 2) { + "two\n" + } else { + "many\n" + } +} + +pub fun main() ! Io -> Unit { + var count = 1; + + while (count != 4) { + print!(message(count)); + assign count = count + 1; + } +} diff --git a/examples/12-named-args/shed-examples.json5 b/examples/12-named-args/shed-examples.json5 deleted file mode 100644 index 531c665f..00000000 --- a/examples/12-named-args/shed-examples.json5 +++ /dev/null @@ -1,9 +0,0 @@ -{ - examples: [ - { - project: ".", - bin: "hello-world", - expectedOutput: "hello, world", - }, - ], -} diff --git a/examples/12-named-args/shed.json5 b/examples/12-named-args/shed.json5 deleted file mode 100644 index a6c8e563..00000000 --- a/examples/12-named-args/shed.json5 +++ /dev/null @@ -1,8 +0,0 @@ -{ - bins: [ - { - name: "hello-world", - mainNamespace: "HelloWorld", - }, - ], -} diff --git a/examples/12-named-args/src/HelloWorld.shed b/examples/12-named-args/src/HelloWorld.shed deleted file mode 100644 index 411b1ab7..00000000 --- a/examples/12-named-args/src/HelloWorld.shed +++ /dev/null @@ -1,11 +0,0 @@ -pub fun main() ! Io -> Unit { - // Args not ordered by name, in different order from params. - printMessage!(.b = ", ", .a = "hello", .c = "world\n"); -} - -// Params not ordered by name, in different order from args. -fun printMessage(.a: String, .c: String, .b: String) ! Io -> Unit { - print!(a); - print!(b); - print!(c); -} diff --git a/examples/12-tuples/shed-examples.json5 b/examples/12-tuples/shed-examples.json5 new file mode 100644 index 00000000..531c665f --- /dev/null +++ b/examples/12-tuples/shed-examples.json5 @@ -0,0 +1,9 @@ +{ + examples: [ + { + project: ".", + bin: "hello-world", + expectedOutput: "hello, world", + }, + ], +} diff --git a/examples/12-tuples/shed.json5 b/examples/12-tuples/shed.json5 new file mode 100644 index 00000000..a6c8e563 --- /dev/null +++ b/examples/12-tuples/shed.json5 @@ -0,0 +1,8 @@ +{ + bins: [ + { + name: "hello-world", + mainNamespace: "HelloWorld", + }, + ], +} diff --git a/examples/12-tuples/src/HelloWorld.shed b/examples/12-tuples/src/HelloWorld.shed new file mode 100644 index 00000000..ba93f6b2 --- /dev/null +++ b/examples/12-tuples/src/HelloWorld.shed @@ -0,0 +1,9 @@ +pub fun main() ! Io -> Unit { + #(val part1, val part2) = messageParts(); + print!(part1); + print!(part2); +} + +fun messageParts() -> #(String, String) { + #("hello, ", "world\n") +} diff --git a/examples/13-named-args/shed-examples.json5 b/examples/13-named-args/shed-examples.json5 new file mode 100644 index 00000000..531c665f --- /dev/null +++ b/examples/13-named-args/shed-examples.json5 @@ -0,0 +1,9 @@ +{ + examples: [ + { + project: ".", + bin: "hello-world", + expectedOutput: "hello, world", + }, + ], +} diff --git a/examples/13-named-args/shed.json5 b/examples/13-named-args/shed.json5 new file mode 100644 index 00000000..a6c8e563 --- /dev/null +++ b/examples/13-named-args/shed.json5 @@ -0,0 +1,8 @@ +{ + bins: [ + { + name: "hello-world", + mainNamespace: "HelloWorld", + }, + ], +} diff --git a/examples/13-named-args/src/HelloWorld.shed b/examples/13-named-args/src/HelloWorld.shed new file mode 100644 index 00000000..411b1ab7 --- /dev/null +++ b/examples/13-named-args/src/HelloWorld.shed @@ -0,0 +1,11 @@ +pub fun main() ! Io -> Unit { + // Args not ordered by name, in different order from params. + printMessage!(.b = ", ", .a = "hello", .c = "world\n"); +} + +// Params not ordered by name, in different order from args. +fun printMessage(.a: String, .c: String, .b: String) ! Io -> Unit { + print!(a); + print!(b); + print!(c); +} diff --git a/examples/13-target-ignore/shed-examples.json5 b/examples/13-target-ignore/shed-examples.json5 deleted file mode 100644 index 531c665f..00000000 --- a/examples/13-target-ignore/shed-examples.json5 +++ /dev/null @@ -1,9 +0,0 @@ -{ - examples: [ - { - project: ".", - bin: "hello-world", - expectedOutput: "hello, world", - }, - ], -} diff --git a/examples/13-target-ignore/shed.json5 b/examples/13-target-ignore/shed.json5 deleted file mode 100644 index a6c8e563..00000000 --- a/examples/13-target-ignore/shed.json5 +++ /dev/null @@ -1,8 +0,0 @@ -{ - bins: [ - { - name: "hello-world", - mainNamespace: "HelloWorld", - }, - ], -} diff --git a/examples/13-target-ignore/src/HelloWorld.shed b/examples/13-target-ignore/src/HelloWorld.shed deleted file mode 100644 index 002dbd44..00000000 --- a/examples/13-target-ignore/src/HelloWorld.shed +++ /dev/null @@ -1,9 +0,0 @@ -pub fun main() ! Io -> Unit { - #(val part1, _, _, val part2) = messageParts(); - print!(part1); - print!(part2); -} - -fun messageParts() -> #(String, String, String, String) { - #("hello, ", "x", "y", "world\n") -} diff --git a/examples/14-structs/shed-examples.json5 b/examples/14-structs/shed-examples.json5 deleted file mode 100644 index 531c665f..00000000 --- a/examples/14-structs/shed-examples.json5 +++ /dev/null @@ -1,9 +0,0 @@ -{ - examples: [ - { - project: ".", - bin: "hello-world", - expectedOutput: "hello, world", - }, - ], -} diff --git a/examples/14-structs/shed.json5 b/examples/14-structs/shed.json5 deleted file mode 100644 index a6c8e563..00000000 --- a/examples/14-structs/shed.json5 +++ /dev/null @@ -1,8 +0,0 @@ -{ - bins: [ - { - name: "hello-world", - mainNamespace: "HelloWorld", - }, - ], -} diff --git a/examples/14-structs/src/HelloWorld.shed b/examples/14-structs/src/HelloWorld.shed deleted file mode 100644 index 94d2cfa4..00000000 --- a/examples/14-structs/src/HelloWorld.shed +++ /dev/null @@ -1,15 +0,0 @@ -pub fun main() ! Io -> Unit { - val messageParts = getMessageParts(); - print!(messageParts.part1); - print!(messageParts.part2); -} - -struct MessageParts( - .part1: String, - .part2: String, -) { -} - -fun getMessageParts() -> MessageParts { - MessageParts(.part1 = "hello, ", .part2 = "world\n") -} diff --git a/examples/14-target-ignore/shed-examples.json5 b/examples/14-target-ignore/shed-examples.json5 new file mode 100644 index 00000000..531c665f --- /dev/null +++ b/examples/14-target-ignore/shed-examples.json5 @@ -0,0 +1,9 @@ +{ + examples: [ + { + project: ".", + bin: "hello-world", + expectedOutput: "hello, world", + }, + ], +} diff --git a/examples/14-target-ignore/shed.json5 b/examples/14-target-ignore/shed.json5 new file mode 100644 index 00000000..a6c8e563 --- /dev/null +++ b/examples/14-target-ignore/shed.json5 @@ -0,0 +1,8 @@ +{ + bins: [ + { + name: "hello-world", + mainNamespace: "HelloWorld", + }, + ], +} diff --git a/examples/14-target-ignore/src/HelloWorld.shed b/examples/14-target-ignore/src/HelloWorld.shed new file mode 100644 index 00000000..002dbd44 --- /dev/null +++ b/examples/14-target-ignore/src/HelloWorld.shed @@ -0,0 +1,9 @@ +pub fun main() ! Io -> Unit { + #(val part1, _, _, val part2) = messageParts(); + print!(part1); + print!(part2); +} + +fun messageParts() -> #(String, String, String, String) { + #("hello, ", "x", "y", "world\n") +} diff --git a/examples/15-struct-hoisting/shed-examples.json5 b/examples/15-struct-hoisting/shed-examples.json5 deleted file mode 100644 index 531c665f..00000000 --- a/examples/15-struct-hoisting/shed-examples.json5 +++ /dev/null @@ -1,9 +0,0 @@ -{ - examples: [ - { - project: ".", - bin: "hello-world", - expectedOutput: "hello, world", - }, - ], -} diff --git a/examples/15-struct-hoisting/shed.json5 b/examples/15-struct-hoisting/shed.json5 deleted file mode 100644 index a6c8e563..00000000 --- a/examples/15-struct-hoisting/shed.json5 +++ /dev/null @@ -1,8 +0,0 @@ -{ - bins: [ - { - name: "hello-world", - mainNamespace: "HelloWorld", - }, - ], -} diff --git a/examples/15-struct-hoisting/src/HelloWorld.shed b/examples/15-struct-hoisting/src/HelloWorld.shed deleted file mode 100644 index 5cb6c2e2..00000000 --- a/examples/15-struct-hoisting/src/HelloWorld.shed +++ /dev/null @@ -1,12 +0,0 @@ -val messageParts = MessageParts(.part1 = "hello, ", .part2 = "world\n"); - -pub fun main() ! Io -> Unit { - print!(messageParts.part1); - print!(messageParts.part2); -} - -struct MessageParts( - .part1: String, - .part2: String, -) { -} diff --git a/examples/15-structs/shed-examples.json5 b/examples/15-structs/shed-examples.json5 new file mode 100644 index 00000000..531c665f --- /dev/null +++ b/examples/15-structs/shed-examples.json5 @@ -0,0 +1,9 @@ +{ + examples: [ + { + project: ".", + bin: "hello-world", + expectedOutput: "hello, world", + }, + ], +} diff --git a/examples/15-structs/shed.json5 b/examples/15-structs/shed.json5 new file mode 100644 index 00000000..a6c8e563 --- /dev/null +++ b/examples/15-structs/shed.json5 @@ -0,0 +1,8 @@ +{ + bins: [ + { + name: "hello-world", + mainNamespace: "HelloWorld", + }, + ], +} diff --git a/examples/15-structs/src/HelloWorld.shed b/examples/15-structs/src/HelloWorld.shed new file mode 100644 index 00000000..94d2cfa4 --- /dev/null +++ b/examples/15-structs/src/HelloWorld.shed @@ -0,0 +1,15 @@ +pub fun main() ! Io -> Unit { + val messageParts = getMessageParts(); + print!(messageParts.part1); + print!(messageParts.part2); +} + +struct MessageParts( + .part1: String, + .part2: String, +) { +} + +fun getMessageParts() -> MessageParts { + MessageParts(.part1 = "hello, ", .part2 = "world\n") +} diff --git a/examples/16-struct-hoisting/shed-examples.json5 b/examples/16-struct-hoisting/shed-examples.json5 new file mode 100644 index 00000000..531c665f --- /dev/null +++ b/examples/16-struct-hoisting/shed-examples.json5 @@ -0,0 +1,9 @@ +{ + examples: [ + { + project: ".", + bin: "hello-world", + expectedOutput: "hello, world", + }, + ], +} diff --git a/examples/16-struct-hoisting/shed.json5 b/examples/16-struct-hoisting/shed.json5 new file mode 100644 index 00000000..a6c8e563 --- /dev/null +++ b/examples/16-struct-hoisting/shed.json5 @@ -0,0 +1,8 @@ +{ + bins: [ + { + name: "hello-world", + mainNamespace: "HelloWorld", + }, + ], +} diff --git a/examples/16-struct-hoisting/src/HelloWorld.shed b/examples/16-struct-hoisting/src/HelloWorld.shed new file mode 100644 index 00000000..5cb6c2e2 --- /dev/null +++ b/examples/16-struct-hoisting/src/HelloWorld.shed @@ -0,0 +1,12 @@ +val messageParts = MessageParts(.part1 = "hello, ", .part2 = "world\n"); + +pub fun main() ! Io -> Unit { + print!(messageParts.part1); + print!(messageParts.part2); +} + +struct MessageParts( + .part1: String, + .part2: String, +) { +} diff --git a/examples/16-struct-positional-fields/shed-examples.json5 b/examples/16-struct-positional-fields/shed-examples.json5 deleted file mode 100644 index 531c665f..00000000 --- a/examples/16-struct-positional-fields/shed-examples.json5 +++ /dev/null @@ -1,9 +0,0 @@ -{ - examples: [ - { - project: ".", - bin: "hello-world", - expectedOutput: "hello, world", - }, - ], -} diff --git a/examples/16-struct-positional-fields/shed.json5 b/examples/16-struct-positional-fields/shed.json5 deleted file mode 100644 index a6c8e563..00000000 --- a/examples/16-struct-positional-fields/shed.json5 +++ /dev/null @@ -1,8 +0,0 @@ -{ - bins: [ - { - name: "hello-world", - mainNamespace: "HelloWorld", - }, - ], -} diff --git a/examples/16-struct-positional-fields/src/HelloWorld.shed b/examples/16-struct-positional-fields/src/HelloWorld.shed deleted file mode 100644 index 8880c7e2..00000000 --- a/examples/16-struct-positional-fields/src/HelloWorld.shed +++ /dev/null @@ -1,17 +0,0 @@ -pub fun main() ! Io -> Unit { - val messageParts = getMessageParts(); - print!(messageParts.part1); - print!(messageParts.part2); -} - -// We put part2 before part1 so that the order of args differs from the lexical -// field order. -struct MessageParts( - part2: String, - part1: String, -) { -} - -fun getMessageParts() -> MessageParts { - MessageParts("world\n", "hello, ") -} diff --git a/examples/17-struct-positional-fields/shed-examples.json5 b/examples/17-struct-positional-fields/shed-examples.json5 new file mode 100644 index 00000000..531c665f --- /dev/null +++ b/examples/17-struct-positional-fields/shed-examples.json5 @@ -0,0 +1,9 @@ +{ + examples: [ + { + project: ".", + bin: "hello-world", + expectedOutput: "hello, world", + }, + ], +} diff --git a/examples/17-struct-positional-fields/shed.json5 b/examples/17-struct-positional-fields/shed.json5 new file mode 100644 index 00000000..a6c8e563 --- /dev/null +++ b/examples/17-struct-positional-fields/shed.json5 @@ -0,0 +1,8 @@ +{ + bins: [ + { + name: "hello-world", + mainNamespace: "HelloWorld", + }, + ], +} diff --git a/examples/17-struct-positional-fields/src/HelloWorld.shed b/examples/17-struct-positional-fields/src/HelloWorld.shed new file mode 100644 index 00000000..8880c7e2 --- /dev/null +++ b/examples/17-struct-positional-fields/src/HelloWorld.shed @@ -0,0 +1,17 @@ +pub fun main() ! Io -> Unit { + val messageParts = getMessageParts(); + print!(messageParts.part1); + print!(messageParts.part2); +} + +// We put part2 before part1 so that the order of args differs from the lexical +// field order. +struct MessageParts( + part2: String, + part1: String, +) { +} + +fun getMessageParts() -> MessageParts { + MessageParts("world\n", "hello, ") +} diff --git a/examples/17-sums/shed-examples.json5 b/examples/17-sums/shed-examples.json5 deleted file mode 100644 index 4a4b2b7c..00000000 --- a/examples/17-sums/shed-examples.json5 +++ /dev/null @@ -1,9 +0,0 @@ -{ - examples: [ - { - project: ".", - bin: "hello-world", - expectedOutput: "Some(hello, world!)\nNone", - }, - ], -} diff --git a/examples/17-sums/shed.json5 b/examples/17-sums/shed.json5 deleted file mode 100644 index a6c8e563..00000000 --- a/examples/17-sums/shed.json5 +++ /dev/null @@ -1,8 +0,0 @@ -{ - bins: [ - { - name: "hello-world", - mainNamespace: "HelloWorld", - }, - ], -} diff --git a/examples/17-sums/src/HelloWorld.shed b/examples/17-sums/src/HelloWorld.shed deleted file mode 100644 index 435353bc..00000000 --- a/examples/17-sums/src/HelloWorld.shed +++ /dev/null @@ -1,23 +0,0 @@ -struct Some(value: String) {} - -struct None() {} - -sumtype Option = Some | None; - -pub fun main() ! Io -> Unit { - printOption!(Some("hello, world!")); - printOption!(None()); -} - -fun printOption(option: Option) !Io -> Unit { - when (option) { - is Some { - print!("Some("); - print!(option.value); - print!(")\n"); - } - is None { - print!("None\n"); - } - } -} diff --git a/examples/18-import-same-project/shed-examples.json5 b/examples/18-import-same-project/shed-examples.json5 deleted file mode 100644 index 531c665f..00000000 --- a/examples/18-import-same-project/shed-examples.json5 +++ /dev/null @@ -1,9 +0,0 @@ -{ - examples: [ - { - project: ".", - bin: "hello-world", - expectedOutput: "hello, world", - }, - ], -} diff --git a/examples/18-import-same-project/shed.json5 b/examples/18-import-same-project/shed.json5 deleted file mode 100644 index a6c8e563..00000000 --- a/examples/18-import-same-project/shed.json5 +++ /dev/null @@ -1,8 +0,0 @@ -{ - bins: [ - { - name: "hello-world", - mainNamespace: "HelloWorld", - }, - ], -} diff --git a/examples/18-import-same-project/src/HelloWorld.shed b/examples/18-import-same-project/src/HelloWorld.shed deleted file mode 100644 index 8cebf604..00000000 --- a/examples/18-import-same-project/src/HelloWorld.shed +++ /dev/null @@ -1,5 +0,0 @@ -import Message; - -pub fun main() ! Io -> Unit { - print!(Message.message); -} diff --git a/examples/18-import-same-project/src/Message.shed b/examples/18-import-same-project/src/Message.shed deleted file mode 100644 index db03110a..00000000 --- a/examples/18-import-same-project/src/Message.shed +++ /dev/null @@ -1 +0,0 @@ -pub val message = "hello, world\n"; diff --git a/examples/18-sums/shed-examples.json5 b/examples/18-sums/shed-examples.json5 new file mode 100644 index 00000000..4a4b2b7c --- /dev/null +++ b/examples/18-sums/shed-examples.json5 @@ -0,0 +1,9 @@ +{ + examples: [ + { + project: ".", + bin: "hello-world", + expectedOutput: "Some(hello, world!)\nNone", + }, + ], +} diff --git a/examples/18-sums/shed.json5 b/examples/18-sums/shed.json5 new file mode 100644 index 00000000..a6c8e563 --- /dev/null +++ b/examples/18-sums/shed.json5 @@ -0,0 +1,8 @@ +{ + bins: [ + { + name: "hello-world", + mainNamespace: "HelloWorld", + }, + ], +} diff --git a/examples/18-sums/src/HelloWorld.shed b/examples/18-sums/src/HelloWorld.shed new file mode 100644 index 00000000..435353bc --- /dev/null +++ b/examples/18-sums/src/HelloWorld.shed @@ -0,0 +1,23 @@ +struct Some(value: String) {} + +struct None() {} + +sumtype Option = Some | None; + +pub fun main() ! Io -> Unit { + printOption!(Some("hello, world!")); + printOption!(None()); +} + +fun printOption(option: Option) !Io -> Unit { + when (option) { + is Some { + print!("Some("); + print!(option.value); + print!(")\n"); + } + is None { + print!("None\n"); + } + } +} diff --git a/examples/19-import-different-project/hello-world/.gitignore b/examples/19-import-different-project/hello-world/.gitignore deleted file mode 100644 index ea8c4bf7..00000000 --- a/examples/19-import-different-project/hello-world/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/target diff --git a/examples/19-import-different-project/hello-world/shed.json5 b/examples/19-import-different-project/hello-world/shed.json5 deleted file mode 100644 index 7e126ef5..00000000 --- a/examples/19-import-different-project/hello-world/shed.json5 +++ /dev/null @@ -1,13 +0,0 @@ -{ - bins: [ - { - name: "hello-world", - mainNamespace: "HelloWorld", - }, - ], - dependencies: [ - { - path: "../message" - } - ], -} diff --git a/examples/19-import-different-project/hello-world/src/HelloWorld.shed b/examples/19-import-different-project/hello-world/src/HelloWorld.shed deleted file mode 100644 index 8cebf604..00000000 --- a/examples/19-import-different-project/hello-world/src/HelloWorld.shed +++ /dev/null @@ -1,5 +0,0 @@ -import Message; - -pub fun main() ! Io -> Unit { - print!(Message.message); -} diff --git a/examples/19-import-different-project/message/shed.json5 b/examples/19-import-different-project/message/shed.json5 deleted file mode 100644 index 2c63c085..00000000 --- a/examples/19-import-different-project/message/shed.json5 +++ /dev/null @@ -1,2 +0,0 @@ -{ -} diff --git a/examples/19-import-different-project/message/src/Message.shed b/examples/19-import-different-project/message/src/Message.shed deleted file mode 100644 index db03110a..00000000 --- a/examples/19-import-different-project/message/src/Message.shed +++ /dev/null @@ -1 +0,0 @@ -pub val message = "hello, world\n"; diff --git a/examples/19-import-different-project/shed-examples.json5 b/examples/19-import-different-project/shed-examples.json5 deleted file mode 100644 index 64a897eb..00000000 --- a/examples/19-import-different-project/shed-examples.json5 +++ /dev/null @@ -1,9 +0,0 @@ -{ - examples: [ - { - project: "./hello-world", - bin: "hello-world", - expectedOutput: "hello, world", - }, - ], -} diff --git a/examples/19-import-same-project/shed-examples.json5 b/examples/19-import-same-project/shed-examples.json5 new file mode 100644 index 00000000..531c665f --- /dev/null +++ b/examples/19-import-same-project/shed-examples.json5 @@ -0,0 +1,9 @@ +{ + examples: [ + { + project: ".", + bin: "hello-world", + expectedOutput: "hello, world", + }, + ], +} diff --git a/examples/19-import-same-project/shed.json5 b/examples/19-import-same-project/shed.json5 new file mode 100644 index 00000000..a6c8e563 --- /dev/null +++ b/examples/19-import-same-project/shed.json5 @@ -0,0 +1,8 @@ +{ + bins: [ + { + name: "hello-world", + mainNamespace: "HelloWorld", + }, + ], +} diff --git a/examples/19-import-same-project/src/HelloWorld.shed b/examples/19-import-same-project/src/HelloWorld.shed new file mode 100644 index 00000000..8cebf604 --- /dev/null +++ b/examples/19-import-same-project/src/HelloWorld.shed @@ -0,0 +1,5 @@ +import Message; + +pub fun main() ! Io -> Unit { + print!(Message.message); +} diff --git a/examples/19-import-same-project/src/Message.shed b/examples/19-import-same-project/src/Message.shed new file mode 100644 index 00000000..db03110a --- /dev/null +++ b/examples/19-import-same-project/src/Message.shed @@ -0,0 +1 @@ +pub val message = "hello, world\n"; diff --git a/examples/20-import-different-project/hello-world/.gitignore b/examples/20-import-different-project/hello-world/.gitignore new file mode 100644 index 00000000..ea8c4bf7 --- /dev/null +++ b/examples/20-import-different-project/hello-world/.gitignore @@ -0,0 +1 @@ +/target diff --git a/examples/20-import-different-project/hello-world/shed.json5 b/examples/20-import-different-project/hello-world/shed.json5 new file mode 100644 index 00000000..7e126ef5 --- /dev/null +++ b/examples/20-import-different-project/hello-world/shed.json5 @@ -0,0 +1,13 @@ +{ + bins: [ + { + name: "hello-world", + mainNamespace: "HelloWorld", + }, + ], + dependencies: [ + { + path: "../message" + } + ], +} diff --git a/examples/20-import-different-project/hello-world/src/HelloWorld.shed b/examples/20-import-different-project/hello-world/src/HelloWorld.shed new file mode 100644 index 00000000..8cebf604 --- /dev/null +++ b/examples/20-import-different-project/hello-world/src/HelloWorld.shed @@ -0,0 +1,5 @@ +import Message; + +pub fun main() ! Io -> Unit { + print!(Message.message); +} diff --git a/examples/20-import-different-project/message/shed.json5 b/examples/20-import-different-project/message/shed.json5 new file mode 100644 index 00000000..2c63c085 --- /dev/null +++ b/examples/20-import-different-project/message/shed.json5 @@ -0,0 +1,2 @@ +{ +} diff --git a/examples/20-import-different-project/message/src/Message.shed b/examples/20-import-different-project/message/src/Message.shed new file mode 100644 index 00000000..db03110a --- /dev/null +++ b/examples/20-import-different-project/message/src/Message.shed @@ -0,0 +1 @@ +pub val message = "hello, world\n"; diff --git a/examples/20-import-different-project/shed-examples.json5 b/examples/20-import-different-project/shed-examples.json5 new file mode 100644 index 00000000..64a897eb --- /dev/null +++ b/examples/20-import-different-project/shed-examples.json5 @@ -0,0 +1,9 @@ +{ + examples: [ + { + project: "./hello-world", + bin: "hello-world", + expectedOutput: "hello, world", + }, + ], +} diff --git a/examples/20-import-recursive-dependency/hello-world/.gitignore b/examples/20-import-recursive-dependency/hello-world/.gitignore deleted file mode 100644 index ea8c4bf7..00000000 --- a/examples/20-import-recursive-dependency/hello-world/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/target diff --git a/examples/20-import-recursive-dependency/hello-world/shed.json5 b/examples/20-import-recursive-dependency/hello-world/shed.json5 deleted file mode 100644 index fad540d8..00000000 --- a/examples/20-import-recursive-dependency/hello-world/shed.json5 +++ /dev/null @@ -1,13 +0,0 @@ -{ - bins: [ - { - name: "hello-world", - mainNamespace: "HelloWorld", - }, - ], - dependencies: [ - { - path: "../message1" - } - ], -} diff --git a/examples/20-import-recursive-dependency/hello-world/src/HelloWorld.shed b/examples/20-import-recursive-dependency/hello-world/src/HelloWorld.shed deleted file mode 100644 index f63849d4..00000000 --- a/examples/20-import-recursive-dependency/hello-world/src/HelloWorld.shed +++ /dev/null @@ -1,5 +0,0 @@ -import Message1; - -pub fun main() ! Io -> Unit { - print!(Message1.message); -} diff --git a/examples/20-import-recursive-dependency/message1/shed.json5 b/examples/20-import-recursive-dependency/message1/shed.json5 deleted file mode 100644 index 1faaf200..00000000 --- a/examples/20-import-recursive-dependency/message1/shed.json5 +++ /dev/null @@ -1,7 +0,0 @@ -{ - dependencies: [ - { - path: "../message2" - } - ] -} diff --git a/examples/20-import-recursive-dependency/message1/src/Message1.shed b/examples/20-import-recursive-dependency/message1/src/Message1.shed deleted file mode 100644 index aa497683..00000000 --- a/examples/20-import-recursive-dependency/message1/src/Message1.shed +++ /dev/null @@ -1,3 +0,0 @@ -import Message2; - -pub val message = Message2.message; diff --git a/examples/20-import-recursive-dependency/message2/shed.json5 b/examples/20-import-recursive-dependency/message2/shed.json5 deleted file mode 100644 index 2c63c085..00000000 --- a/examples/20-import-recursive-dependency/message2/shed.json5 +++ /dev/null @@ -1,2 +0,0 @@ -{ -} diff --git a/examples/20-import-recursive-dependency/message2/src/Message2.shed b/examples/20-import-recursive-dependency/message2/src/Message2.shed deleted file mode 100644 index db03110a..00000000 --- a/examples/20-import-recursive-dependency/message2/src/Message2.shed +++ /dev/null @@ -1 +0,0 @@ -pub val message = "hello, world\n"; diff --git a/examples/20-import-recursive-dependency/shed-examples.json5 b/examples/20-import-recursive-dependency/shed-examples.json5 deleted file mode 100644 index 64a897eb..00000000 --- a/examples/20-import-recursive-dependency/shed-examples.json5 +++ /dev/null @@ -1,9 +0,0 @@ -{ - examples: [ - { - project: "./hello-world", - bin: "hello-world", - expectedOutput: "hello, world", - }, - ], -} diff --git a/examples/21-function-expression/shed-examples.json5 b/examples/21-function-expression/shed-examples.json5 deleted file mode 100644 index 531c665f..00000000 --- a/examples/21-function-expression/shed-examples.json5 +++ /dev/null @@ -1,9 +0,0 @@ -{ - examples: [ - { - project: ".", - bin: "hello-world", - expectedOutput: "hello, world", - }, - ], -} diff --git a/examples/21-function-expression/shed.json5 b/examples/21-function-expression/shed.json5 deleted file mode 100644 index a6c8e563..00000000 --- a/examples/21-function-expression/shed.json5 +++ /dev/null @@ -1,8 +0,0 @@ -{ - bins: [ - { - name: "hello-world", - mainNamespace: "HelloWorld", - }, - ], -} diff --git a/examples/21-function-expression/src/HelloWorld.shed b/examples/21-function-expression/src/HelloWorld.shed deleted file mode 100644 index 1ebb2863..00000000 --- a/examples/21-function-expression/src/HelloWorld.shed +++ /dev/null @@ -1,11 +0,0 @@ -fun printer(left: String) -> fn (String) ! Io -> Unit { - fn (right: String) !Io -> Unit { - print!(left); - print!(right); - } -} - -pub fun main() ! Io -> Unit { - printer("hello")!(", "); - printer("world")!("\n"); -} diff --git a/examples/21-import-recursive-dependency/hello-world/.gitignore b/examples/21-import-recursive-dependency/hello-world/.gitignore new file mode 100644 index 00000000..ea8c4bf7 --- /dev/null +++ b/examples/21-import-recursive-dependency/hello-world/.gitignore @@ -0,0 +1 @@ +/target diff --git a/examples/21-import-recursive-dependency/hello-world/shed.json5 b/examples/21-import-recursive-dependency/hello-world/shed.json5 new file mode 100644 index 00000000..fad540d8 --- /dev/null +++ b/examples/21-import-recursive-dependency/hello-world/shed.json5 @@ -0,0 +1,13 @@ +{ + bins: [ + { + name: "hello-world", + mainNamespace: "HelloWorld", + }, + ], + dependencies: [ + { + path: "../message1" + } + ], +} diff --git a/examples/21-import-recursive-dependency/hello-world/src/HelloWorld.shed b/examples/21-import-recursive-dependency/hello-world/src/HelloWorld.shed new file mode 100644 index 00000000..f63849d4 --- /dev/null +++ b/examples/21-import-recursive-dependency/hello-world/src/HelloWorld.shed @@ -0,0 +1,5 @@ +import Message1; + +pub fun main() ! Io -> Unit { + print!(Message1.message); +} diff --git a/examples/21-import-recursive-dependency/message1/shed.json5 b/examples/21-import-recursive-dependency/message1/shed.json5 new file mode 100644 index 00000000..1faaf200 --- /dev/null +++ b/examples/21-import-recursive-dependency/message1/shed.json5 @@ -0,0 +1,7 @@ +{ + dependencies: [ + { + path: "../message2" + } + ] +} diff --git a/examples/21-import-recursive-dependency/message1/src/Message1.shed b/examples/21-import-recursive-dependency/message1/src/Message1.shed new file mode 100644 index 00000000..aa497683 --- /dev/null +++ b/examples/21-import-recursive-dependency/message1/src/Message1.shed @@ -0,0 +1,3 @@ +import Message2; + +pub val message = Message2.message; diff --git a/examples/21-import-recursive-dependency/message2/shed.json5 b/examples/21-import-recursive-dependency/message2/shed.json5 new file mode 100644 index 00000000..2c63c085 --- /dev/null +++ b/examples/21-import-recursive-dependency/message2/shed.json5 @@ -0,0 +1,2 @@ +{ +} diff --git a/examples/21-import-recursive-dependency/message2/src/Message2.shed b/examples/21-import-recursive-dependency/message2/src/Message2.shed new file mode 100644 index 00000000..db03110a --- /dev/null +++ b/examples/21-import-recursive-dependency/message2/src/Message2.shed @@ -0,0 +1 @@ +pub val message = "hello, world\n"; diff --git a/examples/21-import-recursive-dependency/shed-examples.json5 b/examples/21-import-recursive-dependency/shed-examples.json5 new file mode 100644 index 00000000..64a897eb --- /dev/null +++ b/examples/21-import-recursive-dependency/shed-examples.json5 @@ -0,0 +1,9 @@ +{ + examples: [ + { + project: "./hello-world", + bin: "hello-world", + expectedOutput: "hello, world", + }, + ], +} diff --git a/examples/22-function-expression-infer-return-type/shed-examples.json5 b/examples/22-function-expression-infer-return-type/shed-examples.json5 deleted file mode 100644 index 531c665f..00000000 --- a/examples/22-function-expression-infer-return-type/shed-examples.json5 +++ /dev/null @@ -1,9 +0,0 @@ -{ - examples: [ - { - project: ".", - bin: "hello-world", - expectedOutput: "hello, world", - }, - ], -} diff --git a/examples/22-function-expression-infer-return-type/shed.json5 b/examples/22-function-expression-infer-return-type/shed.json5 deleted file mode 100644 index a6c8e563..00000000 --- a/examples/22-function-expression-infer-return-type/shed.json5 +++ /dev/null @@ -1,8 +0,0 @@ -{ - bins: [ - { - name: "hello-world", - mainNamespace: "HelloWorld", - }, - ], -} diff --git a/examples/22-function-expression-infer-return-type/src/HelloWorld.shed b/examples/22-function-expression-infer-return-type/src/HelloWorld.shed deleted file mode 100644 index 1c93c946..00000000 --- a/examples/22-function-expression-infer-return-type/src/HelloWorld.shed +++ /dev/null @@ -1,4 +0,0 @@ -pub fun main() ! Io -> Unit { - val message = fn () { "hello, world\n" }; - print!(message()); -} diff --git a/examples/22-function-expression/shed-examples.json5 b/examples/22-function-expression/shed-examples.json5 new file mode 100644 index 00000000..531c665f --- /dev/null +++ b/examples/22-function-expression/shed-examples.json5 @@ -0,0 +1,9 @@ +{ + examples: [ + { + project: ".", + bin: "hello-world", + expectedOutput: "hello, world", + }, + ], +} diff --git a/examples/22-function-expression/shed.json5 b/examples/22-function-expression/shed.json5 new file mode 100644 index 00000000..a6c8e563 --- /dev/null +++ b/examples/22-function-expression/shed.json5 @@ -0,0 +1,8 @@ +{ + bins: [ + { + name: "hello-world", + mainNamespace: "HelloWorld", + }, + ], +} diff --git a/examples/22-function-expression/src/HelloWorld.shed b/examples/22-function-expression/src/HelloWorld.shed new file mode 100644 index 00000000..1ebb2863 --- /dev/null +++ b/examples/22-function-expression/src/HelloWorld.shed @@ -0,0 +1,11 @@ +fun printer(left: String) -> fn (String) ! Io -> Unit { + fn (right: String) !Io -> Unit { + print!(left); + print!(right); + } +} + +pub fun main() ! Io -> Unit { + printer("hello")!(", "); + printer("world")!("\n"); +} diff --git a/examples/23-function-expression-infer-param-type/shed-examples.json5 b/examples/23-function-expression-infer-param-type/shed-examples.json5 deleted file mode 100644 index 81fa6d68..00000000 --- a/examples/23-function-expression-infer-param-type/shed-examples.json5 +++ /dev/null @@ -1,9 +0,0 @@ -{ - examples: [ - { - project: ".", - bin: "hello-world", - expectedOutput: "hello, world\nworld, hello", - }, - ], -} diff --git a/examples/23-function-expression-infer-param-type/shed.json5 b/examples/23-function-expression-infer-param-type/shed.json5 deleted file mode 100644 index a6c8e563..00000000 --- a/examples/23-function-expression-infer-param-type/shed.json5 +++ /dev/null @@ -1,8 +0,0 @@ -{ - bins: [ - { - name: "hello-world", - mainNamespace: "HelloWorld", - }, - ], -} diff --git a/examples/23-function-expression-infer-param-type/src/HelloWorld.shed b/examples/23-function-expression-infer-param-type/src/HelloWorld.shed deleted file mode 100644 index e91bc5e0..00000000 --- a/examples/23-function-expression-infer-param-type/src/HelloWorld.shed +++ /dev/null @@ -1,8 +0,0 @@ -pub fun main() ! Io -> Unit { - printHelloWorld!(fn (left, right) { left + ", " + right + "\n" }); - printHelloWorld!(fn (left, right) { right + ", " + left + "\n" }) -} - -fun printHelloWorld(combine: fn (String, String) -> String) !Io -> Unit { - print!(combine("hello", "world")); -} diff --git a/examples/23-function-expression-infer-return-type/shed-examples.json5 b/examples/23-function-expression-infer-return-type/shed-examples.json5 new file mode 100644 index 00000000..531c665f --- /dev/null +++ b/examples/23-function-expression-infer-return-type/shed-examples.json5 @@ -0,0 +1,9 @@ +{ + examples: [ + { + project: ".", + bin: "hello-world", + expectedOutput: "hello, world", + }, + ], +} diff --git a/examples/23-function-expression-infer-return-type/shed.json5 b/examples/23-function-expression-infer-return-type/shed.json5 new file mode 100644 index 00000000..a6c8e563 --- /dev/null +++ b/examples/23-function-expression-infer-return-type/shed.json5 @@ -0,0 +1,8 @@ +{ + bins: [ + { + name: "hello-world", + mainNamespace: "HelloWorld", + }, + ], +} diff --git a/examples/23-function-expression-infer-return-type/src/HelloWorld.shed b/examples/23-function-expression-infer-return-type/src/HelloWorld.shed new file mode 100644 index 00000000..1c93c946 --- /dev/null +++ b/examples/23-function-expression-infer-return-type/src/HelloWorld.shed @@ -0,0 +1,4 @@ +pub fun main() ! Io -> Unit { + val message = fn () { "hello, world\n" }; + print!(message()); +} diff --git a/examples/24-effect-resume/shed-examples.json5 b/examples/24-effect-resume/shed-examples.json5 deleted file mode 100644 index 531c665f..00000000 --- a/examples/24-effect-resume/shed-examples.json5 +++ /dev/null @@ -1,9 +0,0 @@ -{ - examples: [ - { - project: ".", - bin: "hello-world", - expectedOutput: "hello, world", - }, - ], -} diff --git a/examples/24-effect-resume/shed.json5 b/examples/24-effect-resume/shed.json5 deleted file mode 100644 index a6c8e563..00000000 --- a/examples/24-effect-resume/shed.json5 +++ /dev/null @@ -1,8 +0,0 @@ -{ - bins: [ - { - name: "hello-world", - mainNamespace: "HelloWorld", - }, - ], -} diff --git a/examples/24-effect-resume/src/HelloWorld.shed b/examples/24-effect-resume/src/HelloWorld.shed deleted file mode 100644 index a5e96e2f..00000000 --- a/examples/24-effect-resume/src/HelloWorld.shed +++ /dev/null @@ -1,23 +0,0 @@ -effect Writer { - fun hello() -> Unit; - fun world() -> Unit; -} - -pub fun main() ! Io -> Unit { - try { - Writer.hello!(); - print!(", "); - Writer.world!(); - print!("\n"); - } handle Writer { - fun hello() { - print!("hello"); - resume; - } - - fun world() { - print!("world"); - resume; - } - } -} diff --git a/examples/24-function-expression-infer-param-type/shed-examples.json5 b/examples/24-function-expression-infer-param-type/shed-examples.json5 new file mode 100644 index 00000000..81fa6d68 --- /dev/null +++ b/examples/24-function-expression-infer-param-type/shed-examples.json5 @@ -0,0 +1,9 @@ +{ + examples: [ + { + project: ".", + bin: "hello-world", + expectedOutput: "hello, world\nworld, hello", + }, + ], +} diff --git a/examples/24-function-expression-infer-param-type/shed.json5 b/examples/24-function-expression-infer-param-type/shed.json5 new file mode 100644 index 00000000..a6c8e563 --- /dev/null +++ b/examples/24-function-expression-infer-param-type/shed.json5 @@ -0,0 +1,8 @@ +{ + bins: [ + { + name: "hello-world", + mainNamespace: "HelloWorld", + }, + ], +} diff --git a/examples/24-function-expression-infer-param-type/src/HelloWorld.shed b/examples/24-function-expression-infer-param-type/src/HelloWorld.shed new file mode 100644 index 00000000..e91bc5e0 --- /dev/null +++ b/examples/24-function-expression-infer-param-type/src/HelloWorld.shed @@ -0,0 +1,8 @@ +pub fun main() ! Io -> Unit { + printHelloWorld!(fn (left, right) { left + ", " + right + "\n" }); + printHelloWorld!(fn (left, right) { right + ", " + left + "\n" }) +} + +fun printHelloWorld(combine: fn (String, String) -> String) !Io -> Unit { + print!(combine("hello", "world")); +} diff --git a/examples/25-effect-resume-with-value/shed-examples.json5 b/examples/25-effect-resume-with-value/shed-examples.json5 deleted file mode 100644 index 531c665f..00000000 --- a/examples/25-effect-resume-with-value/shed-examples.json5 +++ /dev/null @@ -1,9 +0,0 @@ -{ - examples: [ - { - project: ".", - bin: "hello-world", - expectedOutput: "hello, world", - }, - ], -} diff --git a/examples/25-effect-resume-with-value/shed.json5 b/examples/25-effect-resume-with-value/shed.json5 deleted file mode 100644 index a6c8e563..00000000 --- a/examples/25-effect-resume-with-value/shed.json5 +++ /dev/null @@ -1,8 +0,0 @@ -{ - bins: [ - { - name: "hello-world", - mainNamespace: "HelloWorld", - }, - ], -} diff --git a/examples/25-effect-resume-with-value/src/HelloWorld.shed b/examples/25-effect-resume-with-value/src/HelloWorld.shed deleted file mode 100644 index 3252aaf3..00000000 --- a/examples/25-effect-resume-with-value/src/HelloWorld.shed +++ /dev/null @@ -1,21 +0,0 @@ -effect Messages { - fun hello() -> String; - fun world() -> String; -} - -pub fun main() ! Io -> Unit { - try { - print!(Messages.hello!()); - print!(", "); - print!(Messages.world!()); - print!("\n"); - } handle Messages { - fun hello() { - resume "hello"; - } - - fun world() { - resume "world"; - } - } -} diff --git a/examples/25-effect-resume/shed-examples.json5 b/examples/25-effect-resume/shed-examples.json5 new file mode 100644 index 00000000..531c665f --- /dev/null +++ b/examples/25-effect-resume/shed-examples.json5 @@ -0,0 +1,9 @@ +{ + examples: [ + { + project: ".", + bin: "hello-world", + expectedOutput: "hello, world", + }, + ], +} diff --git a/examples/25-effect-resume/shed.json5 b/examples/25-effect-resume/shed.json5 new file mode 100644 index 00000000..a6c8e563 --- /dev/null +++ b/examples/25-effect-resume/shed.json5 @@ -0,0 +1,8 @@ +{ + bins: [ + { + name: "hello-world", + mainNamespace: "HelloWorld", + }, + ], +} diff --git a/examples/25-effect-resume/src/HelloWorld.shed b/examples/25-effect-resume/src/HelloWorld.shed new file mode 100644 index 00000000..a5e96e2f --- /dev/null +++ b/examples/25-effect-resume/src/HelloWorld.shed @@ -0,0 +1,23 @@ +effect Writer { + fun hello() -> Unit; + fun world() -> Unit; +} + +pub fun main() ! Io -> Unit { + try { + Writer.hello!(); + print!(", "); + Writer.world!(); + print!("\n"); + } handle Writer { + fun hello() { + print!("hello"); + resume; + } + + fun world() { + print!("world"); + resume; + } + } +} diff --git a/examples/26-effect-resume-with-value/shed-examples.json5 b/examples/26-effect-resume-with-value/shed-examples.json5 new file mode 100644 index 00000000..531c665f --- /dev/null +++ b/examples/26-effect-resume-with-value/shed-examples.json5 @@ -0,0 +1,9 @@ +{ + examples: [ + { + project: ".", + bin: "hello-world", + expectedOutput: "hello, world", + }, + ], +} diff --git a/examples/26-effect-resume-with-value/shed.json5 b/examples/26-effect-resume-with-value/shed.json5 new file mode 100644 index 00000000..a6c8e563 --- /dev/null +++ b/examples/26-effect-resume-with-value/shed.json5 @@ -0,0 +1,8 @@ +{ + bins: [ + { + name: "hello-world", + mainNamespace: "HelloWorld", + }, + ], +} diff --git a/examples/26-effect-resume-with-value/src/HelloWorld.shed b/examples/26-effect-resume-with-value/src/HelloWorld.shed new file mode 100644 index 00000000..3252aaf3 --- /dev/null +++ b/examples/26-effect-resume-with-value/src/HelloWorld.shed @@ -0,0 +1,21 @@ +effect Messages { + fun hello() -> String; + fun world() -> String; +} + +pub fun main() ! Io -> Unit { + try { + print!(Messages.hello!()); + print!(", "); + print!(Messages.world!()); + print!("\n"); + } handle Messages { + fun hello() { + resume "hello"; + } + + fun world() { + resume "world"; + } + } +} diff --git a/examples/26-effect-with-state/shed-examples.json5 b/examples/26-effect-with-state/shed-examples.json5 deleted file mode 100644 index 531c665f..00000000 --- a/examples/26-effect-with-state/shed-examples.json5 +++ /dev/null @@ -1,9 +0,0 @@ -{ - examples: [ - { - project: ".", - bin: "hello-world", - expectedOutput: "hello, world", - }, - ], -} diff --git a/examples/26-effect-with-state/shed.json5 b/examples/26-effect-with-state/shed.json5 deleted file mode 100644 index a6c8e563..00000000 --- a/examples/26-effect-with-state/shed.json5 +++ /dev/null @@ -1,8 +0,0 @@ -{ - bins: [ - { - name: "hello-world", - mainNamespace: "HelloWorld", - }, - ], -} diff --git a/examples/26-effect-with-state/src/HelloWorld.shed b/examples/26-effect-with-state/src/HelloWorld.shed deleted file mode 100644 index 50d64428..00000000 --- a/examples/26-effect-with-state/src/HelloWorld.shed +++ /dev/null @@ -1,22 +0,0 @@ -effect StringBuilder { - fun append(String) -> Unit; -} - -pub fun main() ! Io -> Unit { - var result = ""; - - try { - StringBuilder.append!("hello"); - StringBuilder.append!(", "); - StringBuilder.append!("world"); - StringBuilder.append!("\n"); - } handle StringBuilder { - fun append(value) { - assign result = result + value; - - resume; - } - } - - print!(result); -} diff --git a/examples/27-effect-handler-pop/shed-examples.json5 b/examples/27-effect-handler-pop/shed-examples.json5 deleted file mode 100644 index 531c665f..00000000 --- a/examples/27-effect-handler-pop/shed-examples.json5 +++ /dev/null @@ -1,9 +0,0 @@ -{ - examples: [ - { - project: ".", - bin: "hello-world", - expectedOutput: "hello, world", - }, - ], -} diff --git a/examples/27-effect-handler-pop/shed.json5 b/examples/27-effect-handler-pop/shed.json5 deleted file mode 100644 index a6c8e563..00000000 --- a/examples/27-effect-handler-pop/shed.json5 +++ /dev/null @@ -1,8 +0,0 @@ -{ - bins: [ - { - name: "hello-world", - mainNamespace: "HelloWorld", - }, - ], -} diff --git a/examples/27-effect-handler-pop/src/HelloWorld.shed b/examples/27-effect-handler-pop/src/HelloWorld.shed deleted file mode 100644 index 2b9491d7..00000000 --- a/examples/27-effect-handler-pop/src/HelloWorld.shed +++ /dev/null @@ -1,36 +0,0 @@ -effect Writer { - fun hello() -> Unit; - fun world() -> Unit; -} - -pub fun main() ! Io -> Unit { - try { - Writer.hello!(); - print!(", "); - } handle Writer { - fun hello() { - print!("hello"); - resume; - } - - fun world() { - print!("world"); - resume; - } - } - - try { - Writer.world!(); - print!("\n"); - } handle Writer { - fun hello() { - print!("hello"); - resume; - } - - fun world() { - print!("world"); - resume; - } - } -} diff --git a/examples/27-effect-with-state/shed-examples.json5 b/examples/27-effect-with-state/shed-examples.json5 new file mode 100644 index 00000000..531c665f --- /dev/null +++ b/examples/27-effect-with-state/shed-examples.json5 @@ -0,0 +1,9 @@ +{ + examples: [ + { + project: ".", + bin: "hello-world", + expectedOutput: "hello, world", + }, + ], +} diff --git a/examples/27-effect-with-state/shed.json5 b/examples/27-effect-with-state/shed.json5 new file mode 100644 index 00000000..a6c8e563 --- /dev/null +++ b/examples/27-effect-with-state/shed.json5 @@ -0,0 +1,8 @@ +{ + bins: [ + { + name: "hello-world", + mainNamespace: "HelloWorld", + }, + ], +} diff --git a/examples/27-effect-with-state/src/HelloWorld.shed b/examples/27-effect-with-state/src/HelloWorld.shed new file mode 100644 index 00000000..50d64428 --- /dev/null +++ b/examples/27-effect-with-state/src/HelloWorld.shed @@ -0,0 +1,22 @@ +effect StringBuilder { + fun append(String) -> Unit; +} + +pub fun main() ! Io -> Unit { + var result = ""; + + try { + StringBuilder.append!("hello"); + StringBuilder.append!(", "); + StringBuilder.append!("world"); + StringBuilder.append!("\n"); + } handle StringBuilder { + fun append(value) { + assign result = result + value; + + resume; + } + } + + print!(result); +} diff --git a/examples/28-effect-handler-pop-on-return/shed-examples.json5 b/examples/28-effect-handler-pop-on-return/shed-examples.json5 deleted file mode 100644 index 531c665f..00000000 --- a/examples/28-effect-handler-pop-on-return/shed-examples.json5 +++ /dev/null @@ -1,9 +0,0 @@ -{ - examples: [ - { - project: ".", - bin: "hello-world", - expectedOutput: "hello, world", - }, - ], -} diff --git a/examples/28-effect-handler-pop-on-return/shed.json5 b/examples/28-effect-handler-pop-on-return/shed.json5 deleted file mode 100644 index a6c8e563..00000000 --- a/examples/28-effect-handler-pop-on-return/shed.json5 +++ /dev/null @@ -1,8 +0,0 @@ -{ - bins: [ - { - name: "hello-world", - mainNamespace: "HelloWorld", - }, - ], -} diff --git a/examples/28-effect-handler-pop-on-return/src/HelloWorld.shed b/examples/28-effect-handler-pop-on-return/src/HelloWorld.shed deleted file mode 100644 index 4e91f8b4..00000000 --- a/examples/28-effect-handler-pop-on-return/src/HelloWorld.shed +++ /dev/null @@ -1,41 +0,0 @@ -effect Writer { - fun hello() -> Unit; - fun world() -> Unit; -} - -pub fun main() ! Io -> Unit { - try { - hello!(); - Writer.world!(); - print!("\n"); - return; - } handle Writer { - fun hello() { - print!("wrong hello"); - resume; - } - - fun world() { - print!("world"); - resume; - } - } -} - -fun hello() ! Io -> Unit { - try { - Writer.hello!(); - print!(", "); - return; - } handle Writer { - fun hello() { - print!("hello"); - resume; - } - - fun world() { - print!("wrong world"); - resume; - } - } -} diff --git a/examples/28-effect-handler-pop/shed-examples.json5 b/examples/28-effect-handler-pop/shed-examples.json5 new file mode 100644 index 00000000..531c665f --- /dev/null +++ b/examples/28-effect-handler-pop/shed-examples.json5 @@ -0,0 +1,9 @@ +{ + examples: [ + { + project: ".", + bin: "hello-world", + expectedOutput: "hello, world", + }, + ], +} diff --git a/examples/28-effect-handler-pop/shed.json5 b/examples/28-effect-handler-pop/shed.json5 new file mode 100644 index 00000000..a6c8e563 --- /dev/null +++ b/examples/28-effect-handler-pop/shed.json5 @@ -0,0 +1,8 @@ +{ + bins: [ + { + name: "hello-world", + mainNamespace: "HelloWorld", + }, + ], +} diff --git a/examples/28-effect-handler-pop/src/HelloWorld.shed b/examples/28-effect-handler-pop/src/HelloWorld.shed new file mode 100644 index 00000000..2b9491d7 --- /dev/null +++ b/examples/28-effect-handler-pop/src/HelloWorld.shed @@ -0,0 +1,36 @@ +effect Writer { + fun hello() -> Unit; + fun world() -> Unit; +} + +pub fun main() ! Io -> Unit { + try { + Writer.hello!(); + print!(", "); + } handle Writer { + fun hello() { + print!("hello"); + resume; + } + + fun world() { + print!("world"); + resume; + } + } + + try { + Writer.world!(); + print!("\n"); + } handle Writer { + fun hello() { + print!("hello"); + resume; + } + + fun world() { + print!("world"); + resume; + } + } +} diff --git a/examples/29-effect-handler-nested/shed-examples.json5 b/examples/29-effect-handler-nested/shed-examples.json5 deleted file mode 100644 index 13ea0b50..00000000 --- a/examples/29-effect-handler-nested/shed-examples.json5 +++ /dev/null @@ -1,9 +0,0 @@ -{ - 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 deleted file mode 100644 index e642a813..00000000 --- a/examples/29-effect-handler-nested/shed.json5 +++ /dev/null @@ -1,8 +0,0 @@ -{ - 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 deleted file mode 100644 index 2a8e4781..00000000 --- a/examples/29-effect-handler-nested/src/Example.shed +++ /dev/null @@ -1,42 +0,0 @@ -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; - } - } -} diff --git a/examples/29-effect-handler-pop-on-return/shed-examples.json5 b/examples/29-effect-handler-pop-on-return/shed-examples.json5 new file mode 100644 index 00000000..531c665f --- /dev/null +++ b/examples/29-effect-handler-pop-on-return/shed-examples.json5 @@ -0,0 +1,9 @@ +{ + examples: [ + { + project: ".", + bin: "hello-world", + expectedOutput: "hello, world", + }, + ], +} diff --git a/examples/29-effect-handler-pop-on-return/shed.json5 b/examples/29-effect-handler-pop-on-return/shed.json5 new file mode 100644 index 00000000..a6c8e563 --- /dev/null +++ b/examples/29-effect-handler-pop-on-return/shed.json5 @@ -0,0 +1,8 @@ +{ + bins: [ + { + name: "hello-world", + mainNamespace: "HelloWorld", + }, + ], +} diff --git a/examples/29-effect-handler-pop-on-return/src/HelloWorld.shed b/examples/29-effect-handler-pop-on-return/src/HelloWorld.shed new file mode 100644 index 00000000..4e91f8b4 --- /dev/null +++ b/examples/29-effect-handler-pop-on-return/src/HelloWorld.shed @@ -0,0 +1,41 @@ +effect Writer { + fun hello() -> Unit; + fun world() -> Unit; +} + +pub fun main() ! Io -> Unit { + try { + hello!(); + Writer.world!(); + print!("\n"); + return; + } handle Writer { + fun hello() { + print!("wrong hello"); + resume; + } + + fun world() { + print!("world"); + resume; + } + } +} + +fun hello() ! Io -> Unit { + try { + Writer.hello!(); + print!(", "); + return; + } handle Writer { + fun hello() { + print!("hello"); + resume; + } + + fun world() { + print!("wrong world"); + resume; + } + } +} diff --git a/examples/30-effect-handler-nested/shed-examples.json5 b/examples/30-effect-handler-nested/shed-examples.json5 new file mode 100644 index 00000000..13ea0b50 --- /dev/null +++ b/examples/30-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/30-effect-handler-nested/shed.json5 b/examples/30-effect-handler-nested/shed.json5 new file mode 100644 index 00000000..e642a813 --- /dev/null +++ b/examples/30-effect-handler-nested/shed.json5 @@ -0,0 +1,8 @@ +{ + bins: [ + { + name: "example", + mainNamespace: "Example", + }, + ], +} diff --git a/examples/30-effect-handler-nested/src/Example.shed b/examples/30-effect-handler-nested/src/Example.shed new file mode 100644 index 00000000..2a8e4781 --- /dev/null +++ b/examples/30-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; + } + } +} diff --git a/examples/30-effect-in-handler/shed-examples.json5 b/examples/30-effect-in-handler/shed-examples.json5 deleted file mode 100644 index 0717d99b..00000000 --- a/examples/30-effect-in-handler/shed-examples.json5 +++ /dev/null @@ -1,9 +0,0 @@ -{ - examples: [ - { - project: ".", - bin: "example", - expectedOutput: "a outer\na inner start\na outer\na inner end\nb start\na inner start\na outer\na inner end\nb end\na inner start\na outer\na inner end\na outer", - }, - ], -} diff --git a/examples/30-effect-in-handler/shed.json5 b/examples/30-effect-in-handler/shed.json5 deleted file mode 100644 index e642a813..00000000 --- a/examples/30-effect-in-handler/shed.json5 +++ /dev/null @@ -1,8 +0,0 @@ -{ - bins: [ - { - name: "example", - mainNamespace: "Example", - }, - ], -} diff --git a/examples/30-effect-in-handler/src/Example.shed b/examples/30-effect-in-handler/src/Example.shed deleted file mode 100644 index 568d9ea8..00000000 --- a/examples/30-effect-in-handler/src/Example.shed +++ /dev/null @@ -1,44 +0,0 @@ -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; - } - } -} diff --git a/examples/31-effect-break/shed-examples.json5 b/examples/31-effect-break/shed-examples.json5 deleted file mode 100644 index 531c665f..00000000 --- a/examples/31-effect-break/shed-examples.json5 +++ /dev/null @@ -1,9 +0,0 @@ -{ - examples: [ - { - project: ".", - bin: "hello-world", - expectedOutput: "hello, world", - }, - ], -} diff --git a/examples/31-effect-break/shed.json5 b/examples/31-effect-break/shed.json5 deleted file mode 100644 index a6c8e563..00000000 --- a/examples/31-effect-break/shed.json5 +++ /dev/null @@ -1,8 +0,0 @@ -{ - bins: [ - { - name: "hello-world", - mainNamespace: "HelloWorld", - }, - ], -} diff --git a/examples/31-effect-break/src/HelloWorld.shed b/examples/31-effect-break/src/HelloWorld.shed deleted file mode 100644 index f836ab58..00000000 --- a/examples/31-effect-break/src/HelloWorld.shed +++ /dev/null @@ -1,27 +0,0 @@ -effect Writer { - fun hello() -> Unit; - fun world() -> Unit; -} - -pub fun main() ! Io -> Unit { - try { - Writer.hello!(); - print!(", "); - Writer.world!(); - Writer.hello!(); - print!(", "); - Writer.world!(); - } handle Writer { - fun hello() { - print!("hello"); - resume; - } - - fun world() { - print!("world"); - break; - } - } - - print!("\n"); -} diff --git a/examples/31-effect-in-handler/shed-examples.json5 b/examples/31-effect-in-handler/shed-examples.json5 new file mode 100644 index 00000000..0717d99b --- /dev/null +++ b/examples/31-effect-in-handler/shed-examples.json5 @@ -0,0 +1,9 @@ +{ + examples: [ + { + project: ".", + bin: "example", + expectedOutput: "a outer\na inner start\na outer\na inner end\nb start\na inner start\na outer\na inner end\nb end\na inner start\na outer\na inner end\na outer", + }, + ], +} diff --git a/examples/31-effect-in-handler/shed.json5 b/examples/31-effect-in-handler/shed.json5 new file mode 100644 index 00000000..e642a813 --- /dev/null +++ b/examples/31-effect-in-handler/shed.json5 @@ -0,0 +1,8 @@ +{ + bins: [ + { + name: "example", + mainNamespace: "Example", + }, + ], +} diff --git a/examples/31-effect-in-handler/src/Example.shed b/examples/31-effect-in-handler/src/Example.shed new file mode 100644 index 00000000..568d9ea8 --- /dev/null +++ b/examples/31-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; + } + } +} diff --git a/examples/32-effect-break/shed-examples.json5 b/examples/32-effect-break/shed-examples.json5 new file mode 100644 index 00000000..531c665f --- /dev/null +++ b/examples/32-effect-break/shed-examples.json5 @@ -0,0 +1,9 @@ +{ + examples: [ + { + project: ".", + bin: "hello-world", + expectedOutput: "hello, world", + }, + ], +} diff --git a/examples/32-effect-break/shed.json5 b/examples/32-effect-break/shed.json5 new file mode 100644 index 00000000..a6c8e563 --- /dev/null +++ b/examples/32-effect-break/shed.json5 @@ -0,0 +1,8 @@ +{ + bins: [ + { + name: "hello-world", + mainNamespace: "HelloWorld", + }, + ], +} diff --git a/examples/32-effect-break/src/HelloWorld.shed b/examples/32-effect-break/src/HelloWorld.shed new file mode 100644 index 00000000..f836ab58 --- /dev/null +++ b/examples/32-effect-break/src/HelloWorld.shed @@ -0,0 +1,27 @@ +effect Writer { + fun hello() -> Unit; + fun world() -> Unit; +} + +pub fun main() ! Io -> Unit { + try { + Writer.hello!(); + print!(", "); + Writer.world!(); + Writer.hello!(); + print!(", "); + Writer.world!(); + } handle Writer { + fun hello() { + print!("hello"); + resume; + } + + fun world() { + print!("world"); + break; + } + } + + print!("\n"); +} diff --git a/examples/32-generic-structs/shed-examples.json5 b/examples/32-generic-structs/shed-examples.json5 deleted file mode 100644 index 531c665f..00000000 --- a/examples/32-generic-structs/shed-examples.json5 +++ /dev/null @@ -1,9 +0,0 @@ -{ - examples: [ - { - project: ".", - bin: "hello-world", - expectedOutput: "hello, world", - }, - ], -} diff --git a/examples/32-generic-structs/shed.json5 b/examples/32-generic-structs/shed.json5 deleted file mode 100644 index a6c8e563..00000000 --- a/examples/32-generic-structs/shed.json5 +++ /dev/null @@ -1,8 +0,0 @@ -{ - bins: [ - { - name: "hello-world", - mainNamespace: "HelloWorld", - }, - ], -} diff --git a/examples/32-generic-structs/src/HelloWorld.shed b/examples/32-generic-structs/src/HelloWorld.shed deleted file mode 100644 index f5a2f013..00000000 --- a/examples/32-generic-structs/src/HelloWorld.shed +++ /dev/null @@ -1,15 +0,0 @@ -pub fun main() ! Io -> Unit { - val messageParts = getMessageParts(); - print!(messageParts.part1); - print!(messageParts.part2); -} - -struct Parts[T1, T2]( - .part1: T1, - .part2: T2, -) { -} - -fun getMessageParts() -> Parts[String, String] { - Parts[String, String](.part1 = "hello, ", .part2 = "world\n") -} diff --git a/examples/33-generic-structs/shed-examples.json5 b/examples/33-generic-structs/shed-examples.json5 new file mode 100644 index 00000000..531c665f --- /dev/null +++ b/examples/33-generic-structs/shed-examples.json5 @@ -0,0 +1,9 @@ +{ + examples: [ + { + project: ".", + bin: "hello-world", + expectedOutput: "hello, world", + }, + ], +} diff --git a/examples/33-generic-structs/shed.json5 b/examples/33-generic-structs/shed.json5 new file mode 100644 index 00000000..a6c8e563 --- /dev/null +++ b/examples/33-generic-structs/shed.json5 @@ -0,0 +1,8 @@ +{ + bins: [ + { + name: "hello-world", + mainNamespace: "HelloWorld", + }, + ], +} diff --git a/examples/33-generic-structs/src/HelloWorld.shed b/examples/33-generic-structs/src/HelloWorld.shed new file mode 100644 index 00000000..f5a2f013 --- /dev/null +++ b/examples/33-generic-structs/src/HelloWorld.shed @@ -0,0 +1,15 @@ +pub fun main() ! Io -> Unit { + val messageParts = getMessageParts(); + print!(messageParts.part1); + print!(messageParts.part2); +} + +struct Parts[T1, T2]( + .part1: T1, + .part2: T2, +) { +} + +fun getMessageParts() -> Parts[String, String] { + Parts[String, String](.part1 = "hello, ", .part2 = "world\n") +} diff --git a/examples/33-generic-sums/shed-examples.json5 b/examples/33-generic-sums/shed-examples.json5 deleted file mode 100644 index 4a4b2b7c..00000000 --- a/examples/33-generic-sums/shed-examples.json5 +++ /dev/null @@ -1,9 +0,0 @@ -{ - examples: [ - { - project: ".", - bin: "hello-world", - expectedOutput: "Some(hello, world!)\nNone", - }, - ], -} diff --git a/examples/33-generic-sums/shed.json5 b/examples/33-generic-sums/shed.json5 deleted file mode 100644 index a6c8e563..00000000 --- a/examples/33-generic-sums/shed.json5 +++ /dev/null @@ -1,8 +0,0 @@ -{ - bins: [ - { - name: "hello-world", - mainNamespace: "HelloWorld", - }, - ], -} diff --git a/examples/33-generic-sums/src/HelloWorld.shed b/examples/33-generic-sums/src/HelloWorld.shed deleted file mode 100644 index e10456bd..00000000 --- a/examples/33-generic-sums/src/HelloWorld.shed +++ /dev/null @@ -1,23 +0,0 @@ -struct Some[T](value: T) {} - -struct None() {} - -sumtype Option[T] = Some[T] | None; - -pub fun main() ! Io -> Unit { - printOption!(Some[String]("hello, world!")); - printOption!(None()); -} - -fun printOption(option: Option[String]) !Io -> Unit { - when (option) { - is Some[String] { - print!("Some("); - print!(option.value); - print!(")\n"); - } - is None { - print!("None\n"); - } - } -} diff --git a/examples/34-generic-structs-and-sums-inferred-type-args/shed-examples.json5 b/examples/34-generic-structs-and-sums-inferred-type-args/shed-examples.json5 deleted file mode 100644 index 4a4b2b7c..00000000 --- a/examples/34-generic-structs-and-sums-inferred-type-args/shed-examples.json5 +++ /dev/null @@ -1,9 +0,0 @@ -{ - examples: [ - { - project: ".", - bin: "hello-world", - expectedOutput: "Some(hello, world!)\nNone", - }, - ], -} diff --git a/examples/34-generic-structs-and-sums-inferred-type-args/shed.json5 b/examples/34-generic-structs-and-sums-inferred-type-args/shed.json5 deleted file mode 100644 index a6c8e563..00000000 --- a/examples/34-generic-structs-and-sums-inferred-type-args/shed.json5 +++ /dev/null @@ -1,8 +0,0 @@ -{ - bins: [ - { - name: "hello-world", - mainNamespace: "HelloWorld", - }, - ], -} diff --git a/examples/34-generic-structs-and-sums-inferred-type-args/src/HelloWorld.shed b/examples/34-generic-structs-and-sums-inferred-type-args/src/HelloWorld.shed deleted file mode 100644 index 79cd1eb8..00000000 --- a/examples/34-generic-structs-and-sums-inferred-type-args/src/HelloWorld.shed +++ /dev/null @@ -1,23 +0,0 @@ -struct Some[T](value: T) {} - -struct None() {} - -sumtype Option[T] = Some[T] | None; - -pub fun main() ! Io -> Unit { - printOption!(Some("hello, world!")); - printOption!(None()); -} - -fun printOption(option: Option[String]) !Io -> Unit { - when (option) { - is Some { - print!("Some("); - print!(option.value); - print!(")\n"); - } - is None { - print!("None\n"); - } - } -} diff --git a/examples/34-generic-sums/shed-examples.json5 b/examples/34-generic-sums/shed-examples.json5 new file mode 100644 index 00000000..4a4b2b7c --- /dev/null +++ b/examples/34-generic-sums/shed-examples.json5 @@ -0,0 +1,9 @@ +{ + examples: [ + { + project: ".", + bin: "hello-world", + expectedOutput: "Some(hello, world!)\nNone", + }, + ], +} diff --git a/examples/34-generic-sums/shed.json5 b/examples/34-generic-sums/shed.json5 new file mode 100644 index 00000000..a6c8e563 --- /dev/null +++ b/examples/34-generic-sums/shed.json5 @@ -0,0 +1,8 @@ +{ + bins: [ + { + name: "hello-world", + mainNamespace: "HelloWorld", + }, + ], +} diff --git a/examples/34-generic-sums/src/HelloWorld.shed b/examples/34-generic-sums/src/HelloWorld.shed new file mode 100644 index 00000000..e10456bd --- /dev/null +++ b/examples/34-generic-sums/src/HelloWorld.shed @@ -0,0 +1,23 @@ +struct Some[T](value: T) {} + +struct None() {} + +sumtype Option[T] = Some[T] | None; + +pub fun main() ! Io -> Unit { + printOption!(Some[String]("hello, world!")); + printOption!(None()); +} + +fun printOption(option: Option[String]) !Io -> Unit { + when (option) { + is Some[String] { + print!("Some("); + print!(option.value); + print!(")\n"); + } + is None { + print!("None\n"); + } + } +} diff --git a/examples/35-generic-functions/shed-examples.json5 b/examples/35-generic-functions/shed-examples.json5 deleted file mode 100644 index 52763f4c..00000000 --- a/examples/35-generic-functions/shed-examples.json5 +++ /dev/null @@ -1,9 +0,0 @@ -{ - examples: [ - { - project: ".", - bin: "hello-world", - expectedOutput: "hello, world!", - }, - ], -} diff --git a/examples/35-generic-functions/shed.json5 b/examples/35-generic-functions/shed.json5 deleted file mode 100644 index a6c8e563..00000000 --- a/examples/35-generic-functions/shed.json5 +++ /dev/null @@ -1,8 +0,0 @@ -{ - bins: [ - { - name: "hello-world", - mainNamespace: "HelloWorld", - }, - ], -} diff --git a/examples/35-generic-functions/src/HelloWorld.shed b/examples/35-generic-functions/src/HelloWorld.shed deleted file mode 100644 index d40e9103..00000000 --- a/examples/35-generic-functions/src/HelloWorld.shed +++ /dev/null @@ -1,15 +0,0 @@ -pub fun main() ! Io -> Unit { - val message = compose( - fn (a: String) { a + ", " }, - fn (b: String) { b + "world!\n" }, - )("hello"); - print!(message); -} - -fun compose[A, B, C]( - f: fn (A) -> B, - g: fn (B) -> C -) -> fn (A) -> C { - fn (a) { g(f(a)) } -} - diff --git a/examples/35-generic-structs-and-sums-inferred-type-args/shed-examples.json5 b/examples/35-generic-structs-and-sums-inferred-type-args/shed-examples.json5 new file mode 100644 index 00000000..4a4b2b7c --- /dev/null +++ b/examples/35-generic-structs-and-sums-inferred-type-args/shed-examples.json5 @@ -0,0 +1,9 @@ +{ + examples: [ + { + project: ".", + bin: "hello-world", + expectedOutput: "Some(hello, world!)\nNone", + }, + ], +} diff --git a/examples/35-generic-structs-and-sums-inferred-type-args/shed.json5 b/examples/35-generic-structs-and-sums-inferred-type-args/shed.json5 new file mode 100644 index 00000000..a6c8e563 --- /dev/null +++ b/examples/35-generic-structs-and-sums-inferred-type-args/shed.json5 @@ -0,0 +1,8 @@ +{ + bins: [ + { + name: "hello-world", + mainNamespace: "HelloWorld", + }, + ], +} diff --git a/examples/35-generic-structs-and-sums-inferred-type-args/src/HelloWorld.shed b/examples/35-generic-structs-and-sums-inferred-type-args/src/HelloWorld.shed new file mode 100644 index 00000000..79cd1eb8 --- /dev/null +++ b/examples/35-generic-structs-and-sums-inferred-type-args/src/HelloWorld.shed @@ -0,0 +1,23 @@ +struct Some[T](value: T) {} + +struct None() {} + +sumtype Option[T] = Some[T] | None; + +pub fun main() ! Io -> Unit { + printOption!(Some("hello, world!")); + printOption!(None()); +} + +fun printOption(option: Option[String]) !Io -> Unit { + when (option) { + is Some { + print!("Some("); + print!(option.value); + print!(")\n"); + } + is None { + print!("None\n"); + } + } +} diff --git a/examples/36-generic-effects/shed-examples.json5 b/examples/36-generic-effects/shed-examples.json5 deleted file mode 100644 index d104124f..00000000 --- a/examples/36-generic-effects/shed-examples.json5 +++ /dev/null @@ -1,9 +0,0 @@ -{ - examples: [ - { - project: ".", - bin: "hello-world", - expectedOutput: "hello\nhello", - }, - ], -} diff --git a/examples/36-generic-effects/shed.json5 b/examples/36-generic-effects/shed.json5 deleted file mode 100644 index a6c8e563..00000000 --- a/examples/36-generic-effects/shed.json5 +++ /dev/null @@ -1,8 +0,0 @@ -{ - bins: [ - { - name: "hello-world", - mainNamespace: "HelloWorld", - }, - ], -} diff --git a/examples/36-generic-effects/src/HelloWorld.shed b/examples/36-generic-effects/src/HelloWorld.shed deleted file mode 100644 index a54803c6..00000000 --- a/examples/36-generic-effects/src/HelloWorld.shed +++ /dev/null @@ -1,11 +0,0 @@ -pub fun main() ! Io -> Unit { - twice!(fn () ! Io { - print!("hello\n") - }); -} - -fun twice[!E](f: fn () ! E -> Unit) ! E -> Unit { - f!(); - f!(); -} - diff --git a/examples/36-generic-functions/shed-examples.json5 b/examples/36-generic-functions/shed-examples.json5 new file mode 100644 index 00000000..52763f4c --- /dev/null +++ b/examples/36-generic-functions/shed-examples.json5 @@ -0,0 +1,9 @@ +{ + examples: [ + { + project: ".", + bin: "hello-world", + expectedOutput: "hello, world!", + }, + ], +} diff --git a/examples/36-generic-functions/shed.json5 b/examples/36-generic-functions/shed.json5 new file mode 100644 index 00000000..a6c8e563 --- /dev/null +++ b/examples/36-generic-functions/shed.json5 @@ -0,0 +1,8 @@ +{ + bins: [ + { + name: "hello-world", + mainNamespace: "HelloWorld", + }, + ], +} diff --git a/examples/36-generic-functions/src/HelloWorld.shed b/examples/36-generic-functions/src/HelloWorld.shed new file mode 100644 index 00000000..d40e9103 --- /dev/null +++ b/examples/36-generic-functions/src/HelloWorld.shed @@ -0,0 +1,15 @@ +pub fun main() ! Io -> Unit { + val message = compose( + fn (a: String) { a + ", " }, + fn (b: String) { b + "world!\n" }, + )("hello"); + print!(message); +} + +fun compose[A, B, C]( + f: fn (A) -> B, + g: fn (B) -> C +) -> fn (A) -> C { + fn (a) { g(f(a)) } +} + diff --git a/examples/37-generic-effects/shed-examples.json5 b/examples/37-generic-effects/shed-examples.json5 new file mode 100644 index 00000000..d104124f --- /dev/null +++ b/examples/37-generic-effects/shed-examples.json5 @@ -0,0 +1,9 @@ +{ + examples: [ + { + project: ".", + bin: "hello-world", + expectedOutput: "hello\nhello", + }, + ], +} diff --git a/examples/37-generic-effects/shed.json5 b/examples/37-generic-effects/shed.json5 new file mode 100644 index 00000000..a6c8e563 --- /dev/null +++ b/examples/37-generic-effects/shed.json5 @@ -0,0 +1,8 @@ +{ + bins: [ + { + name: "hello-world", + mainNamespace: "HelloWorld", + }, + ], +} diff --git a/examples/37-generic-effects/src/HelloWorld.shed b/examples/37-generic-effects/src/HelloWorld.shed new file mode 100644 index 00000000..a54803c6 --- /dev/null +++ b/examples/37-generic-effects/src/HelloWorld.shed @@ -0,0 +1,11 @@ +pub fun main() ! Io -> Unit { + twice!(fn () ! Io { + print!("hello\n") + }); +} + +fun twice[!E](f: fn () ! E -> Unit) ! E -> Unit { + f!(); + f!(); +} + diff --git a/examples/37-struct-methods/shed-examples.json5 b/examples/37-struct-methods/shed-examples.json5 deleted file mode 100644 index 95fb0a97..00000000 --- a/examples/37-struct-methods/shed-examples.json5 +++ /dev/null @@ -1,9 +0,0 @@ -{ - examples: [ - { - project: ".", - bin: "hello-world", - expectedOutput: "one\ntwo\nmany", - }, - ], -} diff --git a/examples/37-struct-methods/shed.json5 b/examples/37-struct-methods/shed.json5 deleted file mode 100644 index a6c8e563..00000000 --- a/examples/37-struct-methods/shed.json5 +++ /dev/null @@ -1,8 +0,0 @@ -{ - bins: [ - { - name: "hello-world", - mainNamespace: "HelloWorld", - }, - ], -} diff --git a/examples/37-struct-methods/src/HelloWorld.shed b/examples/37-struct-methods/src/HelloWorld.shed deleted file mode 100644 index cfba064d..00000000 --- a/examples/37-struct-methods/src/HelloWorld.shed +++ /dev/null @@ -1,17 +0,0 @@ -pub fun main() ! Io -> Unit { - print!(Count(1).message()); - print!(Count(2).message()); - print!(Count(3).message()); -} - -struct Count(value: Int) { - fun message(this) -> String { - if (this.value == 1) { - "one\n" - } else if (this.value == 2) { - "two\n" - } else { - "many\n" - } - } -} diff --git a/examples/38-struct-method-references/shed-examples.json5 b/examples/38-struct-method-references/shed-examples.json5 deleted file mode 100644 index a57c4749..00000000 --- a/examples/38-struct-method-references/shed-examples.json5 +++ /dev/null @@ -1,9 +0,0 @@ -{ - examples: [ - { - project: ".", - bin: "hello-world", - expectedOutput: "one apple\ntwo bananas\nmany coconuts!", - }, - ], -} diff --git a/examples/38-struct-method-references/shed.json5 b/examples/38-struct-method-references/shed.json5 deleted file mode 100644 index a6c8e563..00000000 --- a/examples/38-struct-method-references/shed.json5 +++ /dev/null @@ -1,8 +0,0 @@ -{ - bins: [ - { - name: "hello-world", - mainNamespace: "HelloWorld", - }, - ], -} diff --git a/examples/38-struct-method-references/src/HelloWorld.shed b/examples/38-struct-method-references/src/HelloWorld.shed deleted file mode 100644 index 5bfd3631..00000000 --- a/examples/38-struct-method-references/src/HelloWorld.shed +++ /dev/null @@ -1,25 +0,0 @@ -pub fun main() ! Io -> Unit { - val one = Count(1).message; - val two = Count(2).message; - val three = Count(3).message; - - print!(one("apple", .exclaim = false)); - print!(two("bananas", .exclaim = false)); - print!(three("coconuts", .exclaim = true)); -} - -struct Count(value: Int) { - fun message(this, noun: String, .exclaim: Bool) -> String { - val prefix = if (this.value == 1) { - "one" - } else if (this.value == 2) { - "two" - } else { - "many" - }; - - val exclamation = if (exclaim) { "!" } else { "" }; - - prefix + " " + noun + exclamation + "\n" - } -} diff --git a/examples/38-struct-methods/shed-examples.json5 b/examples/38-struct-methods/shed-examples.json5 new file mode 100644 index 00000000..95fb0a97 --- /dev/null +++ b/examples/38-struct-methods/shed-examples.json5 @@ -0,0 +1,9 @@ +{ + examples: [ + { + project: ".", + bin: "hello-world", + expectedOutput: "one\ntwo\nmany", + }, + ], +} diff --git a/examples/38-struct-methods/shed.json5 b/examples/38-struct-methods/shed.json5 new file mode 100644 index 00000000..a6c8e563 --- /dev/null +++ b/examples/38-struct-methods/shed.json5 @@ -0,0 +1,8 @@ +{ + bins: [ + { + name: "hello-world", + mainNamespace: "HelloWorld", + }, + ], +} diff --git a/examples/38-struct-methods/src/HelloWorld.shed b/examples/38-struct-methods/src/HelloWorld.shed new file mode 100644 index 00000000..cfba064d --- /dev/null +++ b/examples/38-struct-methods/src/HelloWorld.shed @@ -0,0 +1,17 @@ +pub fun main() ! Io -> Unit { + print!(Count(1).message()); + print!(Count(2).message()); + print!(Count(3).message()); +} + +struct Count(value: Int) { + fun message(this) -> String { + if (this.value == 1) { + "one\n" + } else if (this.value == 2) { + "two\n" + } else { + "many\n" + } + } +} diff --git a/examples/39-generic-struct-methods/shed-examples.json5 b/examples/39-generic-struct-methods/shed-examples.json5 deleted file mode 100644 index 531c665f..00000000 --- a/examples/39-generic-struct-methods/shed-examples.json5 +++ /dev/null @@ -1,9 +0,0 @@ -{ - examples: [ - { - project: ".", - bin: "hello-world", - expectedOutput: "hello, world", - }, - ], -} diff --git a/examples/39-generic-struct-methods/shed.json5 b/examples/39-generic-struct-methods/shed.json5 deleted file mode 100644 index a6c8e563..00000000 --- a/examples/39-generic-struct-methods/shed.json5 +++ /dev/null @@ -1,8 +0,0 @@ -{ - bins: [ - { - name: "hello-world", - mainNamespace: "HelloWorld", - }, - ], -} diff --git a/examples/39-generic-struct-methods/src/HelloWorld.shed b/examples/39-generic-struct-methods/src/HelloWorld.shed deleted file mode 100644 index a4e808e1..00000000 --- a/examples/39-generic-struct-methods/src/HelloWorld.shed +++ /dev/null @@ -1,11 +0,0 @@ -pub fun main() ! Io -> Unit { - val messageBox = Box("hello, world"); - - print!(messageBox.get()); -} - -struct Box[T](value: T) { - fun get(this) -> T { - this.value - } -} diff --git a/examples/39-struct-method-references/shed-examples.json5 b/examples/39-struct-method-references/shed-examples.json5 new file mode 100644 index 00000000..a57c4749 --- /dev/null +++ b/examples/39-struct-method-references/shed-examples.json5 @@ -0,0 +1,9 @@ +{ + examples: [ + { + project: ".", + bin: "hello-world", + expectedOutput: "one apple\ntwo bananas\nmany coconuts!", + }, + ], +} diff --git a/examples/39-struct-method-references/shed.json5 b/examples/39-struct-method-references/shed.json5 new file mode 100644 index 00000000..a6c8e563 --- /dev/null +++ b/examples/39-struct-method-references/shed.json5 @@ -0,0 +1,8 @@ +{ + bins: [ + { + name: "hello-world", + mainNamespace: "HelloWorld", + }, + ], +} diff --git a/examples/39-struct-method-references/src/HelloWorld.shed b/examples/39-struct-method-references/src/HelloWorld.shed new file mode 100644 index 00000000..5bfd3631 --- /dev/null +++ b/examples/39-struct-method-references/src/HelloWorld.shed @@ -0,0 +1,25 @@ +pub fun main() ! Io -> Unit { + val one = Count(1).message; + val two = Count(2).message; + val three = Count(3).message; + + print!(one("apple", .exclaim = false)); + print!(two("bananas", .exclaim = false)); + print!(three("coconuts", .exclaim = true)); +} + +struct Count(value: Int) { + fun message(this, noun: String, .exclaim: Bool) -> String { + val prefix = if (this.value == 1) { + "one" + } else if (this.value == 2) { + "two" + } else { + "many" + }; + + val exclamation = if (exclaim) { "!" } else { "" }; + + prefix + " " + noun + exclamation + "\n" + } +} diff --git a/examples/40-generic-struct-methods-this/shed-examples.json5 b/examples/40-generic-struct-methods-this/shed-examples.json5 deleted file mode 100644 index 531c665f..00000000 --- a/examples/40-generic-struct-methods-this/shed-examples.json5 +++ /dev/null @@ -1,9 +0,0 @@ -{ - examples: [ - { - project: ".", - bin: "hello-world", - expectedOutput: "hello, world", - }, - ], -} diff --git a/examples/40-generic-struct-methods-this/shed.json5 b/examples/40-generic-struct-methods-this/shed.json5 deleted file mode 100644 index a6c8e563..00000000 --- a/examples/40-generic-struct-methods-this/shed.json5 +++ /dev/null @@ -1,8 +0,0 @@ -{ - bins: [ - { - name: "hello-world", - mainNamespace: "HelloWorld", - }, - ], -} diff --git a/examples/40-generic-struct-methods-this/src/HelloWorld.shed b/examples/40-generic-struct-methods-this/src/HelloWorld.shed deleted file mode 100644 index b114d85a..00000000 --- a/examples/40-generic-struct-methods-this/src/HelloWorld.shed +++ /dev/null @@ -1,15 +0,0 @@ -pub fun main() ! Io -> Unit { - val messageBox = Box("hello, world"); - - print!(messageBox.me().get()); -} - -struct Box[T](value: T) { - fun me(this) -> Box[T] { - this - } - - fun get(this) -> T { - this.value - } -} diff --git a/examples/40-generic-struct-methods/shed-examples.json5 b/examples/40-generic-struct-methods/shed-examples.json5 new file mode 100644 index 00000000..531c665f --- /dev/null +++ b/examples/40-generic-struct-methods/shed-examples.json5 @@ -0,0 +1,9 @@ +{ + examples: [ + { + project: ".", + bin: "hello-world", + expectedOutput: "hello, world", + }, + ], +} diff --git a/examples/40-generic-struct-methods/shed.json5 b/examples/40-generic-struct-methods/shed.json5 new file mode 100644 index 00000000..a6c8e563 --- /dev/null +++ b/examples/40-generic-struct-methods/shed.json5 @@ -0,0 +1,8 @@ +{ + bins: [ + { + name: "hello-world", + mainNamespace: "HelloWorld", + }, + ], +} diff --git a/examples/40-generic-struct-methods/src/HelloWorld.shed b/examples/40-generic-struct-methods/src/HelloWorld.shed new file mode 100644 index 00000000..a4e808e1 --- /dev/null +++ b/examples/40-generic-struct-methods/src/HelloWorld.shed @@ -0,0 +1,11 @@ +pub fun main() ! Io -> Unit { + val messageBox = Box("hello, world"); + + print!(messageBox.get()); +} + +struct Box[T](value: T) { + fun get(this) -> T { + this.value + } +} diff --git a/examples/41-generic-struct-methods-this/shed-examples.json5 b/examples/41-generic-struct-methods-this/shed-examples.json5 new file mode 100644 index 00000000..531c665f --- /dev/null +++ b/examples/41-generic-struct-methods-this/shed-examples.json5 @@ -0,0 +1,9 @@ +{ + examples: [ + { + project: ".", + bin: "hello-world", + expectedOutput: "hello, world", + }, + ], +} diff --git a/examples/41-generic-struct-methods-this/shed.json5 b/examples/41-generic-struct-methods-this/shed.json5 new file mode 100644 index 00000000..a6c8e563 --- /dev/null +++ b/examples/41-generic-struct-methods-this/shed.json5 @@ -0,0 +1,8 @@ +{ + bins: [ + { + name: "hello-world", + mainNamespace: "HelloWorld", + }, + ], +} diff --git a/examples/41-generic-struct-methods-this/src/HelloWorld.shed b/examples/41-generic-struct-methods-this/src/HelloWorld.shed new file mode 100644 index 00000000..b114d85a --- /dev/null +++ b/examples/41-generic-struct-methods-this/src/HelloWorld.shed @@ -0,0 +1,15 @@ +pub fun main() ! Io -> Unit { + val messageBox = Box("hello, world"); + + print!(messageBox.me().get()); +} + +struct Box[T](value: T) { + fun me(this) -> Box[T] { + this + } + + fun get(this) -> T { + this.value + } +} diff --git a/examples/41-native-code/shed-examples.json5 b/examples/41-native-code/shed-examples.json5 deleted file mode 100644 index 1b45c0b5..00000000 --- a/examples/41-native-code/shed-examples.json5 +++ /dev/null @@ -1,9 +0,0 @@ -{ - examples: [ - { - project: ".", - bin: "false", - expectedExitCode: 42, - }, - ], -} diff --git a/examples/41-native-code/shed.json5 b/examples/41-native-code/shed.json5 deleted file mode 100644 index b07dcaed..00000000 --- a/examples/41-native-code/shed.json5 +++ /dev/null @@ -1,11 +0,0 @@ -{ - bins: [ - { - name: "false", - mainNamespace: "False", - }, - ], - dependencies: [ - {path: "../../projects/std"}, - ], -} diff --git a/examples/41-native-code/src/False.shed b/examples/41-native-code/src/False.shed deleted file mode 100644 index 75dc7a89..00000000 --- a/examples/41-native-code/src/False.shed +++ /dev/null @@ -1,5 +0,0 @@ -import Std/Process; - -pub fun main() ! Io -> Unit { - Process.exit!(42); -} diff --git a/examples/42-native-code/shed-examples.json5 b/examples/42-native-code/shed-examples.json5 new file mode 100644 index 00000000..1b45c0b5 --- /dev/null +++ b/examples/42-native-code/shed-examples.json5 @@ -0,0 +1,9 @@ +{ + examples: [ + { + project: ".", + bin: "false", + expectedExitCode: 42, + }, + ], +} diff --git a/examples/42-native-code/shed.json5 b/examples/42-native-code/shed.json5 new file mode 100644 index 00000000..b07dcaed --- /dev/null +++ b/examples/42-native-code/shed.json5 @@ -0,0 +1,11 @@ +{ + bins: [ + { + name: "false", + mainNamespace: "False", + }, + ], + dependencies: [ + {path: "../../projects/std"}, + ], +} diff --git a/examples/42-native-code/src/False.shed b/examples/42-native-code/src/False.shed new file mode 100644 index 00000000..75dc7a89 --- /dev/null +++ b/examples/42-native-code/src/False.shed @@ -0,0 +1,5 @@ +import Std/Process; + +pub fun main() ! Io -> Unit { + Process.exit!(42); +} -- cgit v1.2.3