Created
February 7, 2014 00:14
-
-
Save maxsnew/8855176 to your computer and use it in GitHub Desktop.
IO Request Serialization example
This file contains hidden or 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
| // Handler for out | |
| var handler = function(req) { | |
| switch(req) { | |
| "Just": | |
| var msg = req._0; | |
| switch(req.ctor) { | |
| "PutS": | |
| process.stdout.write(req._0); | |
| break; | |
| "Exit": | |
| process.exit(req._0); | |
| break; | |
| "GetS": | |
| process.stdin.resume(); | |
| } | |
| } | |
| } |
This file contains hidden or 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
| data Request = PutS String | |
| | Exit Int | |
| | GetS | |
| port out : Signal (Maybe Request) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment