Control.Concurrent.Chan: how do i close a channel?

Aaron Denney wnoise at
Mon Jul 16 11:52:13 EDT 2007

On 2007-07-16, Claus Reinke <claus.reinke at> wrote:
>> When you're done writing, just stop writing.
> yes, but any user of getChanContents will be left hanging! that kind
> of function doesn't really work well without a way to tell it that it has
> nothing more to wait for.

Yeah, getChanContents is not suitable for streams that may end.

A note in the documentation to this effect may be useful.  Some sort of 
unfold-like combinator to lazily read from a Chan (Maybe a) into a list
may be useful instead.

Aaron Denney

More information about the Libraries mailing list