Last active
June 24, 2016 23:21
-
-
Save kazu-yamamoto/9428e2512fb91f06010ad0f0f36def27 to your computer and use it in GitHub Desktop.
concurrent hello world in Haskell
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
module Main where | |
import Control.Concurrent | |
main :: IO () | |
main = do | |
mvar <- newEmptyMVar | |
_ <- forkIO $ child mvar | |
action <- takeMVar mvar | |
action | |
child :: MVar (IO ()) -> IO () | |
child mvar = putMVar mvar (putStrLn "Hello World!") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment