generator: function that returns a channel