Skip to content

Instantly share code, notes, and snippets.

@SteveGilham
Created April 26, 2015 13:59
Show Gist options
  • Save SteveGilham/4900c10576204213f400 to your computer and use it in GitHub Desktop.
Save SteveGilham/4900c10576204213f400 to your computer and use it in GitHub Desktop.
Monadic string reader
let GetS length =
let rec get chars count =
if count > 0
then GetC >>= fun c -> get (chars@[c]) (count – 1)
else Return IO String(List.toArray chars)
get [] length;;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment