
On 24/01/2012 15:59, Edward Z. Yang wrote:
Excerpts from Ryan Newton's message of Tue Jan 24 10:25:37 -0500 2012:
This is related but somewhat tangential --
*Why isn't there a tryReadChan?* It looks like it would be implementable with the current Chan representation in terms of tryTakeMVar. Especially since isEmptyChan is deprecated this would be nice to have.
Because of missing tryReadChan there is no non-blocking way to read data resident in a Chan (i.e. flush it -- in this case because I was in an exception handler and wanted to flush out what was left in memory in a Chan). I found myself rolling my own in the form of the following data structure to get around this:
Aw, that's a shame, especially since there does exist a tryReadMVar, so it seems like it ought to be possible (though I haven't checked closely.)
http://hackage.haskell.org/trac/ghc/ticket/4535 Looks like we didn't get around to adding it. Cheers, Simon