[Haskell-beginners] Concurrent vs GHC

Mauricio Hernandes maukeshigomu at gmail.com
Sat Jun 30 17:03:34 CEST 2012

Hello, I'm having a problem with GHC.

When I compile the code bellow it does nothing, but If I try to use ghci it
works normally.

it seems a simple problem, but I can't understand.

Thanks for the help


import System.IO
import Control.Concurrent
import Data.List

main = do
     input <- newMVar  [1..30000]
     ia <- newEmptyMVar
     ib <- newEmptyMVar
     ic <- newEmptyMVar

     forkIO $ do x <- readMVar input
                 putMVar ia x

     forkIO $ do a <- readMVar ia
                 putMVar ib ( sum a )

     forkIO $ do a <- readMVar ia
                 putMVar ic ( reverse a )

     forkIO $ do b <- readMVar ib
                 c <- readMVar ic
                 print b
                 print c
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20120701/712d04f7/attachment.htm>

More information about the Beginners mailing list