Skip to content

Instantly share code, notes, and snippets.

@mdrohmann
Created April 24, 2018 07:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mdrohmann/e3b0adefb5dd545aaf90ebd918cd3937 to your computer and use it in GitHub Desktop.
Save mdrohmann/e3b0adefb5dd545aaf90ebd918cd3937 to your computer and use it in GitHub Desktop.
shorter version of asynchronous delayed function
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