Skip to content

Instantly share code, notes, and snippets.

@maxsnew
Created February 7, 2014 00:14
Show Gist options
  • Select an option

  • Save maxsnew/8855176 to your computer and use it in GitHub Desktop.

Select an option

Save maxsnew/8855176 to your computer and use it in GitHub Desktop.
IO Request Serialization example
// 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();
}
}
}
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