stefan has pointed me a nice version:
============= =======================================================
randomInts :: IO [Int]
randomInts = randoms `fmap` newStdGen
main = do
ints <- randomInts
print $ take 5 ints
=========== =========================================================
Anyway I'm curious why
============= =======================================================
module Main where
import Data.Char
import Control.Monad
import Random
import System.IO.Unsafe
randomInts :: IO [Int]
randomInts = unsafeInterleaveIO $
sequence $ cycle [unsafeInterleaveIO randomIO]
main = do
ints <- unsafeInterleaveIO randomInts
print $ take 5 ints
============= =======================================================
doesn't return.
Where did I miss another unsafeInerleaveIO to make it lazy enough?
I still need a hint.
Marc
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe