forked from puffnfresh/roy
-
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.
- Loading branch information
1 parent
56e06dc
commit 2271215
Showing
7 changed files
with
37 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
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,3 @@ | ||
starting | ||
hello | ||
world |
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,24 @@ | ||
let callbacks = { | ||
return: \x -> | ||
\callback -> callback x | ||
bind: \action1 f -> | ||
\callback -> | ||
let callback1 = \x -> | ||
let action2 = f x | ||
action2 callback | ||
action1 callback1 | ||
} | ||
|
||
let wait seconds = (\callback -> setTimeout callback (seconds * 1000)) | ||
let print x = \callback -> | ||
console.log x | ||
callback () | ||
let nop _ = _ | ||
|
||
console.log "starting" | ||
let program = do callbacks | ||
_ <- print "hello" | ||
print "world" | ||
|
||
program nop | ||
|
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 @@ | ||
Binding: 1 | ||
Binding: 3 | ||
Binding: 4 | ||
Binding: 5 | ||
Return: 10 | ||
10 |
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 |
---|---|---|
|
@@ -12,5 +12,6 @@ console.log (do traceMonad | |
let x = 2 | ||
y ← 3 | ||
z ← 4 | ||
5 | ||
return w + x + y + z | ||
) |