
Hi all, I am trying to read structured data from a socket and return a lazy list of records. However, the socket reading operation seems to be strict and never returns (until stack overflow). Here's some simplified code to reproduce the problem: -------------------- import Control.Monad main = do messages <- readLazy mapM_ (\x -> putStr $ show x ++ "\n") $ messages return () where readLazy :: IO [String] readLazy = do c <- fancyIORead liftM2 (++) (return c) readLazy fancyIORead :: IO [String] fancyIORead = return ["aa","bb"] -------------------- In my implementation fancyIORead reads blocks from the socket and returns a list of records. But it seems readLazy doesn't ever return. What could be the problem here? Also, if anyone has a better solution to write this thing, pls let me know. Thanks! Fabian