From 8976dd7c9adc8a5f178ccf32543bdd5cc19e9745 Mon Sep 17 00:00:00 2001 From: U228413 Date: Wed, 18 Oct 2023 17:03:59 +0200 Subject: [PATCH] Improves examples --- examples/pts/defWithTypeParam.effekt | 11 ---------- examples/pts/example.effekt | 6 ------ examples/pts/functionReturnType.effekt | 10 --------- examples/pts/{ => neg}/externResource.effekt | 0 examples/pts/overloaded.effekt | 8 ------- examples/pts/pos/boxInference.effekt | 21 ++++++++++--------- examples/pts/{ => pos}/defWithEff.effekt | 0 .../pts/{ => pos}/functionDoubleUse.effekt | 0 examples/pts/recursion.effekt | 5 ----- 9 files changed, 11 insertions(+), 50 deletions(-) delete mode 100644 examples/pts/defWithTypeParam.effekt delete mode 100644 examples/pts/example.effekt delete mode 100644 examples/pts/functionReturnType.effekt rename examples/pts/{ => neg}/externResource.effekt (100%) delete mode 100644 examples/pts/overloaded.effekt rename examples/pts/{ => pos}/defWithEff.effekt (100%) rename examples/pts/{ => pos}/functionDoubleUse.effekt (100%) delete mode 100644 examples/pts/recursion.effekt diff --git a/examples/pts/defWithTypeParam.effekt b/examples/pts/defWithTypeParam.effekt deleted file mode 100644 index 9243f03b6..000000000 --- a/examples/pts/defWithTypeParam.effekt +++ /dev/null @@ -1,11 +0,0 @@ -def run{func: _} = { - val a: Int = func(1) - def b: A => Int = func - 1 -} - -def main() = { - () -} - -// Should NOT work \ No newline at end of file diff --git a/examples/pts/example.effekt b/examples/pts/example.effekt deleted file mode 100644 index 3c423d1ef..000000000 --- a/examples/pts/example.effekt +++ /dev/null @@ -1,6 +0,0 @@ -def f(x: Int): _ = g(x) -def g(x: Int): _ = f(x) - -def main() = { - () -} \ No newline at end of file diff --git a/examples/pts/functionReturnType.effekt b/examples/pts/functionReturnType.effekt deleted file mode 100644 index 3a9cff89d..000000000 --- a/examples/pts/functionReturnType.effekt +++ /dev/null @@ -1,10 +0,0 @@ -def run(x: _){func: _} = { - val a = func(x, 1) - val b: Int = func(x, 1) - val c: Int = x - 1 -} - -def main() = { - run("a"){ (x: String, y: Int) => x } -} \ No newline at end of file diff --git a/examples/pts/externResource.effekt b/examples/pts/neg/externResource.effekt similarity index 100% rename from examples/pts/externResource.effekt rename to examples/pts/neg/externResource.effekt diff --git a/examples/pts/overloaded.effekt b/examples/pts/overloaded.effekt deleted file mode 100644 index 03d37ee7e..000000000 --- a/examples/pts/overloaded.effekt +++ /dev/null @@ -1,8 +0,0 @@ -def f(x: Int): Int = 1 - -def f(x: Int): String = "2" - -def main() = { - val a: _ = f(1) - 1 -} \ No newline at end of file diff --git a/examples/pts/pos/boxInference.effekt b/examples/pts/pos/boxInference.effekt index 5219e2f5c..3c4184cde 100644 --- a/examples/pts/pos/boxInference.effekt +++ b/examples/pts/pos/boxInference.effekt @@ -6,20 +6,21 @@ def f(x: Int): Int = x + 1 def g(x: Int): Int = x * 2 def func1(boxedParam: _): Int = { - (unbox boxedParam)(1) + def f = unbox boxedParam + f(1) } -def func2(boxedParams: List[_]): Int = { - var sum = 0 - foreach(boxedParams) { - func => sum = sum + (unbox func)(1) - } - - sum -} +//def func2(boxedParams: List[_]): Int = { +// var sum = 0 +// foreach(boxedParams) { +// func => sum = sum + (unbox func)(1) +// } +// +// sum +//} def main() = { val a = func1(box f) - val b = func2(Cons(box f, Cons(box g, Nil()))) + // val b = func2(Cons(box f, Cons(box g, Nil()))) 1 } \ No newline at end of file diff --git a/examples/pts/defWithEff.effekt b/examples/pts/pos/defWithEff.effekt similarity index 100% rename from examples/pts/defWithEff.effekt rename to examples/pts/pos/defWithEff.effekt diff --git a/examples/pts/functionDoubleUse.effekt b/examples/pts/pos/functionDoubleUse.effekt similarity index 100% rename from examples/pts/functionDoubleUse.effekt rename to examples/pts/pos/functionDoubleUse.effekt diff --git a/examples/pts/recursion.effekt b/examples/pts/recursion.effekt deleted file mode 100644 index c0db49ea1..000000000 --- a/examples/pts/recursion.effekt +++ /dev/null @@ -1,5 +0,0 @@ -def f(x: _, y: Int): Int = - if(y > 0) - f(x, y - 1) - else - 0 \ No newline at end of file