[Haskell-beginners] Closing a channel

Lyndon Maydwell maydwell at gmail.com
Thu May 12 12:20:01 CEST 2011


Hi Beginners.

I'm trying to implement a program that accumulates a list of items
through many IO actions, then use these in another part of the program
as a list.

I've found Control.Concurrent.Chan which seems to provide a nice
abstraction with getChanContents :: Chan a -> IO [a], but there
doesn't seem to be a way for the source to close the channel.

Are channels the right abstraction for something like this? Should
look in to (itter|enumer)at(or|ee)s instead... They seem to encompass
this model, but look quite involved.



More information about the Beginners mailing list