-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
284 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
def f(x: Int): Int = x + 1 | ||
|
||
def runAndBox{func: _}: (Int, _) = { | ||
val a = func(1) | ||
val b = box Func | ||
(a, b) | ||
} | ||
|
||
def main() = { | ||
val a: Int = runAndBox{f} | ||
1 | ||
} | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
effect Eff(): Unit | ||
|
||
def run{func: _} = { | ||
val a: Int = func(1) | ||
def b: Int => Int / Eff = func | ||
1 | ||
} | ||
|
||
def main() = { | ||
() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
def run{func: _} = { | ||
val a: Int = func(1) | ||
def b: A => Int = func | ||
1 | ||
} | ||
|
||
def main() = { | ||
() | ||
} | ||
|
||
// Should NOT work |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
effect Eff(): Unit | ||
|
||
def run{x: _}: Int = { | ||
def y: Int => Int / Eff = x | ||
x(1) | ||
} | ||
|
||
def func(x: Int): Int / Eff = { | ||
do Eff() | ||
1 | ||
} | ||
|
||
def main() = { | ||
run{ func } | ||
1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
def f(x: Int): _ = g(x) | ||
def g(x: Int): _ = f(x) | ||
|
||
def main() = { | ||
() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
extern resource test: _ | ||
|
||
def main() = { | ||
() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
def run{func: _ } = { | ||
val a: Int = func(1) | ||
val b = func(2) | ||
func(3) | ||
} | ||
|
||
def main() = { | ||
() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
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 } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
def f(x: Int): Int = 1 | ||
|
||
def f(x: Int): String = "2" | ||
|
||
def main() = { | ||
val a: _ = f(1) | ||
1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
def f(x: _, y: Int): Int = | ||
if(y > 0) | ||
f(x, y - 1) | ||
else | ||
0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// opClause wildcard | ||
|
||
effect Test { | ||
def output(x: Int): Int / _ | ||
} | ||
|
||
def main() = { | ||
() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Parametric Captures | ||
|
||
effect Eff[A]{ def output(): Int } | ||
|
||
def f{ eff: Eff[Int] } = { | ||
val a = fun() { eff.output() } | ||
val b: _ = a | ||
1 | ||
} | ||
|
||
def main() = { | ||
() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// Wildcards in anonymous functions | ||
|
||
def main() = { | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
effect Eff { def use(): Unit } | ||
|
||
def myModule { eff : Eff } = { | ||
val e = fun() { eff.use(); () }; | ||
def x = unbox e; | ||
|
||
val f: () => Unit at _ = x; | ||
val g: _ at _ = x | ||
val h: _ = x | ||
|
||
def m(x: Int => Int at {eff}): Int = { | ||
println("called") | ||
1 | ||
} | ||
|
||
def n: _ = m | ||
def o: Int => Int = n | ||
|
||
f | ||
} | ||
|
||
|
||
|
||
def main() = { | ||
() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
extern _ def func(x: Int): Int = "test" | ||
|
||
def main() = { | ||
() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
extern def func(x: _): _ / _ = "Test" | ||
|
||
def main() = { | ||
() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
val res = fun(x: _) { 1 } | ||
|
||
def main() = { | ||
println(res(1)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
def run{ f: Int => Int / _ }: Int = f(1) | ||
|
||
val res = run{ (x: Int) => x + 1 } | ||
|
||
def main() = { | ||
println(res) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
def identity[A](x: A): A = x | ||
|
||
def runFunc{block: _}: Int = block(1) | ||
|
||
def main() = { runFunc{identity} } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
def id(x: Int): Int = x | ||
|
||
def id(x: String): String = x | ||
|
||
def main() = { | ||
val a = id(1) | ||
val b = id("a") | ||
println(a) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
def func(x: Int): _ = | ||
if(x == 0) | ||
1 | ||
else | ||
func(x - 1) + 1 | ||
|
||
def main() = { | ||
println(func(1)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
effect Eff(): Unit | ||
|
||
def run{x: _}: Int = { | ||
val a: Int = x(1) | ||
//def y: Int => Int / Eff = x | ||
1 | ||
} | ||
|
||
def func(x: Int): Int / Eff = { | ||
do Eff() | ||
1 | ||
} | ||
|
||
def main() = { | ||
run{ func } | ||
1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
def runFunc[A](x: A){func: _}: Int = { | ||
func(x) | ||
} | ||
|
||
def f(x: Int): Int = x + 1 | ||
|
||
def g(x: String): Int = 1 | ||
|
||
def main() = { | ||
println(runFunc(1){f}) | ||
println(runFunc("a"){g}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
def f[_](x: Int): Int = x + 1 | ||
|
||
def main() = { | ||
f(1) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
extern resource test: Int => Int | ||
|
||
def main() = { | ||
() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
type A = _ | ||
|
||
val b: A = 1 | ||
val c: A = "a" | ||
|
||
def main() = { | ||
() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
def f(x: Int): _ = { | ||
if(x == 0) | ||
"a" | ||
else | ||
f(x - 1) + 1 | ||
} | ||
|
||
def main() = { | ||
() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
type A = _ | ||
|
||
def main() = { | ||
val x: A = 5 | ||
val y: A = "a" | ||
1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
extern def test(x: Int): Int / _ = "test" | ||
|
||
def main() = { | ||
() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
def f(x: _): Int = { | ||
val y: _ = x | ||
y | ||
} | ||
|
||
def main() = { | ||
f("1") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
type AA = _ | ||
|
||
def f(x: AA) = 1 | ||
|
||
def main() = { | ||
1 | ||
} |