-
Notifications
You must be signed in to change notification settings - Fork 438
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Partially updates doc and follows requests from PR review
- Loading branch information
1 parent
6d699c4
commit 8d9a7e0
Showing
49 changed files
with
316 additions
and
249 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
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
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 |
---|---|---|
|
@@ -9,4 +9,4 @@ def main: | |
x <- wrap(0) | ||
case Bool/F: | ||
x = wrap(0) | ||
return wrap(x) | ||
return wrap(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
7 changes: 4 additions & 3 deletions
7
tests/golden_tests/compile_file_o_all/non_exhaustive_and.bend
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
type Bool = True | False | ||
Bool.and Bool/True Bool/True = Bool/True | ||
Bool.and Bool/False Bool/False = Bool/False | ||
type Bool = T | F | ||
|
||
Bool.and Bool/T Bool/T = Bool/T | ||
Bool.and Bool/F Bool/F = Bool/F | ||
|
||
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 |
---|---|---|
@@ -1,9 +1,12 @@ | ||
type Bool = True | False | ||
type Bool: | ||
T | ||
F | ||
|
||
def main: | ||
with IO: | ||
match _ = Bool/True: | ||
case Bool/True: | ||
match _ = Bool/T: | ||
case Bool/T: | ||
x <- wrap(0) | ||
case Bool/False: | ||
case Bool/F: | ||
x <- wrap(0) | ||
return wrap(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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
type Bool = True | False | ||
type Bool = T | F | ||
|
||
And (Bool/True, Bool/True, Bool/True) = Bool/True | ||
And * = Bool/False | ||
And (Bool/T, Bool/T, Bool/T) = Bool/T | ||
And * = Bool/F | ||
|
||
main = (And (Bool/False, Bool/True, Bool/False)) | ||
main = (And (Bool/F, Bool/T, Bool/F)) |
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
type Bool = True | False | ||
foo (Bool/True, x) = x | ||
foo * = Bool/False | ||
type Bool = T | F | ||
|
||
main = (foo (Bool/False, Bool/True)) | ||
foo (Bool/T, x) = x | ||
foo * = Bool/F | ||
|
||
main = (foo (Bool/F, Bool/T)) |
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
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
type Bool = False | True | ||
|
||
(Foo a b) = λf (f a) | ||
(Foo a b) = b | ||
|
||
|
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
type Bool = True | False | ||
|
||
(if_ 0 then else) = else | ||
(if_ _ then else) = then | ||
|
||
|
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 |
---|---|---|
@@ -1,6 +1,9 @@ | ||
type Point: | ||
Point { x, y } | ||
type Bool = True | False | ||
|
||
type Bool: | ||
True | ||
False | ||
|
||
|
||
def symbols(): | ||
|
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 @@ | ||
# Checks if a generic map contains a given key, and if it does, applies a function to the value, otherwise it returns the map | ||
def test(m: Map(u24), key: u24) -> Map(u24): | ||
def addtwo (x: u24) -> u24: | ||
return (x + 2) | ||
(num, map) = Map/contains(m, key) | ||
if (num == 0): | ||
return m | ||
else: | ||
return Map/map(m, key, addtwo()) | ||
|
||
def main() -> _: | ||
m = {3: 255} | ||
return test(m, 3) |
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 test1() -> (u24, Map(u24)): | ||
m = {} | ||
m = Map/set(Map/set(Map/set(Map/empty, 3, 4), 2, 3), 1, 2) | ||
(val, map) = Map/get(m, 1) | ||
return Map/get(map, val) | ||
|
||
|
||
def main() -> _: | ||
return test1() |
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,14 @@ | ||
# Takes two lists and uses one as keys and the other as values, returning a map | ||
def test(m: Map(T), xs: List(u24), ys: List(T)) -> Map(T): | ||
match xs: | ||
case List/Nil: | ||
return Map/Leaf | ||
case List/Cons: | ||
match ys: | ||
case List/Nil: | ||
return Map/Leaf | ||
case List/Cons: | ||
return test(Map/set(m, xs.head, ys.head), xs.tail, ys.tail) | ||
|
||
def main() -> _: | ||
return test(Map/Leaf, List/Cons(1, List/Nil), List/Cons(2, List/Nil)) |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
|
||
def main(): | ||
def main() -> _: | ||
m1 = {0: 42, 1: 7, 2: 13, 3: 255, 4: 100} | ||
return Map/get_check(m1, 3) | ||
|
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
def main(): | ||
def main() -> _: | ||
m1 = {0: 42, 1: 7, 2: 13, 3: 255, 4: 100} | ||
return Map/contains(m1, 3) | ||
return Map/contains(m1, 3) |
Oops, something went wrong.