Hacker News new | ask | show | jobs
by eli_gottlieb 2145 days ago
Wouldn't infinite streams more naturally form a comonad than a monad, though? They're coinductive types.
1 comments

Depends how you're using them. Apparently Lucid finds this "diagonal" approach to streams - which is not the normal way of streams in most programming languages - to be useful, in which case the monad model is a good fit.
How else could you combine infinite streams?
Streams as I've seen them used in other languages are possibly-terminating, d* is a stream of the single value d and D -> D* is flattening the stream of streams.