"Dinh Tien Tuan Anh" <[EMAIL PROTECTED]> writes:
> will be written without unsafePerformIO:
>    co' (x:xs) = do
>                       c1 <- co' xs
>                       c<- f (x:xs)
>                       if (c==1)
>                           then return 1:c1
>                           else return 0:c1
>

You might want to use unsafeInterleaveIO :: IO a -> IO a. 
It allows IO computation to be deferred lazily.

In the particular example 
co' (x:xs) = do c1 <- unsafeInterleaveIO (co' xs)
                c  <- f (x:xs)
                if (c==1) then return (1:c1) else return (0:c1)


- Einar Karttunen
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to