[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

Reply via email to