Skip to content

Instantly share code, notes, and snippets.

@kazu-yamamoto
Last active June 24, 2016 23:21
Show Gist options
  • Save kazu-yamamoto/9428e2512fb91f06010ad0f0f36def27 to your computer and use it in GitHub Desktop.
Save kazu-yamamoto/9428e2512fb91f06010ad0f0f36def27 to your computer and use it in GitHub Desktop.
concurrent hello world in Haskell
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