Skip to content

Instantly share code, notes, and snippets.

@daved
Forked from mdrohmann/main.hs
Created April 26, 2018 06:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daved/3ac1300f5673b4d1a04d9c34acf5ff6d to your computer and use it in GitHub Desktop.
Save daved/3ac1300f5673b4d1a04d9c34acf5ff6d 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