
On Tue, Mar 20, 2001 at 06:07:25PM +0100, Andreas Gruenbacher wrote:
The sort of lazy evaluation employed in [Hannah's] solution is in a way similar to coroutines, with the following restrictions (correct me if I'm wrong):
* It is not possible to implement cyclic communication.
It certainly is, and that seems to me a neat way to do process-driven simulation: a process generates a list of future events, which a controller merges into its pool, from which it selects the next event to simulate, starting the next process, and so on. You could use a monad to hide the event output if required.
* It is not possible to implement processes with multiple asynchronous output channels.
Again, should be no problem, but what do you need these for?
I really would like to preserve the elegance of simulations in Simula, but with all the advantages Haskell offers. I believe that in current Haskell implementations all the components needed for "proper" coroutines are more or less there (because lazy evaluation is pretty close).
Indeed, you may be able to do all the simulation primitives in pure Haskell, if you take a step back from the channel view.