Concurrent Haskell (Ops...)
[I mean "CONCURRENT Haskell" rather than "Haskell DIRECT" in the last email. Sorry.] --- I am trying to create a program that prints interleaved sequences of 'a's and 'z's, using Haskell Direct (under GHC). I've tryied the following: import Concurrent main :: IO()main = let loop ch = putStr(ch) >> loop ch in forkIO (loop "a") >> loop "z" But this program prints only 'z's, and no 'a's. I was surprised by this, since GHC uses preemptive multitasking, not cooperative multitasking. Does anyone knows what's going wrong? Thanks, Andre W B Furtado
Concurrent Haskell (Ops...)
Andre W B Furtado writes: : | import Concurrent | | main :: IO() | main = let loop ch = putStr(ch) >> loop ch in |forkIO (loop "a") >> loop "z" | | But this program prints only 'z's, and no 'a's. I was surprised by | this, since GHC uses preemptive multitasking, not cooperative | multitasking. Does anyone knows what's going wrong? By my count, this is now a TAQ (thrice asked question). :-) http://www.mail-archive.com/glasgow-haskell-users@haskell.org/msg01599.html ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell