Created
September 13, 2012 19:36
-
-
Save dungpa/3717021 to your computer and use it in GitHub Desktop.
Async mistake 1
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
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