tweag/capability

Add `HasStream` capability

aspiwack opened this issue · 0 comments

Or HasGenerator if we want to sound pythony. This would have a single method

yield :: HasStream t a m => a -> m ()

It's also a common capability. When in need, it's often implemented as a writer of [a], but that's quadratic. Instead, the basic instances should be in terms of HasState t [a] m (with adding the yielded values to the beginning of the list), and of Stream from the streaming package.