STM experiment

Luca Ciciriello luca_ciciriello at
Fri Oct 2 12:16:49 EDT 2009

Hi All.
I'm very new using Concurrency and STM in Haskell. I'm trying some  
basic example using STM like this one:

module Main
import IO
import Control.Concurrent
import Control.Concurrent.STM
main :: IO ()
main = do
                  forkIO (hPutStr stdout "Hello")
                  hPutStr stdout " world\n"

Loading this module in GHCi and running main, the result is:


On MacOs X 10.5.8 and on WindowsXp

Compiling this module with:

ghc --make Main.hs -o Main

and launcing ./Main the result is just:

Terminal> world

Am I doing something wrong? My expected result was Hello world (or  
world Hello)

Thanks in advance for any answer.


More information about the Glasgow-haskell-users mailing list