forked from gluon-lang/gluon
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add left and right application operators
- Loading branch information
1 parent
e3c15be
commit 495a903
Showing
12 changed files
with
97 additions
and
98 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
let { run, writer, assert, assert_ieq, assert_feq } = import "std/test.glu" | ||
let prelude = import "std/prelude.glu" | ||
let { Num } = prelude | ||
let { (>>) } = prelude.make_Monad writer.monad | ||
let { (*>) } = prelude.make_Applicative writer.applicative | ||
|
||
let int_tests = | ||
let { (+), (-), (*) } = prelude.num_Int | ||
assert_ieq 2 2 >> | ||
assert_ieq 12 (10 + 2) >> | ||
assert_ieq 123 (50 * 2 + 9 * 3 - 4) | ||
assert_ieq 2 2 | ||
*> assert_ieq 12 (10 + 2) | ||
*> assert_ieq 123 (50 * 2 + 9 * 3 - 4) | ||
|
||
let float_tests = | ||
let { (+), (-), (*) } = prelude.num_Float | ||
assert_feq 91.0 (50.0 * 2.0 - 3.0 * 3.0) | ||
|
||
int_tests >> float_tests | ||
int_tests *> float_tests |
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,12 +1,11 @@ | ||
let { run, writer, assert_ieq } = import "std/test.glu" | ||
let prelude = import "std/prelude.glu" | ||
let { Num } = prelude | ||
let { pure } = writer.applicative | ||
let { (>>) } = prelude.make_Monad writer.monad | ||
let { (*>), pure } = prelude.make_Applicative writer.applicative | ||
let { (+), (-), (*) } = prelude.num_Int | ||
|
||
let l = lazy (\_ -> 123 + 57) | ||
|
||
assert_ieq (force (lazy \_ -> 2)) 2 >> | ||
pure () >> | ||
assert_ieq 180 (force l) | ||
assert_ieq (force (lazy \_ -> 2)) 2 | ||
*> pure () | ||
*> assert_ieq 180 (force l) |
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
Oops, something went wrong.