Hi Stephen
Hi Fabian
You need to yield with unsafeInterleaveIO to allow some of the list to
be be consumed.
Something like this (which never terminates of course, but do produce output):
import System.IO.Unsafe
import Control.MonadreadLazy = unsafeInterleaveIO $ do
main = do messages <- readLazy
mapM_ (\x -> putStr $ show x ++ "\n") $ messages
return ()
where
readLazy :: IO [String]
{ c <- fancyIORead
; liftM2 (++) (return c) readLazy
}
fancyIORead :: IO [String]
fancyIORead = return ["aa","bb"]