-
-
Save daved/3ac1300f5673b4d1a04d9c34acf5ff6d to your computer and use it in GitHub Desktop.
shorter version of asynchronous delayed function
This file contains 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
import Control.Concurrent | |
import Control.Concurrent.Async | |
main:: IO() | |
main = do | |
a <- async (do threadDelay 5000; return 42) | |
r <- wait a | |
putStrLn ("The answer is: " ++ show r) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment