Skip to content

Instantly share code, notes, and snippets.

@SteveGilham
Created April 26, 2015 14:22
Show Gist options
  • Save SteveGilham/fff084a70c993001d276 to your computer and use it in GitHub Desktop.
Save SteveGilham/fff084a70c993001d276 to your computer and use it in GitHub Desktop.
Continuation based character I/O
let putc (c: char) (k: continuation) =
let write () = System.Console.Write(c);
execute k
K write
let getc (g: char -> continuation) =
let read () = execute (g <| System.Console.ReadKey(true).KeyChar)
K read;;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment