Skip to content

Instantly share code, notes, and snippets.

@dungpa
Created September 13, 2012 19:36
Show Gist options
  • Save dungpa/3717021 to your computer and use it in GitHub Desktop.
Save dungpa/3717021 to your computer and use it in GitHub Desktop.
Async mistake 1
let rec loop () = async {
do! Async.Sleep(1000)
do! loop() } // Wrong!
// In order to write tail-recursive calls in F# async workflows, we should use return!:
let rec loop () = async {
do! Async.Sleep(1000)
return! loop() } // Correct :-)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment