
I tried this:
fetchUDPSIP :: TChan a -> TChan B.ByteString -> IO ()
fetchUDPSIP commands chan = do
sock <- getUDPSocket 5060
results <- (mapM unsafeInterleaveIO . repeat . getUDP) sock
mapM_ (atomically . writeTChan chan) results
fetchLine = do
results <- (mapM unsafeInterleaveIO . repeat) Prelude.getLine
mapM_ Prelude.putStrLn results
But it seems to have become strict again in that neither version will return
any results until it has gotten everything it can.
Also I'm not sure, but I'm pretty sure any "unsafe" function is still going
to have the original problem where it causes all other threads to stop while
it performs, so I don't think I can use unsafe anything at all and have my
program work properly.
On Mon, Jul 19, 2010 at 10:41 AM, Stephen Tetley
How about unsafeInterleaveIO? - You might have to experiment where to put it, but you shouldn't need the local unstrict definition.
Because it doesn't violate type safety it is considered less heinous than unsafePerformIO. _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners