
Nathan Hüsken
So I would have a main arrow like this (leaving out the Map for which I have to lookup the syntax):
main = proc in -> do planet1 <- planets initPlanet1 -< allPlanets planet2 <- ... ... allPlanets <- delay [] -< [planet1,planet2 ...]
(I would probably have some arrow managing all planets instead of listing them separately) Correct?
Yes, that's the basic idea. Just drop in a 'rec' somewhere for the feedback to work.
Yes, that makes sense. There is still a little overhead. Assuming collisions are symmetric, the OOP approach would only test every pair of planets once ... not in the way I wrote it down, but it could easily be changed so that it does. But here they have to tested twice. Thats only factor 2 and probably acceptable. Still, is it avoidable?
Yes, it is. You can write a managing wire transformer (along the lines of the ones from Control.Wire.Trans.Combine) specifically for colliding objects. It's really much easier than it sounds. Just have a look into the source code of that module. Greets, Ertugrul -- Not to be or to be and (not to be or to be and (not to be or to be and (not to be or to be and ... that is the list monad.