[Haskell-cafe] Using unsafePerformIO

Dinh Tien Tuan Anh tuananhbirm at hotmail.com
Fri Jul 29 11:01:10 EDT 2005


Hi, i have the following

f :: [a] -> IO a
f xs = do
             m <- newMVar
             c1 <- forkIO f1 xs m
             c2 <- forkIO f2 xs m
             c3 <- forkIO f3 xs m
             c<- takeMVar m
             killThread c1
             killThread c2
             killThread c3
             return c



co (x:xs)
         ¦c == 1          = 1: co xs
         ¦otherwise      = (-1): co xs
         where c = unsafePerformIO (f (x:xs))




is it safe to use unsafePerformIO that way ? Please tell me why if it is 
not.

Cheers

_________________________________________________________________
Be the first to hear what's new at MSN - sign up to our free newsletters! 
http://www.msn.co.uk/newsletters



More information about the Haskell-Cafe mailing list